Merge pull request #3123 from moverest/completion

Extend autocompletion support
This commit is contained in:
Fabian Homborg 2016-06-10 18:47:55 +02:00 committed by GitHub
commit 5d20750aaa
16 changed files with 310 additions and 5 deletions

View file

@ -0,0 +1,6 @@
complete -c alsamixer -s h -l help -d "Show help"
complete -x -c alsamixer -s c -l card -d "Soundcard number or id to use"
complete -x -c alsamixer -s D -l device -d "Mixer device to control"
complete -x -c alsamixer -s V -l view -d "Starting view mode" -a "playback capture all"
complete -c alsamixer -s g -l no-color -d "Toggle the using of colors"
complete -x -c alsamixer -s a -l abstraction -d "Mixer abstraction level" -a "none basic"

View file

@ -0,0 +1,25 @@
complete -x -c godoc -l analysis -o analysis -d "Comma-separated list of analyses to perform"
complete -c godoc -l ex -o ex -d "Show examples in command line mode"
complete -r -c godoc -l goroot -o goroot -d "Go root directory"
complete -c godoc -l html -o html -d "Print HTML in command-line mode"
complete -x -c godoc -l http -o http -d "HTTP service address"
complete -c godoc -l httptest.serve -o httptest.serve -d "httptest.NewServer serves on this address and blocks"
complete -c godoc -l index -o index -d "Enable search index"
complete -c godoc -l index_files -o index_files -d "Glob pattern specifying index files"
complete -x -c godoc -l index_interval -o index_interval -d "Interval of indexing"
complete -x -c godoc -l index_throttle -o index_throttle -d "Index throttle value"
complete -c godoc -l links -o links -d "Link identifiers to their declarations"
complete -x -c godoc -l maxresults -o maxresults -d "Maximum number of full text search results shown"
complete -x -c godoc -l notes -o notes -d "Regular expression matching note markers to show"
complete -c godoc -l play -o play -d "Enable playground in web interface"
complete -c godoc -s q -d "Arguments are considered search queries"
complete -c godoc -l server -o server -d "Webserver address for command line searches"
complete -c godoc -l src -o src -d "Print (exported) source in command-line mode"
complete -x -c godoc -l tabwidth -o tabwidth -d "Tab width"
complete -r -c godoc -l templates -o templates -d "Directory containing alternate template files"
complete -c godoc -l timestamps -o timestamps -d "Show timestamps with directory listings"
complete -r -c godoc -l url -o url -d "Print HTML for named URL"
complete -c godoc -s v -d "Verbose mode"
complete -r -c godoc -l write_index -o write_index -d "Write index to a file"
complete -r -c godoc -l zip -o zip -d "Zip file providing the file system to serve"
complete -c godoc -l help -o help -s h -d "Show help"

View file

@ -0,0 +1,8 @@
complete -c gofmt -l cpuprofile -o cpuprofile -d "Write cpu profile to this file"
complete -c gofmt -s d -d "Display diffs instead of rewriting files"
complete -c gofmt -s e -d "Report all errors (not just the first 10 on different lines)"
complete -c gofmt -s l -d "List files whose formatting differs from gofmt's"
complete -c gofmt -s r -d "Rewrite rule (e.g., 'a[b:len(a)] -> a[b:]')"
complete -c gofmt -s s -d "Simplify code"
complete -c gofmt -s w -d "Write result to (source) file instead of stdout"
complete -c gofmt -l help -o help -s h -d "Show help"

View file

@ -0,0 +1,6 @@
complete -c goimports -s d -d "Display diffs instead of rewriting files"
complete -c goimports -s e -d "Report all errors"
complete -c goimports -s l -d "List files whose formatting differs from goimport's"
complete -c goimports -l srcdir -o srcdir -r -d "Choose imports as if source code is from dir"
complete -c goimports -s w -d "Write result to (source) file instead of stdout"
complete -c goimports -l help -o help -s h -d "Show help"

View file

@ -0,0 +1,3 @@
complete -c golint -l min_confidence -o min_confidence -d "Minimum confidence of a problem to print it" -x
complete -c golint -l set_exit_status -o set_exit_status -d "Set exit status to 1 if any issues are found"
complete -c golint -l help -o help -s h -d "Show help"

View file

@ -0,0 +1,10 @@
complete -c gorename -s d -d "Display diffs instead of rewriting files"
complete -c gorename -l diffcmd -o diffcmd -d "Diff command invoked when using -d" -r
complete -c gorename -l force -o force -d "Proceed, even if conflicts were reported"
complete -c gorename -l from -o from -d "Identifier to be renamed" -x
complete -c gorename -l help -o help -d "Show usage message"
complete -c gorename -l offset -o offset -d "File and byte offset of identifier to be renamed" -x
complete -c gorename -l tags -o tags -d "Build tag"
complete -c gorename -l to -o to -d "New name for identifier" -r
complete -c gorename -s v -d "Print verbose information"
complete -c gorename -l help -o help -s h -d "Show help"

View file

@ -0,0 +1,11 @@
set __fish_lscpu_columns CPU\tLogical\ CPU\ number\ of\ a\ CPU\nCORE\tLogical\ core\ number\nSOCKET\tLogical\ socket\ number\nBOOK\tLogical\ book\ number\nNODE\tLogical\ NUMA\ node\ number\nCACHE\tInformation\ about\ how\ caches\ are\ shared\nPOLARIZATION\tCPU\ dispatching\ mode\ on\ virtual\ hardware\nADDRESS\tPhysical\ address\nCONFIGURED\tShows\ if\ the\ hypervisor\ has\ allocated\ the\ CPU\nONLINE\tShows\ if\ Linux\ currently\ use\ the\ CPU\nMAXMHZ\tShows\ the\ maximum\ MHz\nMINMHZ\tShows\ the\ minimum\ MHz
complete -c lscpu -l all -s a -d "Print both online and offline CPUs"
complete -c lscpu -l online -s b -d "Print online CPUs only"
complete -c lscpu -l offline -s c -d "Print offline CPUs only"
complete -c lscpu -l extended -s e -x -a '(__fish_append , $__fish_lscpu_columns)' -d "Print out an extended readable format"
complete -c lscpu -l parse -s p -x -a '(__fish_append , $__fish_lscpu_columns)' -d "Print out a parseble format"
complete -c lscpu -l sysroot -s s -r -d "Use specified directory as system root"
complete -c lscpu -l hex -s x -d "Print hexadecimal masks rather thans lists of CPUs"
complete -c lscpu -l help -s h -d "Display help"
complete -c lscpu -l version -s V -d "Display version"

View file

@ -0,0 +1,19 @@
# Checks if we are using GNU tools
if mkdir --version > /dev/null ^ /dev/null
complete -c mkdir -l version --description 'Output version'
complete -c mkdir -s m -l mode --description 'Set file mode (as in chmod)' -x
complete -c mkdir -s p -l parents --description 'Make parent directories as needed'
complete -c mkdir -s v -l verbose --description 'Print a message for each created directory'
complete -c mkdir -l help --description 'Display help'
else
complete -c mkdir -s m --description 'Set file mode (as in chmod)' -x
complete -c mkdir -s p --description 'Make parent directories as needed'
complete -c mkdir -s v --description 'Print a message for each created directory'
end
# Checks if SELinux is installed
if command -s sestatus > /dev/null ^ /dev/null
complete -c mkdir -l context -s Z --description 'Set SELinux security context of each created directory to the default type'
end

View file

@ -0,0 +1,16 @@
if command -s uname > /dev/null ^/dev/null
if test (uname) = "Linux"
complete -c modinfo -a "(__fish_print_modules)"
complete -c modinfo -l author -s a -d "Print only 'author'"
complete -c modinfo -l description -s d -d "Print only 'description'"
complete -c modinfo -l license -s l -d "Print only 'license'"
complete -c modinfo -l parameters -s p -d "Print only 'parm'"
complete -c modinfo -l filename -s n -d "Print only 'filename'"
complete -c modinfo -l null -s 0 -d "Use \\0 instead of \\n"
complete -c modinfo -l field -s F -x -d "Print only provided FIELD" -a "author description license parm depends alias intree vermagic vermagic"
complete -c modinfo -l set-version -s k -x -d "Use VERSION instead of `uname -r`"
complete -c modinfo -l basedir -s b -r -d "Use DIR as filesystem root for /lib/modules"
complete -c modinfo -l version -s V -d "Show version"
complete -c modinfo -l help -s h -d "Show help"
end
end

View file

@ -1,9 +1,5 @@
#
# Completions for the modprobe command
#
complete -c modprobe -n "__fish_contains_opt -s r remove" --no-files -d Module -a "(lsmod | cut -d' ' -f1)"
complete -c modprobe -n "not __fish_contains_opt -s r remove" --no-files -d Module -a "(find /lib/modules/(uname -r)/{kernel,misc} -type f 2>/dev/null | sed -e 's/\/.*\/\([^\/.]*\).*/\1/')"
complete -c modprobe -n "not __fish_contains_opt -s r remove" --no-files -d Module -a "(__fish_print_modules)"
complete -c modprobe -s v -l verbose --description "Print messages about what the program is doing"
complete -c modprobe -s C -l config --description "Configuration file" -r
complete -c modprobe -s c -l showconfig --description "Dump configuration file"

View file

@ -0,0 +1,68 @@
set -l cmds list current start stop switch-to enable disable enable-all disable-all
# Helper function that prints network profiles managed by netctl-auto.
# If no argument is given, it prints all profiles.
# Othewise, it only prints the ones given as arguments witch are either:
# - active
# - disabled
# - other (meaning enabled but not active)
#
# For example, if you only want the enabled profiles, call it with
# the arguments active and other.
function __fish_print_netctl-auto_profile
set -l show_active false
set -l show_disabled false
set -l show_other false
for arg in $argv
switch $arg
case other
set show_other true
case disabled
set show_disabled true
case active
set show_active true
end
end
if not count $argv >/dev/null
set show_active true
set show_disabled true
set show_other true
end
for line in (netctl-auto list)
set -l profile (string sub -s 3 $line)
if string match -q '\**' -- $line
if test $show_active = true
printf "%s\t%s\n" $profile "Active profile"
end
else if string match -q "!*" -- $line
if test $show_disabled = true
printf "%s\t%s\n" $profile "Disabled profile"
end
else
if test $show_other = true
printf "%s\t%s\n" $profile "Profile"
end
end
end
end
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -l help -d "Show help"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -l version -d "Show version"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a list -f -d "List all available profiles for automatic selection"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a current -d "Report currently active profiles"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a start -f -d "Start automatic profile selection on interface"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a stop -f -d "Stop automatic profile selection on interface"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a switch-to -f -d "Switch to the given network profile"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a enable -f -d "Enable network profile for automatic selection"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a disable -f -d "Disable network profile for automatic selection"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a enable-all -f -d "Enable all profiles for automatic selection"
complete -c netctl-auto -n "not __fish_seen_subcommand_from $cmds" -a disable-all -f -d "Disable all profiles for automatic selection"
complete -c netctl-auto -n "__fish_seen_subcommand_from switch-to" -f -a "(__fish_print_netctl-auto_profile other disabled)" -d "Profile"
complete -c netctl-auto -n "__fish_seen_subcommand_from enable" -f -a "(__fish_print_netctl-auto_profile disabled)" -d "Profile"
complete -c netctl-auto -n "__fish_seen_subcommand_from disable" -f -a "(__fish_print_netctl-auto_profile active other)" -d "Profile"
complete -c netctl-auto -n "__fish_seen_subcommand_from start stop" -f -a "(__fish_print_interfaces)"

View file

@ -0,0 +1,8 @@
complete -c poweroff -l help -d "Show help"
complete -c poweroff -l halt -d "Halt the machine"
complete -c poweroff -l poweroff -s p -d "Switch off the machine"
complete -c poweroff -l reboot -d "Reboot the machine"
complete -c poweroff -l force -s f -d "Force immediate halt/power-off/reboot"
complete -c poweroff -l wtmp-only -s w -d "Just write wtmp record"
complete -c poweroff -l no-wtmp -s d -d "Don't write wtmp record"
complete -c poweroff -l no-wall -d "Don't send wall message"

View file

@ -0,0 +1,12 @@
complete -c termite -s h -l help -d "Display help message"
complete -c termite -s v -l version -d "Display version information"
complete -r -c termite -s e -l exec -d "Tell termite start <cmd> instead of the shell"
complete -x -c termite -s r -l role -d "The role to set the termite window to report itself with"
complete -x -c termite -s t -l title -d "Set the termite window's title"
complete -r -c termite -s d -l directory -d "Tell termite to change to <dir> when launching"
complete -x -c termite -l geometry -d "Override the window geometry in pixels"
complete -c termite -l hold -d "Keep termite open after the child process exits"
complete -x -c termite -l display -d "Launch on <disp> X display"
complete -r -c termite -s c -l config -d "Config file to use"
complete -x -c termite -l name -d "Set the windows name part of WM_CLASS property"
complete -x -c termite -l class -d "Set the windows class part of the WM_CLASS property"

View file

@ -0,0 +1,58 @@
set -l cmds help info dump status monitor mount unmount unlock lock loop-setup loop-delete power-off smart-simulate
set __fish_mount_opts async\tUse\ asynchronous\ I/O atime\tUpdate\ time\ on\ each\ access auto\tMounted\ with\ -a defaults\tUse\ default\ options dev\tInterpret\ character/block\ special\ devices exec\tPermit\ executables _netdev\tFilesystem\ uses\ network noatime\tDo\ not\ update\ time\ on\ each\ access noauto\tNot\ mounted\ by\ -a nodev\tDo\ not\ interpret\ character/block\ special\ devices noexec\tDo\ not\ permit\ executables nosuid\tIgnore\ suid\ bits nouser\tOnly\ root\ may\ mount remount\tRemount\ read-only\ filesystem ro\tMount\ read-only rw\tMount\ read-write suid\tAllow\ suid\ bits sync\tUse\ synchronous\ I/O dirsync\tUse\ synchronous\ directory\ operations user\tAny\ user\ may\ mount users\tAny\ user\ may\ mount\ and\ unmount
function __fish_print_mounted_blockdevice
if test -r /proc/mounts
string match -r "^/[^ ]*" < /proc/mounts
end
end
complete -f -c udisksctl -n "__fish_seen_subcommand_from $cmds" -l help -d "Shows help"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a help -d "Shows help"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a info -d "Shows information about an object"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a dump -d "Shows information about all objects"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a status -d "Shows high-level status"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a monitor -d "Monitor changes to objects"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a mount -d "Mount a filesystem"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a unmount -d "Unmount a filesystem"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a unlock -d "Unlock an encrypted device"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a lock -d "Lock an encrypted device"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a loop-setup -d "Set-up a loop device"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a loop-delete -d "Delete a loop device"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a power-off -d "Safely power off a drive"
complete -f -c udisksctl -n "not __fish_seen_subcommand_from $cmds" -a smart-simulate -d "Set SMART data for a drive"
complete -f -c udisksctl -n "__fish_seen_subcommand_from info" -s p -l object-path -d "Object to get information about"
complete -c udisksctl -n "__fish_seen_subcommand_from info" -s b -l block-device -d "Block device to get information about" -a "(__fish_complete_blockdevice)"
complete -f -c udisksctl -n "__fish_seen_subcommand_from info" -s d -l drive -d "Drive to get information about"
complete -x -c udisksctl -n "__fish_seen_subcommand_from mount" -s t -l filesystem-type -d "Filesystem type to use" -a "(__fish_print_filesystems)"
complete -x -c udisksctl -n "__fish_seen_subcommand_from mount" -s o -l options -d "Mount options" -a '(__fish_append , $__fish_mount_opts)'
complete -c udisksctl -n "__fish_seen_subcommand_from unmount" -s f -l force -d "Force/layzy unmount"
complete -c udisksctl -n "__fish_seen_subcommand_from unmount" -a "(__fish_print_mounted)" -f -d "Mount point"
complete -c udisksctl -n "__fish_seen_subcommand_from unmount" -s b -l block-device -a "(__fish_print_mounted_blockdevice)" -x -d "Mounted block device"
complete -c udisksctl -n "__fish_seen_subcommand_from loop-setup" -s f -l file -d "File to set-up a loop device for"
complete -c udisksctl -n "__fish_seen_subcommand_from loop-setup" -s r -l read-only -d "Setup read-only device"
complete -c udisksctl -n "__fish_seen_subcommand_from loop-setup" -s o -l offset -x -d "Start at <num> bytes into file"
complete -c udisksctl -n "__fish_seen_subcommand_from loop-setup" -s s -l size -x -d "Limit size to <num> bytes"
complete -c udisksctl -n "__fish_seen_subcommand_from loop-delete" -s p -l object-path -d "Object for loop device to delete"
complete -c udisksctl -n "__fish_seen_subcommand_from loop-delete" -s b -l block-device -d "Loop device to delete"
complete -c udisksctl -n "__fish_seen_subcommand_from smart-simulate" -s f -l file -d "File with libatasmart blob"
complete -c udisksctl -n "__fish_seen_subcommand_from mount unmount lock unlock loop-setup loop-delete power-off smart-simulate" -l no-user-interaction -d "Do not authenticate the user if needed"
for cmd in mount lock unlock
complete -r -c udisksctl -n "__fish_seen_subcommand_from $cmd" -s p -l object-path -d "Object to $cmd"
complete -r -c udisksctl -n "__fish_seen_subcommand_from $cmd" -s b -l block-device -d "Block device to $cmd" -a "(__fish_complete_blockdevice)"
end
for cmd in power-off smart-simulate
complete -r -c udisksctl -n "__fish_seen_subcommand_from $cmd" -s p -l object-path -d "Object path for ATA device"
complete -r -c udisksctl -n "__fish_seen_subcommand_from $cmd" -s b -l block-device -d "Block device for ATA device" -a "(__fish_complete_blockdevice)"
end

55
share/completions/xz.fish Normal file
View file

@ -0,0 +1,55 @@
complete -c xz -s z -l compress --description 'Compress'
complete -c xz -s d -l decompress -l uncompress --description 'Decompress' -a "
(
__fish_complete_suffix .xz
__fish_complete_suffix .txz
__fish_complete_suffix .lzma
__fish_complete_suffix .tlz
)
"
complete -c xz -s t -l test --description 'Test the integrity of compressed files'
complete -c xz -s l -l list --description 'Print information about compressed files'
complete -c xz -s k -l keep --description 'Don\'t delete the input files'
complete -c xz -s f -l force
complete -c xz -s c -l stdout -l to-stdout --description 'Write to stdout instead of file'
complete -c xz -l single-stream --description 'Decompress only the first .xz stream'
complete -c xz -l no-sparse --description 'Disable creation of sparse files'
complete -c xz -s S -l suffix --description 'Use SUFFIX as the suffix for target file'
complete -c xz -l files --description 'Read the filenames to process from file' -r
complete -c xz -l files0 --description 'Identical to --files but filenames terminate with \\0' -r
complete -c xz -s F -l format -x --description 'Specify file format to compress/decompress' -a "auto xz lzma alone raw"
complete -c xz -s C -l check -x --description 'Specify type of integrity check' -a "none crc32 crc64 sha256"
complete -c xz -l ignore-check --description 'Don\'t verify the integrity check'
for level in (seq 1 9)
complete -c xz -s $level --description "Select compression level"
end
complete -c xz -s e -l extreme --description 'Use slower variant'
complete -c xz -l fast --description 'Alias of -0'
complete -c xz -l best --description 'Alias of -9'
complete -c xz -l block-size --description 'Set block size' -x
complete -c xz -l block-list --description 'Set block sizes list' -x
complete -c xz -l flush-timeout --description 'Force flush if encoder did not fush after TIMEOUT ms' -x
complete -c xz -l memlimit-compress --description 'Set memory usage limit for compression' -x
complete -c xz -l memlimit-decompress --description 'Set memory usage limit for decompression' -x
complete -c xz -s M -l memlimit -l memory --description 'Set a memory usage for compression/decompression'
complete -c xz -l no-adjust --description 'Display error and exit if exceed memory usage limit'
complete -c xz -s T -l threads --description 'Specify the number of worker threads to use' -x
complete -c xz -l lsam1 --description 'Add LZMA1 filter to filter chain' -f
complete -c xz -l lzma2 --description 'Add LZMA2 filter to filter chain' -f
for op in x86 powerpc ia64 arm armthumb sparc
complete -c xz -l $op --description 'Add a branch/call/jump filter to filter chain' -f
end
complete -c xz -l delta --description 'Add Delta filter to filter chain'
complete -c xz -s q -l quiet --description 'Suppress warnings/notices'
complete -c xz -s v -l verbose --description 'Be verbose'
complete -c xz -s Q -l no-warn --description 'Don\'t set the exit status to 2'
complete -c xz -l robot --description 'Print messages in a machine-parsable format'
complete -c xz -l info-memory --description 'Display memory informations (physical, usage limits)'
complete -c xz -s h -l help --description 'Display help'
complete -c xz -s H -l long-help --description 'Display long help'
complete -c xz -s V -l version --description 'Display version'

View file

@ -0,0 +1,4 @@
# Helper function for completions that need to enumerate Linux modules
function __fish_print_modules
find /lib/modules/(uname -r)/{kernel,misc} -type f ^ /dev/null | sed -e 's$/.*/\([^/.]*\).*$\1$'
end