diff --git a/builtin.c b/builtin.c index 235902efa..9e985fd35 100644 --- a/builtin.c +++ b/builtin.c @@ -2000,7 +2000,7 @@ static int builtin_source( wchar_t ** argv ) { wchar_t *fn = wrealpath( argv[1], 0 ); const wchar_t *fn_intern; - + if( !fn ) { fn_intern = intern( argv[1] ); @@ -2018,8 +2018,8 @@ static int builtin_source( wchar_t ** argv ) current_block->param1.source_dest = fn_intern; parse_util_set_argv( argv+2); - res = reader_read( fd ); + parser_pop_block(); if( res ) { diff --git a/builtin_complete.c b/builtin_complete.c index b9947c1bd..1e3ef7ebd 100644 --- a/builtin_complete.c +++ b/builtin_complete.c @@ -253,7 +253,7 @@ int builtin_complete( wchar_t **argv ) string_buffer_t short_opt; array_list_t gnu_opt, old_opt; - wchar_t *comp=L"", *desc=L"", *condition=L"", *load=0; + wchar_t *comp=L"", *desc=L"", *condition=L""; wchar_t *do_complete = 0; @@ -333,10 +333,6 @@ int builtin_complete( wchar_t **argv ) L"condition", required_argument, 0, 'n' } , - { - L"load", required_argument, 0, 'y' - } - , { L"do-complete", required_argument, 0, 'C' } @@ -351,7 +347,7 @@ int builtin_complete( wchar_t **argv ) int opt = wgetopt_long( argc, argv, - L"a:c:p:s:l:o:d:frxeun:y:C:", + L"a:c:p:s:l:o:d:frxeun:C:", long_options, &opt_index ); if( opt == -1 ) @@ -368,6 +364,7 @@ int builtin_complete( wchar_t **argv ) long_options[opt_index].name ); sb_append( sb_err, parser_current_line() ); + // builtin_print_help( argv[0], sb_err ); @@ -428,15 +425,13 @@ int builtin_complete( wchar_t **argv ) condition = woptarg; break; - case 'y': - load = woptarg; - break; - case 'C': do_complete = woptarg?woptarg:reader_get_buffer(); break; case '?': + sb_append( sb_err, + parser_current_line() ); // builtin_print_help( argv[0], sb_err ); res = 1; @@ -494,10 +489,6 @@ int builtin_complete( wchar_t **argv ) res = 1; } - else if( load ) - { - complete_load( load, 1 ); - } else if( (al_get_count( &cmd) == 0 ) && (al_get_count( &path) == 0 ) ) { /* No arguments specified, meaning we print the definitions of diff --git a/init/completions/btdownloadcurses.py.fish b/init/completions/btdownloadcurses.py.fish index b92ddca5f..73a174618 100644 --- a/init/completions/btdownloadcurses.py.fish +++ b/init/completions/btdownloadcurses.py.fish @@ -1,2 +1 @@ - -complete -y btdownloadheadless.py +__fish_complete_bittorrent btdownloadcurses.py diff --git a/init/completions/btdownloadheadless.py.fish b/init/completions/btdownloadheadless.py.fish index 0fb89804d..d2e83c600 100644 --- a/init/completions/btdownloadheadless.py.fish +++ b/init/completions/btdownloadheadless.py.fish @@ -1,33 +1 @@ -# Bittorrent commands - -for i in btdownloadcurses.py btdownloadheadless.py; - complete -c $i -l max_uploads -x -d (_ "Maximum uploads at once") - complete -c $i -l keepalive_interval -x -d (_ "Number of seconds between keepalives") - complete -c $i -l download_slice_size -x -d (_ "Bytes per request") - complete -c $i -l request_backlog -x -d (_ "Requests per pipe") - complete -c $i -l max_message_length -x -d (_ "Maximum length prefix encoding") - complete -c $i -l ip -d (_ "IP to report to the tracker") -x -a "(__fish_print_addresses)" - complete -c $i -l minport -d (_ "Minimum port to listen to") - complete -c $i -l maxport -d (_ "Maximum port to listen to") - complete -c $i -l responsefile -r -d (_ "File for server response") - complete -c $i -l url -x -d (_ "URL to get file from") - complete -c $i -l saveas -r -d (_ "Local file target") - complete -c $i -l timeout -x -d (_ "Time to close inactive socket") - complete -c $i -l timeout_check_interval -x -d (_ "Time between checking timeouts") - complete -c $i -l max_slice_length -x -d (_ "Maximum outgoing slice length") - complete -c $i -l max_rate_period -x -d (_ "Maximum time to guess rate") - complete -c $i -l bind -x -d (_ "IP to bind to locally") -a "(__fish_print_addresses)" - complete -c $i -l display_interval -x -d (_ "Time between screen updates") - complete -c $i -l rerequest_interval -x -d (_ "Time to wait between requesting more peers") - complete -c $i -l min_peers -x -d (_ "Minimum number of peers to not do requesting") - complete -c $i -l http_timeout -x -d (_ "Number of seconds before assuming http timeout") - complete -c $i -l max_initiate -x -d (_ "Number of peers at which to stop initiating new connections") - complete -c $i -l max_allow_in -x -d (_ "Maximum number of connections to allow") - complete -c $i -l check_hashes -x -d (_ "Whether to check hashes on disk") - complete -c $i -l max_upload_rate -x -d (_ "Maximum kB/s to upload at") - complete -c $i -l snub_time -x -d (_ "Seconds to wait for data to come in before assuming choking") - complete -c $i -l spew -x -d (_ "Whether to display diagnostic info") - complete -c $i -l rarest_first_cutoff -x -d (_ "Number of downloads at which to switch from random to rarest first") - complete -c $i -l min_uploads -x -d (_ "Number of uploads to fill out to with optimistic unchokes") - complete -c $i -l report_hash_failiures -x -d (_ "Whether to inform the user that hash failures occur") -end; +__fish_complete_bittorrent btdownloadheadless.py diff --git a/init/completions/df.fish b/init/completions/df.fish index d950a42b6..9cbb75d5b 100644 --- a/init/completions/df.fish +++ b/init/completions/df.fish @@ -2,11 +2,6 @@ # Completions for df # -# -# Completions for mount define the $__fish_filesystems variable -# -complete -y mount - # # Test if we are using GNU sed # @@ -19,7 +14,7 @@ __fish_gnu_complete -c df -s i -l inodes -d (_ "List inode information") $is_gnu __fish_gnu_complete -c df -s k -d (_ "Use 1kB block size") $is_gnu __fish_gnu_complete -c df -s l -l local -d (_ "List only local filesystems") $is_gnu __fish_gnu_complete -c df -s P -l portability -d (_ "Use Posix format") $is_gnu -__fish_gnu_complete -c df -s t -l type -r -d (_ "Show filesystems of specified type") $is_gnu -x -a $__fish_filesystems +__fish_gnu_complete -c df -s t -l type -r -d (_ "Show filesystems of specified type") $is_gnu -x -a "(__fish_print_filesystems)" if test -n "$is_gnu" @@ -29,7 +24,7 @@ if test -n "$is_gnu" complete -c df -l no-sync -d (_ "Do not sync before getting usage info") complete -c df -l sync -d (_ "Sync before getting usage info") complete -c df -s T -l print-type -d (_ "Print filesystem type") - complete -c df -s x -l exclude-type -d (_ "Excluded filesystem type") -r -x -a $__fish_filesystems + complete -c df -s x -l exclude-type -d (_ "Excluded filesystem type") -r -x -a "(__fish_print_filesystems)" complete -c df -l help -d (_ "Display help and exit") complete -c df -l version -d (_ "Display version and exit") diff --git a/init/completions/elatex.fish b/init/completions/elatex.fish index 7d850e978..68294ba4d 100644 --- a/init/completions/elatex.fish +++ b/init/completions/elatex.fish @@ -1 +1,2 @@ -complete -y tex +__fish_complete_tex elatex + diff --git a/init/completions/etex.fish b/init/completions/etex.fish index 7d850e978..b0280a375 100644 --- a/init/completions/etex.fish +++ b/init/completions/etex.fish @@ -1 +1 @@ -complete -y tex +__fish_complete_tex etex diff --git a/init/completions/la.fish b/init/completions/la.fish index 3868e53e1..1bc6bc95f 100644 --- a/init/completions/la.fish +++ b/init/completions/la.fish @@ -1,2 +1,2 @@ -complete -y ls +__fish_complete_ls la diff --git a/init/completions/latex.fish b/init/completions/latex.fish index 7d850e978..1897f9653 100644 --- a/init/completions/latex.fish +++ b/init/completions/latex.fish @@ -1 +1,2 @@ -complete -y tex +__fish_complete_tex latex + diff --git a/init/completions/ll.fish b/init/completions/ll.fish index 3868e53e1..2fe36ef6c 100644 --- a/init/completions/ll.fish +++ b/init/completions/ll.fish @@ -1,2 +1,2 @@ -complete -y ls +__fish_complete_ls ll diff --git a/init/completions/ls.fish b/init/completions/ls.fish index 0a2bed555..517d27591 100644 --- a/init/completions/ls.fish +++ b/init/completions/ls.fish @@ -1,105 +1,2 @@ -# -# Completions for the ls command and its aliases -# -# Test if we are using GNU ls - -set -l is_gnu -ls --version >/dev/null ^/dev/null; and set is_gnu --is-gnu - -set -l cmds -c ls -c ll -c la - -# Shared ls switches - -__fish_gnu_complete $cmds -s a -l all -d (_ "Show hidden") $is_gnu -__fish_gnu_complete $cmds -s A -l almost-all -d (_ "Show hidden except . and ..") $is_gnu -__fish_gnu_complete $cmds -s F -l classify -d (_ "Append filetype indicator") $is_gnu -__fish_gnu_complete $cmds -s H -l dereference-command-line -d (_ "Follow symlinks") $is_gnu -__fish_gnu_complete $cmds -s L -l dereference -d (_ "Follow symlinks") $is_gnu -__fish_gnu_complete $cmds -s R -l recursive -d (_ "List subdirectory recursively") $is_gnu -__fish_gnu_complete $cmds -s b -l escape -d (_ "Octal escapes for non graphic characters") $is_gnu -__fish_gnu_complete $cmds -s d -l directory -d (_ "List directories, not their content") $is_gnu -__fish_gnu_complete $cmds -s h -l human-readable -d (_ "Human readable sizes") $is_gnu -__fish_gnu_complete $cmds -s i -l inode -d (_ "Print inode number of files") $is_gnu -__fish_gnu_complete $cmds -s n -l numeric-uid-gid -d (_ "Long format, numeric IDs") $is_gnu -__fish_gnu_complete $cmds -s p -l file-type -d (_ "Append filetype indicator") $is_gnu -__fish_gnu_complete $cmds -s q -l hide-control-chars -d (_ "Replace non-graphic characters with '?'") $is_gnu -__fish_gnu_complete $cmds -s r -l reverse -d (_ "Reverse sort order") $is_gnu -__fish_gnu_complete $cmds -s s -l size -d (_ "Print size of files") $is_gnu - -complete $cmds -s C -d (_ "List by columns") -complete $cmds -s S -d (_ "Sort by size") -complete $cmds -s c -d (_ "Show and sort by ctime") -complete $cmds -s f -d (_ "Don't sort") -complete $cmds -s g -d (_ "Long format without owner") -complete $cmds -s k -d (_ "Set blocksize to 1kB") -complete $cmds -s l -d (_ "Long format") -complete $cmds -s m -d (_ "Comma separated format") -complete $cmds -s t -d (_ "Sort by modification time") -complete $cmds -s u -d (_ "Show access time") -complete $cmds -s x -d (_ "List entries by lines") -complete $cmds -s 1 -d (_ "List one file per line") - -if test -n "$is_gnu" - - # GNU specific features - - complete $cmds -l author -d (_ "Print author") - complete $cmds -l blocksize -x -d (_ "Set block size") - complete $cmds -s B -l ignore-backups -d (_ "Ignore files ending with ~") - complete $cmds -l color -f -a "never always auto" -d (_ "Use colors") - complete $cmds -s D -l dired -d (_ "Generate dired output") - complete $cmds -l format -x -a "across commas horizontal long single-column verbose vertical" -d (_ "List format") - complete $cmds -l full-time -d (_ "Long format, full-iso time") - complete $cmds -s G -l no-group -d (_ "Don't print group information") - complete $cmds -l si -d (_ "Human readable sizes, powers of 1000") - complete $cmds -l dereference-command-line-symlink-to-dir #-d (_ "Follow directory symlinks from command line") - complete $cmds -l indicator-style -x -a "none classify file-type" -d (_ "Append filetype indicator") - complete $cmds -s I -l ignore -r -d (_ "Skip entries matching pattern") - complete $cmds -s N -l literal -d (_ "Print raw entry names") - complete $cmds -s o -d (_ "Long format without groups") - complete $cmds -l show-control-chars -d (_ "Non graphic as-is") - complete $cmds -s Q -l quote-name -d (_ "Enclose entry in quotes") - complete $cmds -l quoting-style -x -a "literal locale shell shell-always c escape" -d (_ "Select quoting style") - complete $cmds -l sort -x -d (_ "Sort criteria") -a " - extension\t'Sort by file extension' - none\tDon't\ sort - size\t'Sort by size' - time\t'Sort by modification time' - version\t'Sort by version' - status\t'Sort by file status modification time' - atime\t'Sort by access time' - access\t'Sort by access time' - use\t'Sort by access time' - " - complete $cmds -l time -x -d (_ "Show time type") -a " - time\t'Sort by modification time' - access\t'Sort by access time' - use\t'Sort by use time' - ctime\t'Sort by file status modification time' - status\t'Sort by status time' - " - complete $cmds -l time-style -x -a "full-iso long-iso iso locale" -d (_ "Select time style") - complete $cmds -s T -l tabsize -x -a "1 2 3 4 5 6 7 8 9 10 11 12" -d (_ "Assume tab stops at each COLS") - complete $cmds -s U -d (_ "Do not sort") - complete $cmds -s v -d (_ "Sort by version") - complete $cmds -s w -l width -x -d (_ "Assume screen width") - complete $cmds -s X -d (_ "Sort by extension") - complete $cmds -l help -d (_ "Display help and exit") - complete $cmds -l version -d (_ "Display version and exit") - -else - - # If not a GNU system, assume we have standard BSD ls features instead - - complete $cmds -s B -d (_ "Octal escapes for non graphic characters") - complete $cmds -s G -d (_ "Use colors") - complete $cmds -s I -d (_ "Prevent -A from being automatically set for root") - complete $cmds -s P -d (_ "Don't follow symlinks") - complete $cmds -s T -d (_ "Show modification time") - complete $cmds -s W -d (_ "Show whiteouts when scanning directories") - complete $cmds -s Z -d (_ "Display each file's MAC label") - complete $cmds -s o -d (_ "Include the file flags in a long (-l) output") - complete $cmds -s w -d (_ "Print raw entry names") - -end +__fish_complete_ls ls diff --git a/init/completions/mount.fish b/init/completions/mount.fish index af7e3cb9e..94fa929bf 100644 --- a/init/completions/mount.fish +++ b/init/completions/mount.fish @@ -3,44 +3,6 @@ # A list of all known filesystem types, used by various completions, # including mount and df -set -g __fish_filesystems ' - adfs - affs - autofs - coda - coherent - cramfs - devpts - efs - ext - ext2 - ext3 - hfs - hpfs - iso9660 - jfs - minix - msdos - ncpfs - nfs - ntfs - proc - qnx4 - ramfs - reiserfs - romfs - smbfs - sysv - tmpfs - udf - ufs - umsdos - vfat - xenix - xfs - xiafs -' - # Completions for mount complete -x -c mount -a '(cat /etc/fstab|sed -e "s/^\([^ \t]*\)[ \t]*\([^ \t]*\).*/\1\n\2/"|grep "^/")' -d (_ 'Mount point') complete -c mount -s V -d (_ 'Display version and exit') @@ -59,7 +21,7 @@ complete -x -c mount -s U -d (_ 'Mount partition with specified UID') complete -c mount -s O -x -d (_ 'Exclude filesystems') complete -c mount -l bind -f -d (_ 'Remount a subtree to a second position') complete -c mount -l move -f -d (_ 'Move a subtree to a new position') -complete -c mount -x -s t -d (_ 'Filesystem') -a $__fish_filesystems +complete -c mount -x -s t -d (_ 'Filesystem') -a "(__fish_print_filesystems)" complete -c mount -x -s o -d (_ 'Mount option') -a '(__fish_append , $__fish_mount_opts)' diff --git a/init/completions/omega.fish b/init/completions/omega.fish index 7d850e978..76908cc8a 100644 --- a/init/completions/omega.fish +++ b/init/completions/omega.fish @@ -1 +1,2 @@ -complete -y tex +__fish_complete_tex omega + diff --git a/init/completions/pdfelatex.fish b/init/completions/pdfelatex.fish index 7d850e978..555d9b7d1 100644 --- a/init/completions/pdfelatex.fish +++ b/init/completions/pdfelatex.fish @@ -1 +1,3 @@ -complete -y tex +__fish_complete_tex pdfelatex + + diff --git a/init/completions/pdfetex.fish b/init/completions/pdfetex.fish index 7d850e978..a5ae9f9a2 100644 --- a/init/completions/pdfetex.fish +++ b/init/completions/pdfetex.fish @@ -1 +1,3 @@ -complete -y tex +__fish_complete_tex pdfetex + + diff --git a/init/completions/pdflatex.fish b/init/completions/pdflatex.fish index 7d850e978..80b1a5bf2 100644 --- a/init/completions/pdflatex.fish +++ b/init/completions/pdflatex.fish @@ -1 +1,2 @@ -complete -y tex +__fish_complete_tex pdflatex + diff --git a/init/completions/pdftex.fish b/init/completions/pdftex.fish index 7d850e978..c4c6f2702 100644 --- a/init/completions/pdftex.fish +++ b/init/completions/pdftex.fish @@ -1 +1,3 @@ -complete -y tex +__fish_complete_tex pdftex + + diff --git a/init/completions/scp.fish b/init/completions/scp.fish index 4ad58e721..111a73008 100644 --- a/init/completions/scp.fish +++ b/init/completions/scp.fish @@ -2,7 +2,7 @@ # Load common ssh options # -complete -y ssh +__fish_complete_ssh scp # # scp specific completions diff --git a/init/completions/set.fish b/init/completions/set.fish index e2f14ae3d..77e64972b 100644 --- a/init/completions/set.fish +++ b/init/completions/set.fish @@ -2,12 +2,6 @@ # Completions for the 'set' builtin # -# -# We depend on set_color completions for color definitions -# - -complete -y set_color - # # All locale variables used by set completions # diff --git a/init/completions/ssh.fish b/init/completions/ssh.fish index a57b4992f..2aff2dea3 100644 --- a/init/completions/ssh.fish +++ b/init/completions/ssh.fish @@ -1,69 +1,8 @@ # -# Common completions for all ssh commands +# Load common ssh options # -for i in ssh scp - complete -c $i -s 1 -d (_ "Protocoll version 1 only") - complete -c $i -s 2 -d (_ "Protocoll version 2 only") - complete -c $i -s 4 -d (_ "IPv4 addresses only") - complete -c $i -s 6 -d (_ "IPv6 addresses only") - complete -c $i -s C -d (_ "Compress all data") - complete -xc $i -s c -d (_ "Encryption algorithm") -a "blowfish 3des des" - complete -r -c $i -s F -d (_ "Configuration file") - complete -r -c $i -s i -d (_ "Identity file") - complete -x -c $i -s o -d (_ "Options") -a " - AddressFamily - BatchMode - BindAddress - ChallengeResponseAuthentication - CheckHostIP - Cipher - Ciphers - Compression - CompressionLevel - ConnectionAttempts - ConnectTimeout - ControlMaster - ControlPath - GlobalKnownHostsFile - GSSAPIAuthentication - GSSAPIDelegateCredentials - Host - HostbasedAuthentication - HostKeyAlgorithms - HostKeyAlias - HostName - IdentityFile - IdentitiesOnly - LogLevel - MACs - NoHostAuthenticationForLocalhost - NumberOfPasswordPrompts - PasswordAuthentication - Port - PreferredAuthentications - Protocol - ProxyCommand - PubkeyAuthentication - RhostsRSAAuthentication - RSAAuthentication - SendEnv - ServerAliveInterval - ServerAliveCountMax - SmartcardDevice - StrictHostKeyChecking - TCPKeepAlive - UsePrivilegedPort - User - UserKnownHostsFile - VerifyHostKeyDNS - " - complete -c $i -s v -d (_ "Verbose mode") -end; - -# -# ssh specific completions -# +__fish_complete_ssh ssh complete -x -c ssh -d Hostname -a " diff --git a/init/completions/tex.fish b/init/completions/tex.fish index c612d31bc..e62d33a46 100644 --- a/init/completions/tex.fish +++ b/init/completions/tex.fish @@ -1,7 +1,5 @@ -set -l cmds -c etex -c tex -c elatex -c latex -c pdflatex -c pdfelatex -c pdftex -c pdfetex -c omega -complete $cmds -o help -d (_ "Display help and exit") -complete $cmds -o version -d (_ "Display version and exit") -complete $cmds -x -a "( - __fish_complete_suffix (commandline -ct) .tex '(La)TeX file' -)" + +set -l cmds -c etex -c tex -c elatex -c latex -c pdflatex -c pdfelatex -c pdftex -c pdfetex -c omega + +__fish_complete_tex tex diff --git a/init/completions/umount.fish b/init/completions/umount.fish index 79a605248..d69e75632 100644 --- a/init/completions/umount.fish +++ b/init/completions/umount.fish @@ -2,11 +2,6 @@ # Completions for the umount command # -# -# Depends on mount for $__fish_filesystems -# -complete -y mount - # # Find all mountpoints # @@ -20,7 +15,7 @@ complete -c umount -s r -d (_ "In case unmounting fails, try to remount read-onl complete -c umount -s d -d (_ "In case the unmounted device was a loop device, also free this loop device") complete -c umount -s i -d (_ "Don't call the /sbin/umount. helper even if it exists") complete -c umount -s a -d (_ "Unmount all of the file systems described in /etc/mtab") -complete -c umount -s t -d (_ "Actions should only be taken on file systems of the specified type") -xa $__fish_filesystems +complete -c umount -s t -d (_ "Actions should only be taken on file systems of the specified type") -xa "(__fish_print_filesystems)" complete -c umount -s O -d (_ "Actions should only be taken on file systems with the specified options in /etc/fstab") -xa '(cat /etc/mtab | cut -d " " -f 4)\t"Mount option"' complete -c umount -s f -d (_ "Force unmount (in case of an unreachable NFS system)") complete -c umount -s l -d (_ "Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy") diff --git a/init/completions/whatis.fish b/init/completions/whatis.fish index 17a8f6264..eda161e3c 100644 --- a/init/completions/whatis.fish +++ b/init/completions/whatis.fish @@ -1,3 +1,2 @@ -complete -y man complete -xc whatis -a "(__fish_complete_man)" diff --git a/init/completions/yum.fish b/init/completions/yum.fish index 0f6330dfa..3b44d2881 100644 --- a/init/completions/yum.fish +++ b/init/completions/yum.fish @@ -2,9 +2,6 @@ # Completions for the yum command # -#Load rpm completions, since that is where the package completion function is defined -complete -y rpm - #All yum commands #Test if the yum command has been specified diff --git a/init/functions/__fish_complete_bittorrent.fish b/init/functions/__fish_complete_bittorrent.fish new file mode 100644 index 000000000..1f1a21adc --- /dev/null +++ b/init/functions/__fish_complete_bittorrent.fish @@ -0,0 +1,33 @@ +# Bittorrent commands + +function __fish_complete_bittorrent + complete -c $argv -l max_uploads -x -d (_ "Maximum uploads at once") + complete -c $argv -l keepalive_interval -x -d (_ "Number of seconds between keepalives") + complete -c $argv -l download_slice_size -x -d (_ "Bytes per request") + complete -c $argv -l request_backlog -x -d (_ "Requests per pipe") + complete -c $argv -l max_message_length -x -d (_ "Maximum length prefix encoding") + complete -c $argv -l ip -d (_ "IP to report to the tracker") -x -a "(__fish_print_addresses)" + complete -c $argv -l minport -d (_ "Minimum port to listen to") + complete -c $argv -l maxport -d (_ "Maximum port to listen to") + complete -c $argv -l responsefile -r -d (_ "File for server response") + complete -c $argv -l url -x -d (_ "URL to get file from") + complete -c $argv -l saveas -r -d (_ "Local file target") + complete -c $argv -l timeout -x -d (_ "Time to close inactive socket") + complete -c $argv -l timeout_check_interval -x -d (_ "Time between checking timeouts") + complete -c $argv -l max_slice_length -x -d (_ "Maximum outgoing slice length") + complete -c $argv -l max_rate_period -x -d (_ "Maximum time to guess rate") + complete -c $argv -l bind -x -d (_ "IP to bind to locally") -a "(__fish_print_addresses)" + complete -c $argv -l display_interval -x -d (_ "Time between screen updates") + complete -c $argv -l rerequest_interval -x -d (_ "Time to wait between requesting more peers") + complete -c $argv -l min_peers -x -d (_ "Minimum number of peers to not do requesting") + complete -c $argv -l http_timeout -x -d (_ "Number of seconds before assuming http timeout") + complete -c $argv -l max_initiate -x -d (_ "Number of peers at which to stop initiating new connections") + complete -c $argv -l max_allow_in -x -d (_ "Maximum number of connections to allow") + complete -c $argv -l check_hashes -x -d (_ "Whether to check hashes on disk") + complete -c $argv -l max_upload_rate -x -d (_ "Maximum kB/s to upload at") + complete -c $argv -l snub_time -x -d (_ "Seconds to wait for data to come in before assuming choking") + complete -c $argv -l spew -x -d (_ "Whether to display diagnostic info") + complete -c $argv -l rarest_first_cutoff -x -d (_ "Number of downloads at which to switch from random to rarest first") + complete -c $argv -l min_uploads -x -d (_ "Number of uploads to fill out to with optimistic unchokes") + complete -c $argv -l report_hash_failiures -x -d (_ "Whether to inform the user that hash failures occur") +end diff --git a/init/functions/__fish_complete_ls.fish b/init/functions/__fish_complete_ls.fish new file mode 100644 index 000000000..0aac5ea4b --- /dev/null +++ b/init/functions/__fish_complete_ls.fish @@ -0,0 +1,109 @@ +# +# Completions for the ls command and its aliases +# + +# Test if we are using GNU ls + +function __fish_complete_ls -d "Compleletions for ls and it's aliases" + + set -l is_gnu + ls --version >/dev/null ^/dev/null; and set is_gnu --is-gnu + + set -l cmds -c $argv + + # Shared ls switches + + __fish_gnu_complete $cmds -s a -l all -d (_ "Show hidden") $is_gnu + __fish_gnu_complete $cmds -s A -l almost-all -d (_ "Show hidden except . and ..") $is_gnu + __fish_gnu_complete $cmds -s F -l classify -d (_ "Append filetype indicator") $is_gnu + __fish_gnu_complete $cmds -s H -l dereference-command-line -d (_ "Follow symlinks") $is_gnu + __fish_gnu_complete $cmds -s L -l dereference -d (_ "Follow symlinks") $is_gnu + __fish_gnu_complete $cmds -s R -l recursive -d (_ "List subdirectory recursively") $is_gnu + __fish_gnu_complete $cmds -s b -l escape -d (_ "Octal escapes for non graphic characters") $is_gnu + __fish_gnu_complete $cmds -s d -l directory -d (_ "List directories, not their content") $is_gnu + __fish_gnu_complete $cmds -s h -l human-readable -d (_ "Human readable sizes") $is_gnu + __fish_gnu_complete $cmds -s i -l inode -d (_ "Print inode number of files") $is_gnu + __fish_gnu_complete $cmds -s n -l numeric-uid-gid -d (_ "Long format, numeric IDs") $is_gnu + __fish_gnu_complete $cmds -s p -l file-type -d (_ "Append filetype indicator") $is_gnu + __fish_gnu_complete $cmds -s q -l hide-control-chars -d (_ "Replace non-graphic characters with '?'") $is_gnu + __fish_gnu_complete $cmds -s r -l reverse -d (_ "Reverse sort order") $is_gnu + __fish_gnu_complete $cmds -s s -l size -d (_ "Print size of files") $is_gnu + + complete $cmds -s C -d (_ "List by columns") + complete $cmds -s S -d (_ "Sort by size") + complete $cmds -s c -d (_ "Show and sort by ctime") + complete $cmds -s f -d (_ "Don't sort") + complete $cmds -s g -d (_ "Long format without owner") + complete $cmds -s k -d (_ "Set blocksize to 1kB") + complete $cmds -s l -d (_ "Long format") + complete $cmds -s m -d (_ "Comma separated format") + complete $cmds -s t -d (_ "Sort by modification time") + complete $cmds -s u -d (_ "Show access time") + complete $cmds -s x -d (_ "List entries by lines") + complete $cmds -s 1 -d (_ "List one file per line") + + if test -n "$is_gnu" + + # GNU specific features + + complete $cmds -l author -d (_ "Print author") + complete $cmds -l blocksize -x -d (_ "Set block size") + complete $cmds -s B -l ignore-backups -d (_ "Ignore files ending with ~") + complete $cmds -l color -f -a "never always auto" -d (_ "Use colors") + complete $cmds -s D -l dired -d (_ "Generate dired output") + complete $cmds -l format -x -a "across commas horizontal long single-column verbose vertical" -d (_ "List format") + complete $cmds -l full-time -d (_ "Long format, full-iso time") + complete $cmds -s G -l no-group -d (_ "Don't print group information") + complete $cmds -l si -d (_ "Human readable sizes, powers of 1000") + complete $cmds -l dereference-command-line-symlink-to-dir #-d (_ "Follow directory symlinks from command line") + complete $cmds -l indicator-style -x -a "none classify file-type" -d (_ "Append filetype indicator") + complete $cmds -s I -l ignore -r -d (_ "Skip entries matching pattern") + complete $cmds -s N -l literal -d (_ "Print raw entry names") + complete $cmds -s o -d (_ "Long format without groups") + complete $cmds -l show-control-chars -d (_ "Non graphic as-is") + complete $cmds -s Q -l quote-name -d (_ "Enclose entry in quotes") + complete $cmds -l quoting-style -x -a "literal locale shell shell-always c escape" -d (_ "Select quoting style") + complete $cmds -l sort -x -d (_ "Sort criteria") -a " + extension\t'Sort by file extension' + none\tDon't\ sort + size\t'Sort by size' + time\t'Sort by modification time' + version\t'Sort by version' + status\t'Sort by file status modification time' + atime\t'Sort by access time' + access\t'Sort by access time' + use\t'Sort by access time' + " + complete $cmds -l time -x -d (_ "Show time type") -a " + time\t'Sort by modification time' + access\t'Sort by access time' + use\t'Sort by use time' + ctime\t'Sort by file status modification time' + status\t'Sort by status time' + " + complete $cmds -l time-style -x -a "full-iso long-iso iso locale" -d (_ "Select time style") + complete $cmds -s T -l tabsize -x -a "1 2 3 4 5 6 7 8 9 10 11 12" -d (_ "Assume tab stops at each COLS") + complete $cmds -s U -d (_ "Do not sort") + complete $cmds -s v -d (_ "Sort by version") + complete $cmds -s w -l width -x -d (_ "Assume screen width") + complete $cmds -s X -d (_ "Sort by extension") + complete $cmds -l help -d (_ "Display help and exit") + complete $cmds -l version -d (_ "Display version and exit") + + else + + # If not a GNU system, assume we have standard BSD ls features instead + + complete $cmds -s B -d (_ "Octal escapes for non graphic characters") + complete $cmds -s G -d (_ "Use colors") + complete $cmds -s I -d (_ "Prevent -A from being automatically set for root") + complete $cmds -s P -d (_ "Don't follow symlinks") + complete $cmds -s T -d (_ "Show modification time") + complete $cmds -s W -d (_ "Show whiteouts when scanning directories") + complete $cmds -s Z -d (_ "Display each file's MAC label") + complete $cmds -s o -d (_ "Include the file flags in a long (-l) output") + complete $cmds -s w -d (_ "Print raw entry names") + + end + +end \ No newline at end of file diff --git a/init/functions/__fish_complete_man.fish b/init/functions/__fish_complete_man.fish new file mode 100644 index 000000000..fa116956e --- /dev/null +++ b/init/functions/__fish_complete_man.fish @@ -0,0 +1,27 @@ + +function __fish_complete_man + if test (commandline -ct) + + # Try to guess what section to search in. If we don't know, we + # use [^)]*, which should match any section + + set section "" + set prev (commandline -poc) + set -e prev[1] + while count $prev + switch $prev[1] + case '-**' + + case '*' + set section $prev[1] + end + set -e prev[1] + end + + set section $section"[^)]*" + + # Do the actual search + apropos (commandline -ct) | grep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1\t\2: /p' + end +end + diff --git a/init/functions/__fish_complete_ssh.fish b/init/functions/__fish_complete_ssh.fish new file mode 100644 index 000000000..d1aa6f82b --- /dev/null +++ b/init/functions/__fish_complete_ssh.fish @@ -0,0 +1,61 @@ + +function __fish_complete_ssh -d "common completions for ssh commands" + + complete -c $argv -s 1 -d (_ "Protocoll version 1 only") + complete -c $argv -s 2 -d (_ "Protocoll version 2 only") + complete -c $argv -s 4 -d (_ "IPv4 addresses only") + complete -c $argv -s 6 -d (_ "IPv6 addresses only") + complete -c $argv -s C -d (_ "Compress all data") + complete -xc $argv -s c -d (_ "Encryption algorithm") -a "blowfish 3des des" + complete -r -c $argv -s F -d (_ "Configuration file") + complete -r -c $argv -s i -d (_ "Identity file") + complete -x -c $argv -s o -d (_ "Options") -a " + AddressFamily + BatchMode + BindAddress + ChallengeResponseAuthentication + CheckHostIP + Cipher + Ciphers + Compression + CompressionLevel + ConnectionAttempts + ConnectTimeout + ControlMaster + ControlPath + GlobalKnownHostsFile + GSSAPIAuthentication + GSSAPIDelegateCredentials + Host + HostbasedAuthentication + HostKeyAlgorithms + HostKeyAlias + HostName + IdentityFile + IdentitiesOnly + LogLevel + MACs + NoHostAuthenticationForLocalhost + NumberOfPasswordPrompts + PasswordAuthentication + Port + PreferredAuthentications + Protocol + ProxyCommand + PubkeyAuthentication + RhostsRSAAuthentication + RSAAuthentication + SendEnv + ServerAliveInterval + ServerAliveCountMax + SmartcardDevice + StrictHostKeyChecking + TCPKeepAlive + UsePrivilegedPort + User + UserKnownHostsFile + VerifyHostKeyDNS + " + complete -c $argv -s v -d (_ "Verbose mode") +end + diff --git a/init/functions/__fish_complete_tex.fish b/init/functions/__fish_complete_tex.fish new file mode 100644 index 000000000..871aa41af --- /dev/null +++ b/init/functions/__fish_complete_tex.fish @@ -0,0 +1,10 @@ + +function __fish_complete_tex -d "Common completions for all tex commands" + + complete -c $argv -o help -d (_ "Display help and exit") + complete -c $argv -o version -d (_ "Display version and exit") + complete -c $argv -x -a "( + __fish_complete_suffix (commandline -ct) .tex '(La)TeX file' + )" + +end diff --git a/init/functions/__fish_print_filesystems.fish b/init/functions/__fish_print_filesystems.fish new file mode 100644 index 000000000..0eeea3c81 --- /dev/null +++ b/init/functions/__fish_print_filesystems.fish @@ -0,0 +1,8 @@ + +function __fish_print_filesystems -d "Print a list of all known filesystem types" + set -l fs adfs affs autofs coda coherent cramfs devpts efs ext ext2 ext3 + set fs $fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs + set fs $fs reiserfs romfs smbfs sysv tmpfs udf ufs umsdos vfat xenix xfs xiafs + printf "%s\n" $fs +end + diff --git a/init/functions/la.fish b/init/functions/la.fish new file mode 100644 index 000000000..e831eaa14 --- /dev/null +++ b/init/functions/la.fish @@ -0,0 +1,7 @@ +# +# These are very common and useful +# +function la -d "List contents, including hidden fiels in directory using long format" + ls -lah $argv +end +