mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 13:57:17 +08:00
completions: remove functions that are never used
None of these __functions defined in completions are used or referenced anywhere. Found with: function unused -a file search -d 'find unused functions' set -f (string replace -fr '^[\s]*function ([\w_]+).*' '$1' < $file) for cmd in $cmds printf %d\ %s\n (grep -r ".*$cmd.*" $search < $argv | count) $cmd end | string match '1 *' end for file in share/*/*.fish unused $file share && printf "in %s\n" $file end
This commit is contained in:
parent
f5711ad5ed
commit
b8dee05ad0
|
@ -56,23 +56,6 @@ function __s3_cmd_in
|
|||
return 1
|
||||
end
|
||||
|
||||
# Determines whether the first non-switch argument to `aws` was in $argv
|
||||
function __aws_cmd_in
|
||||
set -l tokens (commandline -co)
|
||||
for token in $tokens[2..-1]
|
||||
if string match -qr "^--" -- $token
|
||||
# Ignore switches everywhere
|
||||
continue
|
||||
else if contains $token $argv
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
return 1
|
||||
end
|
||||
|
||||
# S3 completions
|
||||
complete -c aws -n "__fish_prev_arg_in s3" -xa "cp mv rm help sync ls mb mv presign rb website"
|
||||
|
||||
|
|
|
@ -131,26 +131,6 @@ complete -c darcs -n __fish_darcs_use_optimize_command -x -a upgrade -d 'Upgrade
|
|||
complete -c darcs -n __fish_darcs_use_optimize_command -x -a cache -d 'Garbage collect global cache'
|
||||
|
||||
|
||||
function __fish_darcs_use_convert_command
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
|
||||
if contains convert $cmd
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case darcs-2
|
||||
return 1
|
||||
case export
|
||||
return 1
|
||||
case import
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
complete -c darcs -l help -d 'Show a brief description of the command and its options'
|
||||
complete -c darcs -l list-options -d 'Show plain list of available options and commands, for auto-completion'
|
||||
complete -c darcs -l run-posthook -d 'Run posthook command without prompting [DEFAULT]'
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# TODO unused
|
||||
function __fish_equery_print_format
|
||||
printf "%s\t%s\n" \
|
||||
'$cp' "Category and package name (e.g 'app-portage/gentoolkit')" \
|
||||
'$cpv' "Category, package name and version (e.g. 'app-portage/gentoolkit-0.3.0_rc10-r1')" \
|
||||
'$category' "Category (e.g. 'app-portage')" \
|
||||
'$name' "Package name (e.g. 'gentoolkit')" \
|
||||
'$version' "Version (without the revision) (e.g. '0.3.0_rc10')" \
|
||||
'$revision' "Revision (e.g. 'r1')" \
|
||||
'$fullversion' "Version including revision (e.g. '0.3.0_rc10-r1')" \
|
||||
'$slot' Slot \
|
||||
'$repo' "Repository (e.g. 'gentoo')" \
|
||||
'$mask' "Mask-status field (~M-??)" \
|
||||
'$mask2' "Verbose description of the masking status" \
|
||||
'$location' "Location field (IPO-)"
|
||||
end
|
||||
# function __fish_equery_print_format
|
||||
# printf "%s\t%s\n" \
|
||||
# '$cp' "Category and package name (e.g 'app-portage/gentoolkit')" \
|
||||
# '$cpv' "Category, package name and version (e.g. 'app-portage/gentoolkit-0.3.0_rc10-r1')" \
|
||||
# '$category' "Category (e.g. 'app-portage')" \
|
||||
# '$name' "Package name (e.g. 'gentoolkit')" \
|
||||
# '$version' "Version (without the revision) (e.g. '0.3.0_rc10')" \
|
||||
# '$revision' "Revision (e.g. 'r1')" \
|
||||
# '$fullversion' "Version including revision (e.g. '0.3.0_rc10-r1')" \
|
||||
# '$slot' Slot \
|
||||
# '$repo' "Repository (e.g. 'gentoo')" \
|
||||
# '$mask' "Mask-status field (~M-??)" \
|
||||
# '$mask2' "Verbose description of the masking status" \
|
||||
# '$location' "Location field (IPO-)"
|
||||
# end
|
||||
|
||||
## Global Opts
|
||||
complete -c equery -s h -l help -d "Displays a help message"
|
||||
|
|
|
@ -10,16 +10,6 @@ function __fish_kitchen_using_command
|
|||
set -q cmd[2]; and test "$argv[1]" = $cmd[2]
|
||||
end
|
||||
|
||||
function __fish_kitchen_using_command_and_no_subcommand
|
||||
set -l cmd (commandline -opc)
|
||||
test (count $cmd) -eq 2; and test "$argv[1]" = "$cmd[2]"
|
||||
end
|
||||
|
||||
function __fish_kitchen_using_subcommand --argument-names cmd_main cmd_sub
|
||||
set -l cmd (commandline -opc)
|
||||
set -q cmd[3]; and test "$cmd_main" = $cmd[2] -a "$cmd_sub" = $cmd[3]
|
||||
end
|
||||
|
||||
function __fish_kitchen_list
|
||||
command kitchen list --bare
|
||||
end
|
||||
|
|
|
@ -24,11 +24,6 @@ function __fish_print_magento_modules -d "Lists all Magento modules"
|
|||
end
|
||||
end
|
||||
|
||||
function __fish_magento_print_indexer_modes -d "Lists all indexer modes"
|
||||
echo realtime\t"Index in realtime"
|
||||
echo schedule\t"Index via cron jobs"
|
||||
end
|
||||
|
||||
function __fish_print_magento_i18n_packing_modes -d "Shows all available packing modes"
|
||||
echo replace\t"replace language pack by new one"
|
||||
echo merge\t"merge language packages"
|
||||
|
|
|
@ -20,15 +20,6 @@ function __fish_snap_using_subcommand -d 'Test if given subcommand is used'
|
|||
return 1
|
||||
end
|
||||
|
||||
function __fish_snap_use_package -d 'Test if snap command should have packages as potential completion'
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i alias buy disable download enable info install refresh remove revert run try
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_snap_use_file -d 'Test if snap command should have files as potential completion'
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i ack try
|
||||
|
|
|
@ -6,16 +6,6 @@ function __fish_travis_needs_command
|
|||
return 1
|
||||
end
|
||||
|
||||
function __fish_travis_using_command
|
||||
set -l cmd (commandline -opc)
|
||||
if test (count $cmd) -gt 1
|
||||
if test $argv[1] = $cmd[2]
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
# Commands
|
||||
complete -c travis -f -n __fish_travis_needs_command -a accounts -d "Displays accounts and their subscription status"
|
||||
complete -c travis -f -n __fish_travis_needs_command -a branches -d "Displays the most recent build for each branch"
|
||||
|
|
|
@ -38,22 +38,6 @@ function __fish_vagrant_machines
|
|||
end
|
||||
end
|
||||
|
||||
function __fish_vagrant_running_machines
|
||||
# List running machines
|
||||
# The annoying thing here is that
|
||||
# we could get IDs via `vagrant global-status`,
|
||||
# but that doesn't have proper output and takes 0.5s.
|
||||
#
|
||||
# It seems like the data is available in $VAGRANT_HOME/data/machine-index/index, but it's in json, and that's unparseable with regex, and we can't expect jq to be installed.
|
||||
if set -l state (__fish_print_vagrant_state)
|
||||
# TODO: stub
|
||||
if test -f "$state"
|
||||
string replace -f '"active":' '' <$state | string split ,
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_vagrant_boxes
|
||||
set -l vhome $VAGRANT_HOME/boxes
|
||||
set -q vhome[1]; or set vhome ~/.vagrant.d/boxes
|
||||
|
@ -99,11 +83,6 @@ function __fish_vagrant_box_need_command
|
|||
return 0
|
||||
end
|
||||
|
||||
function __fish_vagrant_box_using_command
|
||||
not set -l cmd (__fish_vagrant_box_need_command)
|
||||
and contains -- $cmd[1] $argv
|
||||
end
|
||||
|
||||
function __fish_vagrant_cloud_need_command
|
||||
set -l cmd (__fish_vagrant_need_command)
|
||||
test "$cmd[1]" = cloud 2>/dev/null
|
||||
|
@ -121,11 +100,6 @@ function __fish_vagrant_cloud_need_command
|
|||
return 0
|
||||
end
|
||||
|
||||
function __fish_vagrant_cloud_using_command
|
||||
not set -l cmd (__fish_vagrant_cloud_need_command)
|
||||
and contains -- $cmd[1] $argv
|
||||
end
|
||||
|
||||
complete -c vagrant -n __fish_vagrant_need_command -fa box -d 'Manage boxes: installation, removal, etc.'
|
||||
complete -c vagrant -n "__fish_vagrant_using_command box; and __fish_vagrant_box_need_command" -fa "$box_commands"
|
||||
complete -c vagrant -n __fish_vagrant_need_command -fa cloud -d 'Manage Vagrant Cloud'
|
||||
|
|
Loading…
Reference in New Issue
Block a user