Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'you can open files with apps this way, too:' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
you can open files with apps this way, too:
Authored by: GlowingApple on Nov 04, '05 09:32:15AM

Tab completion also works case-sensitive. So for me, Mai[Tab], only generates Mail.app, whereas mai[Tab] only generates mail. Interesting how case sensitivity is mixed. I'm anxious for the day when a larger majority of Mac apps support the Mac OS X Extended (journaled, case-sensitive) file system.

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."



[ Reply to This | # ]
you can open files with apps this way, too:
Authored by: taxi on Nov 04, '05 07:18:29PM

Actually, the filesystem is not case-sensitive. Only case-preserving.

An annoying difference.



[ Reply to This | # ]
you can open files with apps this way, too:
Authored by: cueball on Nov 07, '05 01:32:40AM
"I'm anxious for the day when a larger majority of Mac apps support the Mac OS X Extended (journaled, case-sensitive) file system."
Then:
"Actually, the filesystem is not case-sensitive. Only case-preserving. An annoying difference."
Guess you either didn't read closely enough, or weren't aware, but 10.4 has a case-sensitive version of HFS+J. It's called HFSX. So actually, the filesystem that's referred to by the original poster is case-sensitive.

[ Reply to This | # ]
you can open files with apps this way, too:
Authored by: kholburn on Nov 07, '05 09:40:46PM
If you create the links in the article with all lowercase names then the tab completion will work with lower case.

I have a bash completion fragment that you can put in say ~/.bash_completion or save it to ~/open_completion and source it using the command: . open_completion that handles this in a text file rather than a bunch of links. The mdfind command was from another comment. Use "grep -i" instead of grep to make the completion case insensitive.


#!/bin/sh
#

export appslist=~/.apps.list

_make_app_list () {
  mdfind -onlyin /Applications 
         -onlyin /Developer 
         -onlyin /Applications2 
        "kMDItemContentType == 'com.apple.application-*'" | 
  while read ; do
     echo "${REPLY##*/}"
  done |sort -i > "$appslist"
}

_apple_open ()
{
  local cur prev

  # renew appslist if it's older than a day
  if ! /usr/bin/perl -e '
    my $ARGV = $ARGV[0];
    if (-e $ARGV) { if (time - (stat $ARGV)[9] <= 86400) { exit (0); } }
    exit 1;
  ' "$appslist" ; then
    _make_app_list
  fi

  COMPREPLY=()
  cur=${COMP_WORDS[COMP_CWORD]}
  prev=${COMP_WORDS[COMP_CWORD-1]}

  # do not attempt completion if we're specifying an option
  [[ "$cur" == -* ]] && return 0

  if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -a ]]; then

    # If we have an appslist
    if [ -s "$appslist" -a -r "$appslist" ]; then
      # Escape dots in paths for grep
      cur=${cur//./.}

      COMPREPLY=( $( grep "^$cur" "$appslist" ) )
    fi
  else
    _filedir
  fi

  return 0
}
complete -F _apple_open open




[ Reply to This | # ]
bash completion
Authored by: kholburn on Nov 08, '05 04:52:31AM
Ummmm the script didn't come out quite right. How do you get backslashes? I've forgotten. Anyway here is a link to text version. The spaces are escaped properly as well.


[ Reply to This | # ]