Run fish_indent over new Windows completions

This commit is contained in:
ridiculousfish 2022-01-26 22:02:23 -08:00
parent cdae6536fd
commit b8fd6b5f31
11 changed files with 233 additions and 233 deletions

View file

@ -1,20 +1,20 @@
function __attrib_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc)
set -l current_token (commandline -tc)
switch $current_token
case '+*'
echo -e 'r\tSet the Read-only file attribute
switch $current_token
case '+*'
echo -e 'r\tSet the Read-only file attribute
a\tSet the Archive file attribute
s\tSet the System file attribute
h\tSet the Hidden file attribute
i\tSet the Not Content Indexed file attribute' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
case '-*'
echo -e 'r\tClear the Read-only file attribute
case '-*'
echo -e 'r\tClear the Read-only file attribute
a\tClear the Archive file attribute
s\tClear the System file attribute
h\tClear the Hidden file attribute
i\tClear the Not Content Indexed file attribute' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
end
end
end
complete -c attrib -f -a '(__attrib_complete_args)'

View file

@ -1,37 +1,37 @@
function __attributes_disk_complete_args
if not __fish_seen_subcommand_from set clear
echo -e 'set\tSet the specified attribute of the disk with focus
if not __fish_seen_subcommand_from set clear
echo -e 'set\tSet the specified attribute of the disk with focus
clear\tClear the specified attribute of the disk with focus'
return
end
return
end
echo -e 'readonly\tSpecify that the disk is read-only
echo -e 'readonly\tSpecify that the disk is read-only
noerr\tWhen an error is encountered, DiskPart continues to process commands'
end
function __attributes_volume_complete_args
if not __fish_seen_subcommand_from set clear
echo -e 'set\tSet the specified attribute of the volume with focus
if not __fish_seen_subcommand_from set clear
echo -e 'set\tSet the specified attribute of the volume with focus
clear\tClear the specified attribute of the volume with focus'
return
end
return
end
if not __fish_seen_subcommand_from readonly hidden nodefaultdriveletter shadowcopy
echo -e 'readonly\tSpecify that the volume is read-only
if not __fish_seen_subcommand_from readonly hidden nodefaultdriveletter shadowcopy
echo -e 'readonly\tSpecify that the volume is read-only
hidden\tSpecify that the volume is hidden
nodefaultdriveletter\tSpecify that the volume does not receive a drive letter by default
shadowcopy\tSpecify that the volume is a shadow copy volume'
end
end
echo -e 'noerr\tWhen an error is encountered, DiskPart continues to process commands'
echo -e 'noerr\tWhen an error is encountered, DiskPart continues to process commands'
end
function __attributes_complete_args -d 'Function to generate args'
if __fish_seen_subcommand_from disk
__attributes_disk_complete_args
else if __fish_seen_subcommand_from volume
__attributes_volume_complete_args
end
if __fish_seen_subcommand_from disk
__attributes_disk_complete_args
else if __fish_seen_subcommand_from volume
__attributes_volume_complete_args
end
end
complete -c attributes -f -a '(__attributes_complete_args)'

View file

@ -1,10 +1,10 @@
function __cleanmgr_complete_args -d 'Function to generate args'
set -l previous_token (commandline -oc)[-1]
set -l previous_token (commandline -oc)[-1]
if test "$previous_token" = '/d'
__fish_print_windows_drives
return
end
if test "$previous_token" = /d
__fish_print_windows_drives
return
end
end
complete -c cleanmgr -f -a '(__cleanmgr_complete_args)'

View file

@ -1,16 +1,16 @@
function __cmdkey_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc)
set -l previous_token (commandline -oc)[-1]
set -l current_token (commandline -tc)
set -l previous_token (commandline -oc)[-1]
switch $current_token
case '/user:*'
__fish_print_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }"
case '*'
if test "$previous_token" = '/delete'
echo -e '/ras\tDelete remote access entry'
return
end
end
switch $current_token
case '/user:*'
__fish_print_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }"
case '*'
if test "$previous_token" = /delete
echo -e '/ras\tDelete remote access entry'
return
end
end
end
complete -c cmdkey -f -a '(__cmdkey_complete_args)'

View file

@ -1,32 +1,32 @@
complete --command powershell --short-option '?' --old-option Help --description 'Show help'
complete --command powershell --old-option PSConsoleFile --require-parameter \
--description 'Load the specified PowerShell console file'
--description 'Load the specified PowerShell console file'
complete --command powershell --old-option Version --require-parameter --arguments '2.0 3.0' \
--description 'Start the specified version of PowerShell'
--description 'Start the specified version of PowerShell'
complete --command powershell --old-option NoLogo --description 'Hides the copyright banner at startup'
complete --command powershell --old-option NoExit \
--description 'Do not exit after running startup commands'
--description 'Do not exit after running startup commands'
complete --command powershell --old-option Sta \
--description 'Start PowerShell using a single-threaded apartment'
--description 'Start PowerShell using a single-threaded apartment'
complete --command powershell --old-option Mta \
--description 'Start PowerShell using a multi-threaded apartment'
--description 'Start PowerShell using a multi-threaded apartment'
complete --command powershell --old-option NoProfile --description 'Does not load the PowerShell profile'
complete --command powershell --old-option NonInteractive \
--description 'Do not present an interactive prompt to the user'
--description 'Do not present an interactive prompt to the user'
complete --command powershell --old-option InputFormat --no-files --require-parameter \
--arguments 'Text XML' --description 'Describe the format of data sent to PowerShell'
--arguments 'Text XML' --description 'Describe the format of data sent to PowerShell'
complete --command powershell --old-option OutputFormat --no-files --require-parameter \
--arguments 'Text XML' --description 'Determine how output is formatted'
--arguments 'Text XML' --description 'Determine how output is formatted'
complete --command powershell --old-option WindowStyle --no-files --require-parameter \
--arguments 'Normal Minimized Maximized Hidden' --description 'Set the window style for the session'
--arguments 'Normal Minimized Maximized Hidden' --description 'Set the window style for the session'
complete --command powershell --old-option EncodedCommand --require-parameter \
--description 'Accept a base-64-encoded string version of a command'
complete --command powershell --old-option ConfigurationName --no-files --require-parameter \
--description 'Specify a configuration endpoint in which PowerShell is run'
--description 'Accept a base-64-encoded string version of a command'
complete --command powershell --old-option ConfigurationName --no-files --require-parameter \
--description 'Specify a configuration endpoint in which PowerShell is run'
complete --command powershell --old-option File --require-parameter
complete --command powershell --old-option ExecutionPolicy --no-files --require-parameter \
--arguments 'AllSigned Bypass Default RemoteSigned Restricted Undefined Unrestricted' \
--description 'Sets the default execution policy for the current session'
complete --command powershell --old-option Command --no-files --require-parameter \
--description 'Execute the specified commands at the PowerShell command prompt'
complete --command powershell --old-option ExecutionPolicy --no-files --require-parameter \
--arguments 'AllSigned Bypass Default RemoteSigned Restricted Undefined Unrestricted' \
--description 'Sets the default execution policy for the current session'
complete --command powershell --old-option Command --no-files --require-parameter \
--description 'Execute the specified commands at the PowerShell command prompt'

View file

@ -1,6 +1,6 @@
function __reg_add_complete_args -a previous_token
if test "$previous_token" = '/t'
echo 'REG_SZ
if test "$previous_token" = /t
echo 'REG_SZ
REG_MULTI_SZ
REG_DWORD_BIG_ENDIAN
REG_DWORD
@ -9,15 +9,15 @@ REG_DWORD_LITTLE_ENDIAN
REG_LINK
REG_FULL_RESOURCE_DESCRIPTOR
REG_EXPAND_SZ'
return
end
return
end
if not __fish_seen_argument -w 'v' -w 've'
echo -e '/v\tSpecify the name of the add registry entry
if not __fish_seen_argument -w v -w ve
echo -e '/v\tSpecify the name of the add registry entry
/ve\tSpecify that the added registry entry has a null value'
end
end
echo -e '/t\tSpecify the type for the registry entry
echo -e '/t\tSpecify the type for the registry entry
/s\tSpecify the character to be used
/d\tSpecify the data for the new registry entry
/f\tAdd the registry entry without prompting for confirmation
@ -25,66 +25,66 @@ REG_EXPAND_SZ'
end
function __reg_compare_complete_args
if not __fish_seen_argument -w 'v' -w 've'
echo -e '/v\tSpecify the value name
if not __fish_seen_argument -w v -w ve
echo -e '/v\tSpecify the value name
/ve\tSpecify that only entries that have a value name of null should be compared'
end
end
if not __fish_seen_argument -w 'oa' -w 'od' -w 'os' -w 'on'
echo -e '/oa\tSpecify that all differences and matches are displayed
if not __fish_seen_argument -w oa -w od -w os -w on
echo -e '/oa\tSpecify that all differences and matches are displayed
/od\tSpecify that only differences are displayed
/os\tSpecify that only matches are displayed
/on\tSpecify that nothing is displayed'
end
end
echo -e '/s\tCompare all subkeys and entries recursively
echo -e '/s\tCompare all subkeys and entries recursively
/?\tShow help'
end
function __reg_copy_complete_args
echo -e '/s\tCopy all subkeys and entries under the specified subkey
echo -e '/s\tCopy all subkeys and entries under the specified subkey
/f\tCopy the subkey without prompting for confirmation
/?\tShow help'
end
function __reg_delete_complete_args
if not __fish_seen_argument -w 'v' -w 've' -w 'va'
echo -e '/v\tDelete a specific entry under the subkey
if not __fish_seen_argument -w v -w ve -w va
echo -e '/v\tDelete a specific entry under the subkey
/ve\tSpecify that only entries that have no value will be deleted
/va\tDelete all entries under the specified subkey'
end
end
echo -e '/f\tDelete the existing registry subkey or entry without asking for confirmation
echo -e '/f\tDelete the existing registry subkey or entry without asking for confirmation
/?\tShow help'
end
function __reg_export_complete_args
echo -e '/y\tOverwrite any existing file with the name filename without prompting for confirmation
echo -e '/y\tOverwrite any existing file with the name filename without prompting for confirmation
/?\tShow help'
end
function __reg_query_complete_args -a previous_token
if test "$previous_token" = '/t'
echo 'REG_SZ
if test "$previous_token" = /t
echo 'REG_SZ
REG_MULTI_SZ
REG_EXPAND_SZ
REG_DWORD
REG_BINARY
REG_NONE'
return
end
return
end
if not __fish_seen_argument -w 'v' -w 've'
echo -e '/v\tSpecify the registry value name
if not __fish_seen_argument -w v -w ve
echo -e '/v\tSpecify the registry value name
/ve\tRun a query for value names that are empty'
end
end
if not __fish_seen_argument -w 'k' -w 'd'
echo -e '/k\tSpecify to search in key names only
if not __fish_seen_argument -w k -w d
echo -e '/k\tSpecify to search in key names only
/d\tSpecify to search in data only'
end
end
echo -e '/se\tSpecify the single value separator
echo -e '/se\tSpecify the single value separator
/f\tSpecify the data or pattern to search for
/c\tSpecify that the query is case sensitive
/e\tSpecify to return only exact matches
@ -94,28 +94,28 @@ REG_NONE'
end
function __reg_save_complete_args
echo -e '/y\tOverwrite an existing file with the name filename without prompting for confirmation
echo -e '/y\tOverwrite an existing file with the name filename without prompting for confirmation
/?\tShow help'
end
function __reg_complete_args -d 'Function to generate args'
set -l previous_token (commandline -oc)[-1]
set -l previous_token (commandline -oc)[-1]
if __fish_seen_subcommand_from add
__reg_add_complete_args $previous_token
else if __fish_seen_subcommand_from compare
__reg_compare_complete_args
else if __fish_seen_subcommand_from copy
__reg_copy_complete_args
else if __fish_seen_subcommand_from delete
__reg_delete_complete_args
else if __fish_seen_subcommand_from export
__reg_export_complete_args
else if __fish_seen_subcommand_from query
__reg_query_complete_args $previous_token
else if __fish_seen_subcommand_from save
__reg_save_complete_args
end
if __fish_seen_subcommand_from add
__reg_add_complete_args $previous_token
else if __fish_seen_subcommand_from compare
__reg_compare_complete_args
else if __fish_seen_subcommand_from copy
__reg_copy_complete_args
else if __fish_seen_subcommand_from delete
__reg_delete_complete_args
else if __fish_seen_subcommand_from export
__reg_export_complete_args
else if __fish_seen_subcommand_from query
__reg_query_complete_args $previous_token
else if __fish_seen_subcommand_from save
__reg_save_complete_args
end
end
complete -c reg -f -a '(__reg_complete_args)'

View file

@ -1,37 +1,37 @@
function __schtasks_print_tasks -d 'Helper function to print tasks'
schtasks /query /fo csv /nh | awk -F ',' '{ print $1 }'
schtasks /query /fo csv /nh | awk -F ',' '{ print $1 }'
end
function __schtasks_change_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_print_tasks
return
end
if test "$previous_token" = /tn
__schtasks_print_tasks
return
end
if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users
return
end
if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users
return
end
if __fish_seen_argument -w 's'
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if not __fish_seen_argument -w 'et' -w 'du'
echo -e '/et\tSpecify the end time for the task
if not __fish_seen_argument -w et -w du
echo -e '/et\tSpecify the end time for the task
/du\tA value that specifies the duration'
end
end
if not __fish_seen_argument -w 'ENABLE' -w 'DISABLE'
echo -e '/ENABLE\tSpecify to enable the scheduled task
if not __fish_seen_argument -w ENABLE -w DISABLE
echo -e '/ENABLE\tSpecify to enable the scheduled task
/DISABLE\tSpecify to disable the scheduled task'
end
end
echo -e '/tn\tIdentify the task to be changed
echo -e '/tn\tIdentify the task to be changed
/s\tSpecify the name or IP address of a remote computer
/ru\tChange the user name under which the scheduled task has to run
/rp\tSpecify a new password for the existing user account, or the user account specified by /ru
@ -47,8 +47,8 @@ function __schtasks_change_complete_args -a previous_token
end
function __schtasks_create_complete_args -a previous_token
if test "$previous_token" = '/sc'
echo -e 'MINUTE\tSpecify the number of minutes before the task should run
if test "$previous_token" = /sc
echo -e 'MINUTE\tSpecify the number of minutes before the task should run
HOURLY\tSpecify the number of hours before the task should run
DAILY\tSpecify the number of days before the task should run
WEEKLY\tSpecify the number of weeks before the task should run
@ -57,16 +57,16 @@ ONCE\tSpecify that that task runs once at a specified date and time
ONSTART\tSpecify that the task runs every time the system starts
ONLOGON\tSpecify that the task runs whenever a user logs on
ONIDLE\tSpecify that the task runs whenever the system is idle for a specified period of time'
return
end
return
end
if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users
return
end
if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users
return
end
if test "$previous_token" = '/mo'
echo -e 'MINUTE\tSpecify that the task runs every n minutes
if test "$previous_token" = /mo
echo -e 'MINUTE\tSpecify that the task runs every n minutes
HOURLY\tSpecify that the task runs every n hours
DAILY\tSpecify that the task runs every n days
WEEKLY\tSpecify that the task runs every n weeks
@ -75,23 +75,23 @@ ONCE\tSpecify that the task runs once
ONSTART\tSpecify that the task runs at startup
ONLOGON\tSpecify that the task runs when the user specified by the /u parameter logs on
ONIDLE\tSpecify that the task runs after the system is idle for the number of minutes specified by /i'
return
end
return
end
if __fish_seen_argument -w 's'
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if not __fish_seen_argument -w 'et' -w 'du'
echo -e '/et\tSpecify the time of day that a minute or hourly task schedule ends
if not __fish_seen_argument -w et -w du
echo -e '/et\tSpecify the time of day that a minute or hourly task schedule ends
/du\tSpecify a maximum length of time for a minute or hourly schedule'
end
end
echo -e '/sc\tSpecify the schedule type
echo -e '/sc\tSpecify the schedule type
/tn\tSpecify a name for the task
/tr\tSpecify the program or command that the task runs
/s\tSpecify the name or IP address of a remote computer
@ -113,76 +113,76 @@ ONIDLE\tSpecify that the task runs after the system is idle for the number of mi
end
function __schtasks_delete_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_print_tasks
return
end
if test "$previous_token" = /tn
__schtasks_print_tasks
return
end
if test "$previous_token" = '/u'
__fish_print_windows_users
return
end
if test "$previous_token" = /u
__fish_print_windows_users
return
end
if __fish_seen_argument -w 's'
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
echo -e '/tn\tIdentify the task to be deleted
echo -e '/tn\tIdentify the task to be deleted
/f\tSuppress the confirmation message
/s\tSpecify the name or IP address of a remote computer
/?\tShow help'
end
function __schtasks_end_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_print_tasks
return
end
if test "$previous_token" = /tn
__schtasks_print_tasks
return
end
if test "$previous_token" = '/u'
__fish_print_windows_users
return
end
if test "$previous_token" = /u
__fish_print_windows_users
return
end
if __fish_seen_argument -w 's'
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
echo -e '/tn\tIdentify the task that started the program
echo -e '/tn\tIdentify the task that started the program
/s\tSpecify the name or IP address of a remote computer
/?\tShow help'
end
function __schtasks_query_complete_args -a previous_token
if test "$previous_token" = '/fo'
echo -e 'TABLE
if test "$previous_token" = /fo
echo -e 'TABLE
LIST
CSV'
return
end
return
end
if test "$previous_token" = '/u'
__fish_print_windows_users
return
end
if test "$previous_token" = /u
__fish_print_windows_users
return
end
if __fish_seen_argument -w 's'
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
echo -e '/fo\tSpecify the output format
echo -e '/fo\tSpecify the output format
/nh\tRemove column headings
/v\tAdd the advanced properties of the task
/s\tSpecify the name or IP address of a remote computer
@ -190,45 +190,45 @@ CSV'
end
function __schtasks_run_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_print_tasks
return
end
if test "$previous_token" = /tn
__schtasks_print_tasks
return
end
if test "$previous_token" = '/u'
__fish_print_windows_users
return
end
if test "$previous_token" = /u
__fish_print_windows_users
return
end
if __fish_seen_argument -w 's'
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account'
end
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
echo -e '/tn\tIdentify the task to start
echo -e '/tn\tIdentify the task to start
/s\tSpecify the name or IP address of a remote computer
/?\tShow help'
end
function __schtasks_complete_args -d 'Function to generate args'
set --local previous_token (commandline -oc)[-1]
set --local previous_token (commandline -oc)[-1]
if __fish_seen_argument -w change
__schtasks_change_complete_args "$previous_token"
else if __fish_seen_argument -w create
__schtasks_create_complete_args "$previous_token"
else if __fish_seen_argument -w delete
__schtasks_delete_complete_args "$previous_token"
else if __fish_seen_argument -w end
__schtasks_end_complete_args "$previous_token"
else if __fish_seen_argument -w query
__schtasks_query_complete_args "$previous_token"
else if __fish_seen_argument -w run
__schtasks_run_complete_args "$previous_token"
end
if __fish_seen_argument -w change
__schtasks_change_complete_args "$previous_token"
else if __fish_seen_argument -w create
__schtasks_create_complete_args "$previous_token"
else if __fish_seen_argument -w delete
__schtasks_delete_complete_args "$previous_token"
else if __fish_seen_argument -w end
__schtasks_end_complete_args "$previous_token"
else if __fish_seen_argument -w query
__schtasks_query_complete_args "$previous_token"
else if __fish_seen_argument -w run
__schtasks_run_complete_args "$previous_token"
end
end
complete -c schtasks -f -a '(__schtasks_complete_args)'

View file

@ -1,10 +1,10 @@
function __setx_complete_args -d 'Function to generate args'
set -l previous_token (commandline -oc)[-1]
set -l previous_token (commandline -oc)[-1]
if test "$previous_token" = '/u'
__fish_print_windows_users
return
end
if test "$previous_token" = /u
__fish_print_windows_users
return
end
end
complete -c setx -f -a '(__setx_complete_args)'

View file

@ -1,3 +1,3 @@
function __fish_print_windows_drives --description 'Print Windows drives'
wmic logicaldisk get name | tail +2
wmic logicaldisk get name | tail +2
end

View file

@ -1,3 +1,3 @@
function __fish_print_windows_users --description 'Print Windows user names'
wmic useraccount get name | tail +2
wmic useraccount get name | tail +2
end

View file

@ -3,7 +3,7 @@ function __fish_seen_argument --description 'Check whether argument is used'
set --local tokens (commandline --current-process --tokenize --cut-at-cursor)
set --erase tokens[1]
for t in $tokens
for s in $_flag_s
if string match --regex --quiet -- "^-[A-z0-9]*"$s"[A-z0-9]*\$" $t