home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / profile.d / gvfs-bash-completion.sh
Encoding:
Linux/UNIX/POSIX Shell Script  |  2009-04-13  |  2.5 KB  |  65 lines

  1. #!/bin/sh
  2.  
  3. # Copyright (C) 2006-2007 Red Hat, Inc.
  4. #
  5. # This library is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU Lesser General Public License as
  7. # published by the Free Software Foundation; either version 2 of the
  8. # License, or (at your option) any later version.
  9. #
  10. # This library is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. # Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public
  16. # License along with this library; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
  18. # USA.
  19. #
  20. # Author: David Zeuthen <davidz@redhat.com>
  21.  
  22. # Check for bash                                                                
  23. [ -z "$BASH_VERSION" ] && return
  24.  
  25. ####################################################################################################
  26.  
  27.  
  28. __gvfs_multiple_uris() {
  29.     local IFS=$'\n'
  30.     local cur="${COMP_WORDS[COMP_CWORD]}"
  31.  
  32.     COMPREPLY=($(compgen -W '$(gvfs-ls --show-completions "$cur")' -- ""))
  33.  
  34.     # don't misbehave on colons; See item E13 at http://tiswww.case.edu/php/chet/bash/FAQ
  35.     # We handle this locally be extracting any BLAH: prefix and removing it from the result.
  36.     # Not great, but better than globally changing COMP_WORDBREAKS
  37.     
  38.     case "$cur" in
  39.     *:*)
  40.         case "$COMP_WORDBREAKS" in
  41.         *:*) colon_prefix=$(echo $cur | sed 's/:[^:]*$/:/' )
  42.             COMPREPLY=${COMPREPLY##${colon_prefix}}
  43.             ;;
  44.         esac
  45.         ;;
  46.     esac
  47. }
  48.  
  49. ####################################################################################################
  50.  
  51. complete -o nospace -F __gvfs_multiple_uris gvfs-ls
  52. complete -o nospace -F __gvfs_multiple_uris gvfs-info
  53. complete -o nospace -F __gvfs_multiple_uris gvfs-cat
  54. complete -o nospace -F __gvfs_multiple_uris gvfs-less
  55. complete -o nospace -F __gvfs_multiple_uris gvfs-copy
  56. complete -o nospace -F __gvfs_multiple_uris gvfs-mkdir
  57. complete -o nospace -F __gvfs_multiple_uris gvfs-monitor-dir
  58. complete -o nospace -F __gvfs_multiple_uris gvfs-monitor-file
  59. complete -o nospace -F __gvfs_multiple_uris gvfs-move
  60. complete -o nospace -F __gvfs_multiple_uris gvfs-open
  61. complete -o nospace -F __gvfs_multiple_uris gvfs-rm
  62. complete -o nospace -F __gvfs_multiple_uris gvfs-save
  63. complete -o nospace -F __gvfs_multiple_uris gvfs-trash
  64. complete -o nospace -F __gvfs_multiple_uris gvfs-tree
  65.