diff options
author | 2006-02-15 12:22:28 +1000 | |
---|---|---|
committer | 2006-02-15 12:22:28 +1000 | |
commit | c94b9e504d0db7ebd2a2b87fce997ca3c9851b8b (patch) | |
tree | dff930e4639b7141b7c0e334f096c07fb3e9b0d8 /init/functions | |
parent | 8be3bf3e5db8519ac69c3372342c97418c82e5ff (diff) |
Remove the rather stupid -y option for complete, which loads another commands completions. Mostly the same results can be had with fewer bugs and corner cases vy using the new dynamically loaded functions.
darcs-hash:20060215022228-ac50b-85614ed684f73460d43543a579ff2c7e7914efeb.gz
Diffstat (limited to 'init/functions')
-rw-r--r-- | init/functions/__fish_complete_bittorrent.fish | 33 | ||||
-rw-r--r-- | init/functions/__fish_complete_ls.fish | 109 | ||||
-rw-r--r-- | init/functions/__fish_complete_man.fish | 27 | ||||
-rw-r--r-- | init/functions/__fish_complete_ssh.fish | 61 | ||||
-rw-r--r-- | init/functions/__fish_complete_tex.fish | 10 | ||||
-rw-r--r-- | init/functions/__fish_print_filesystems.fish | 8 | ||||
-rw-r--r-- | init/functions/la.fish | 7 |
7 files changed, 255 insertions, 0 deletions
diff --git a/init/functions/__fish_complete_bittorrent.fish b/init/functions/__fish_complete_bittorrent.fish new file mode 100644 index 00000000..1f1a21ad --- /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 00000000..0aac5ea4 --- /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 00000000..fa116956 --- /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 00000000..d1aa6f82 --- /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 00000000..871aa41a --- /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 00000000..0eeea3c8 --- /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 00000000..e831eaa1 --- /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 + |