Minor polish like adding missing whitespace, switch to using --argument switch in function definitions to make code more readable, add a few minor saftey checks, etc.

darcs-hash:20070923210730-75c98-88557ba8b6020cae04a5e437c6bb6370e39c04d9.gz
This commit is contained in:
liljencrantz 2007-09-24 07:07:30 +10:00
parent 449a75756d
commit 61ebc12dd4
7 changed files with 21 additions and 22 deletions

View file

@ -1180,7 +1180,10 @@ static void read_array( FILE* file, array_list_t *comp )
if( wcs ) if( wcs )
{ {
unescaped = unescape( wcs, 0 ); unescaped = unescape( wcs, 0 );
if( unescaped )
{
al_push( comp, unescaped ); al_push( comp, unescaped );
}
free( wcs ); free( wcs );
} }
} }

View file

@ -1,5 +1,4 @@
function __fish_append -d "Internal completion function for appending string to the commandline" function __fish_append -d "Internal completion function for appending string to the commandline" --argument separator
set separator $argv[1]
set -e argv[1] set -e argv[1]
set str (commandline -tc| sed -ne "s/\(.*$separator\)[^$separator]*/\1/p"|sed -e "s/--.*=//") set str (commandline -tc| sed -ne "s/\(.*$separator\)[^$separator]*/\1/p"|sed -e "s/--.*=//")
printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/") printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/")

View file

@ -3,9 +3,8 @@
# with description $argv[2] if defined, otherwise use 'Directory' # with description $argv[2] if defined, otherwise use 'Directory'
# #
function __fish_complete_directories -d "Complete using directories" function __fish_complete_directories -d "Complete using directories" --argument comp
set comp $argv[1]
set desc (_ Directory) set desc (_ Directory)
if test (count $argv) -gt 1 if test (count $argv) -gt 1

View file

@ -1,15 +1,15 @@
function __fish_complete_ssh -d "common completions for ssh commands" function __fish_complete_ssh -d "common completions for ssh commands" --argument command
complete -c $argv -s 1 --description "Protocoll version 1 only" complete -c $command -s 1 --description "Protocoll version 1 only"
complete -c $argv -s 2 --description "Protocoll version 2 only" complete -c $command -s 2 --description "Protocoll version 2 only"
complete -c $argv -s 4 --description "IPv4 addresses only" complete -c $command -s 4 --description "IPv4 addresses only"
complete -c $argv -s 6 --description "IPv6 addresses only" complete -c $command -s 6 --description "IPv6 addresses only"
complete -c $argv -s C --description "Compress all data" complete -c $command -s C --description "Compress all data"
complete -xc $argv -s c --description "Encryption algorithm" -a "blowfish 3des des" complete -xc $command -s c --description "Encryption algorithm" -a "blowfish 3des des"
complete -r -c $argv -s F --description "Configuration file" complete -r -c $command -s F --description "Configuration file"
complete -r -c $argv -s i --description "Identity file" complete -r -c $command -s i --description "Identity file"
complete -x -c $argv -s o --description "Options" -a " complete -x -c $command -s o --description "Options" -a "
AddressFamily AddressFamily
BatchMode BatchMode
BindAddress BindAddress
@ -56,6 +56,6 @@ function __fish_complete_ssh -d "common completions for ssh commands"
UserKnownHostsFile UserKnownHostsFile
VerifyHostKeyDNS VerifyHostKeyDNS
" "
complete -c $argv -s v --description "Verbose mode" complete -c $command -s v --description "Verbose mode"
end end

View file

@ -1,7 +1,5 @@
function __fish_print_help --description "Print help message for the specified fish function or builtin" function __fish_print_help --description "Print help message for the specified fish function or builtin" --argument item
set -l item
switch $argv[1] switch $argv[1]
case '.' case '.'