Prettify all commands:

- rename *list* functions to *print*
- use short options everywhere
- delegate less work to functions
This commit is contained in:
EmilySeville7cfg 2022-01-24 20:10:56 +10:00 committed by ridiculousfish
parent 7ae194cb03
commit 78bd0f9cdb
15 changed files with 206 additions and 198 deletions

View file

@ -1,5 +1,5 @@
function __attrib_complete_args --description 'Function to generate args'
set --local current_token (commandline --current-token --cut-at-cursor)
function __attrib_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc)
switch $current_token
case '+*'
@ -14,17 +14,18 @@ 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 }"
case '*'
if __fish_seen_argument --windows 's'
echo -e '/d\tApply attrib and any command-line options to directories
/l\tApply attrib and any command-line options to the Symbolic Link'
end
echo -e '+\tSet the file attribute
-\tClear the file attribute
/s\tApply to matching files in the current directory and all of its subdirectories
/?\tShow help'
end
end
complete --command attrib --no-files --arguments '(__attrib_complete_args)'
complete -c attrib -f -a '(__attrib_complete_args)'
complete -c attrib -f -n '__fish_seen_argument -w s' -a d \
-d 'Apply attrib and any command-line options to directories'
complete -c attrib -f -n '__fish_seen_argument -w s' -a l \
-d 'Apply attrib and any command-line options to the Symbolic Link'
complete -c attrib -f -a + -d 'Set the file attribute'
complete -c attrib -f -a - -d 'Clear the file attribute'
complete -c attrib -f -a /s \
-d 'Apply to matching files in the current directory and all of its subdirectories'
complete -c attrib -f -a '/?' -d 'Show help'

View file

@ -16,14 +16,17 @@ clear\tClear the specified attribute of the volume with focus'
return
end
echo -e 'readonly\tSpecify that the volume is read-only
readonly\tSpecify that the volume is hidden
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
noerr\tWhen an error is encountered, DiskPart continues to process commands'
shadowcopy\tSpecify that the volume is a shadow copy volume'
end
echo -e 'noerr\tWhen an error is encountered, DiskPart continues to process commands'
end
function __attributes_complete_args --description 'Function to generate args'
function __attributes_complete_args -d 'Function to generate args'
if not __fish_seen_subcommand_from disk volume
echo -e 'disk\tDisplay, set, or clear the attributes of a disk
volume\tDisplay, set, or clear the attributes of a volume'
@ -37,4 +40,4 @@ volume\tDisplay, set, or clear the attributes of a volume'
end
end
complete --command attributes --no-files --arguments '(__attributes_complete_args)'
complete -c attributes -f -a '(__attributes_complete_args)'

View file

@ -1,7 +1,7 @@
complete --command choice --no-files --arguments '/c' --description "Specify the list of choices to be created"
complete --command choice --no-files --arguments '/n' --description "Hide the list of choices"
complete --command choice --no-files --arguments '/cs' --description "Specify that the choices are case-sensitive"
complete --command choice --no-files --arguments '/t' --description "Specify the number of seconds"
complete --command choice --no-files --arguments '/d' --description "Specify the default choice"
complete --command choice --no-files --arguments '/m' --description "Specify a message"
complete --command choice --no-files --arguments '/?' --description "Show help"
complete -c choice -f -a /c -d "Specify the list of choices to be created"
complete -c choice -f -a /n -d "Hide the list of choices"
complete -c choice -f -a /cs -d "Specify that the choices are case-sensitive"
complete -c choice -f -a /t -d "Specify the number of seconds"
complete -c choice -f -a /d -d "Specify the default choice"
complete -c choice -f -a /m -d "Specify a message"
complete -c choice -f -a '/?' -d "Show help"

View file

@ -1 +1 @@
complete --command clean --no-files --arguments 'all' --description "Specify that each and every sector on the disk is set to zero"
complete -c clean -f -a all -d "Specify that each and every sector on the disk is set to zero"

View file

@ -1,18 +1,19 @@
function __cleanmgr_complete_args --description 'Function to generate args'
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
function __cleanmgr_complete_args -d 'Function to generate args'
set -l previous_token (commandline -oc)[-1]
if test "$previous_token" = '/d'
__fish_print_windows_drives
return
end
echo -e '/d\tSpecify the drive
/sageset\tDisplay the Disk Cleanup Settings dialog box and also create a registry keyt
/sagerun\tRun the specified tasks that are assigned to the n value
/tuneup\tRun /sageset and /sagerun for the same n
/lowdisk\tRun with the default settings
/verylowdisk\tRun with the default settings, no user prompts
/?\tShow help'
end
complete --command cleanmgr --no-files --arguments '(__cleanmgr_complete_args)'
complete -c cleanmgr -f -a '(__cleanmgr_complete_args)'
complete -c cleanmgr -f -a /d -d 'Specify the drive'
complete -c cleanmgr -f -a /sageset \
-d 'Display the Disk Cleanup Settings dialog box and also create a registry key'
complete -c cleanmgr -f -a /sagerun -d 'Run the specified tasks that are assigned to the n value'
complete -c cleanmgr -f -a /tuneup -d 'Run /sageset and /sagerun for the same n'
complete -c cleanmgr -f -a /lowdisk -d 'Run with the default settings'
complete -c cleanmgr -f -a /verylowdisk -d 'Run with the default settings, no user prompts'
complete -c cleanmgr -f -a '/?' -d 'Show help'

View file

@ -1,9 +1,9 @@
function __cmd_complete_args --description 'Function to generate args'
set --local current_token (commandline --current-token --cut-at-cursor)
function __cmd_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc)
switch $current_token
case '/t:*'
echo -e '0\tBlack
switch $current_token
case '/t:*'
echo -e '0\tBlack
1\tBlue
2\tGreen
3\tAqua
@ -19,32 +19,36 @@ C\tLight red
D\tLight purple
E\tLight yellow
F\tBright white' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
case '/e:*'
echo -e 'on\tEnable command extensions
case '/e:*'
echo -e 'on\tEnable command extensions
off\tDisable command extensions' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
case '/f:*'
echo -e 'on\tEnable file and directory name completion
case '/f:*'
echo -e 'on\tEnable file and directory name completion
off\tDisable file and directory name completion' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
case '/v:*'
echo -e 'on\tEnable delayed environment variable expansion
case '/v:*'
echo -e 'on\tEnable delayed environment variable expansion
off\tDisable delayed environment variable expansion' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
case '*'
if not __fish_seen_argument --windows 'c' --windows 'k'
echo -e '/c\tCarry out the command specified by string and then stop
/k\tCarry out the command specified by string and continue'
end
echo -e '/s\tModify the treatment of string after /c or /k
/q\tTurn the echo off
/d\tDisable execution of AutoRun commands
/a\tFormat internal command output as ANSI
/u\tFormat internal command output as Unicode
/t\tSet the background and foreground color
/e\tManage command extensions
/f\tManage file and directory name completion
/v\tManage delayed environment variable expansion
/?\tShow help'
end
end
end
complete --command cmd --no-files --arguments '(__cmd_complete_args)'
complete -c cmd -f -a '(__cmd_complete_args)'
complete -c cmd -f -n 'not __fish_seen_argument -w c -w k' -a /c \
-d 'Carry out the command specified by string and then stop'
complete -c cmd -f -n 'not __fish_seen_argument -w c -w k' -a /k \
-d 'Carry out the command specified by string and continue'
complete -c cmd -f -a /s -d 'Modify the treatment of string after /c or /k'
complete -c cmd -f -a /q -d 'Turn the echo off'
complete -c cmd -f -a /d -d 'Disable execution of AutoRun commands'
complete -c cmd -f -n 'not __fish_seen_argument -w a -w u' -a /a \
-d 'Format internal command output as ANSI'
complete -c cmd -f -n 'not __fish_seen_argument -w a -w u' -a /u \
-d 'Format internal command output as Unicode'
complete -c cmd -f -a /t -d 'Set the background and foreground color'
complete -c cmd -f -a /e -d 'Manage command extensions'
complete -c cmd -f -a /f -d 'Manage file and directory name completion'
complete -c cmd -f -a /v -d 'Manage delayed environment variable expansion'
complete -c cmd -f -a '/?' -d 'Show help'

View file

@ -1,34 +1,34 @@
function __cmdkey_complete_args --description 'Function to generate args'
set --local current_token (commandline --current-token --cut-at-cursor)
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
function __cmdkey_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc)
set -l previous_token (commandline -oc)[-1]
switch $current_token
case '/user:*'
__fish_list_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }"
__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
if not __fish_seen_argument --windows 'add:' --windows 'generic:'
echo -e '/add:\tAdd a user name and password
/generic:\tAdd generic credentials'
end
if not __fish_seen_argument --windows 'smartcard' --windows 'user:'
echo -e '/smartcard\tRetrieve the credential
/user:\tSpecify the user or account name'
end
if __fish_seen_argument --windows 'user:'
echo -e '/pass:\tSpecify the password'
end
echo -e '/delete\tDelete a user name and password
/list:\tDisplay the list of stored user names and credentials
/?\tShow help'
end
end
complete --command cmdkey --no-files --arguments '(__cmdkey_complete_args)'
complete -c cmdkey -f -a '(__cmdkey_complete_args)'
complete -c cmdkey -f -n "not __fish_seen_argument -w add: -w generic:" -a /add: \
-d 'Add a user name and password'
complete -c cmdkey -f -n "not __fish_seen_argument -w add: -w generic:" -a /generic: \
-d 'Add generic credentials'
complete -c cmdkey -f -n "not __fish_seen_argument -w smartcard -w user:" -a /smartcard \
-d 'Retrieve the credential'
complete -c cmdkey -f -n "not __fish_seen_argument -w smartcard -w user:" -a /user: \
-d 'Specify the user or account name'
complete -c cmdkey -f -n "__fish_seen_argument -w user:" -a /pass: -d 'Specify the password'
complete -c cmdkey -f -a /delete: -d 'Specify the user or account name'
complete -c cmdkey -f -a /delete -d 'Specify the user or account name'
complete -c cmdkey -f -a /list: -d 'Display the list of stored user names and credentials'
complete -c cmdkey -f -a '/?' -d 'Show help'

View file

@ -1,8 +1,8 @@
complete --command comp --no-files --arguments '/d\t"Display differences in decimal format"
/a\t"Display differences as characters"
/l\t"Displays the number of the line where a difference occurs"
/n=\t"Compare only the number of lines that are specified for each file"
/c\t"Perform a comparison that is not case-sensitive"
/off\t"Process files with the offline attribute set"
/offline\t"Process files with the offline attribute set"
/?\t"Show help"'
complete -c comp -f -a /d -d 'Display differences in decimal format'
complete -c comp -f -a /a -d 'Display differences as characters'
complete -c comp -f -a /l -d 'Displays the number of the line where a difference occurs'
complete -c comp -f -a /n -d 'Compare only the number of lines that are specified for each file'
complete -c comp -f -a /c -d 'Perform a comparison that is not case-sensitive'
complete -c comp -f -a /off -d 'Process files with the offline attribute set'
complete -c comp -f -a /offline -d 'Process files with the offline attribute set'
complete -c comp -f -a '/?' -d 'Show help'

View file

@ -1,6 +1,7 @@
complete --command forfiles --no-files --arguments '/P\t"Specify the path from which to start the search"
/M\t"Search files according to the specified search mask"
/S\t"Instruct the forfiles command to search in subdirectories recursively"
/C\t"Run the specified command on each file"
/D\t"Select files with a last modified date within the specified time frame"
/?\t"Show help"'
complete -c forfiles -f -a /P -d 'Specify the path from which to start the search'
complete -c forfiles -f -a /M -d 'Search files according to the specified search mask'
complete -c forfiles -f -a /S -d 'Instruct the forfiles command to search in subdirectories recursively'
complete -c forfiles -f -a /C -d 'Run the specified command on each file'
complete -c forfiles -f -a /D \
-d 'Select files with a last modified date within the specified time frame'
complete -c forfiles -f -a '/?' -d 'Show help'

View file

@ -1,4 +1,4 @@
function __reg_add_complete_args --argument-names previous_token
function __reg_add_complete_args -a previous_token
if test "$previous_token" = '/t'
echo 'REG_SZ
REG_MULTI_SZ
@ -12,7 +12,7 @@ REG_EXPAND_SZ'
return
end
if not __fish_seen_argument --windows 'v' --windows 've'
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
@ -24,13 +24,13 @@ REG_EXPAND_SZ'
/?\tShow help'
end
function __reg_compare_complete_args --argument-names previous_token
if not __fish_seen_argument --windows 'v' --windows 've'
function __reg_compare_complete_args
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
if not __fish_seen_argument --windows 'oa' --windows 'od' --windows 'os' --windows 'on'
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
@ -41,14 +41,14 @@ function __reg_compare_complete_args --argument-names previous_token
/?\tShow help'
end
function __reg_copy_complete_args --argument-names previous_token
function __reg_copy_complete_args
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 --argument-names previous_token
if not __fish_seen_argument --windows 'v' --windows 've' --windows 'va'
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
/ve\tSpecify that only entries that have no value will be deleted
/va\tDelete all entries under the specified subkey'
@ -58,12 +58,12 @@ function __reg_delete_complete_args --argument-names previous_token
/?\tShow help'
end
function __reg_export_complete_args --argument-names previous_token
function __reg_export_complete_args
echo -e '/y\tOverwrite any existing file with the name filename without prompting for confirmation
/?\tShow help'
end
function __reg_query_complete_args --argument-names previous_token
function __reg_query_complete_args -a previous_token
if test "$previous_token" = '/t'
echo 'REG_SZ
REG_MULTI_SZ
@ -74,12 +74,12 @@ REG_NONE'
return
end
if not __fish_seen_argument --windows 'v' --windows 've'
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
if not __fish_seen_argument --windows 'k' --windows 'd'
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
@ -93,12 +93,12 @@ REG_NONE'
/?\tShow help'
end
function __reg_save_complete_args --argument-names previous_token
function __reg_save_complete_args
echo -e '/y\tOverwrite an existing file with the name filename without prompting for confirmation
/?\tShow help'
end
function __reg_complete_args --description 'Function to generate args'
function __reg_complete_args -d 'Function to generate args'
if not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload
echo -e 'add\tAdd a new subkey or entry
compare\tCompare specified registry subkeys or entries
@ -114,10 +114,10 @@ unload\tRemove a section of the registry that was loaded using the reg load oper
return
end
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
set -l previous_token (commandline -oc)[-1]
if __fish_seen_subcommand_from add
__reg_add_complete_args
__reg_add_complete_args $previous_token
else if __fish_seen_subcommand_from compare
__reg_compare_complete_args
else if __fish_seen_subcommand_from copy
@ -127,10 +127,10 @@ unload\tRemove a section of the registry that was loaded using the reg load oper
else if __fish_seen_subcommand_from export
__reg_export_complete_args
else if __fish_seen_subcommand_from query
__reg_query_complete_args
__reg_query_complete_args $previous_token
else if __fish_seen_subcommand_from save
__reg_save_complete_args
end
end
complete --command reg --no-files --arguments '(__reg_complete_args)'
complete -c reg -f -a '(__reg_complete_args)'

View file

@ -1,32 +1,32 @@
function __schtasks_list_tasks --description 'Helper function to list tasks'
function __schtasks_print_tasks -d 'Helper function to print tasks'
schtasks /query /fo csv /nh | awk -F ',' '{ print $1 }'
end
function __schtasks_change_complete_args --argument-names previous_token
function __schtasks_change_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_list_tasks
__schtasks_print_tasks
return
end
if string match --regex --quiet -- "$previous_token" '^/r?u$'
__fish_list_windows_users
if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users
return
end
if __fish_seen_argument --windows 's'
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 --windows 'u'
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 --windows 'et' --windows 'du'
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
if not __fish_seen_argument --windows 'ENABLE' --windows 'DISABLE'
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
@ -46,7 +46,7 @@ function __schtasks_change_complete_args --argument-names previous_token
/?\tShow help'
end
function __schtasks_create_complete_args --argument-names previous_token
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
HOURLY\tSpecify the number of hours before the task should run
@ -60,8 +60,8 @@ ONIDLE\tSpecify that the task runs whenever the system is idle for a specified p
return
end
if string match --regex --quiet -- "$previous_token" '^/r?u$'
__fish_list_windows_users
if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users
return
end
@ -78,15 +78,15 @@ ONIDLE\tSpecify that the task runs after the system is idle for the number of mi
return
end
if __fish_seen_argument --windows 's'
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 --windows 'u'
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 --windows 'et' --windows 'du'
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
@ -112,22 +112,22 @@ ONIDLE\tSpecify that the task runs after the system is idle for the number of mi
/?\tShow help'
end
function __schtasks_delete_complete_args --argument-names previous_token
function __schtasks_delete_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_list_tasks
__schtasks_print_tasks
return
end
if test "$previous_token" = '/u'
__fish_list_windows_users
__fish_print_windows_users
return
end
if __fish_seen_argument --windows 's'
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 --windows 'u'
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
@ -137,22 +137,22 @@ function __schtasks_delete_complete_args --argument-names previous_token
/?\tShow help'
end
function __schtasks_end_complete_args --argument-names previous_token
function __schtasks_end_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_list_tasks
__schtasks_print_tasks
return
end
if test "$previous_token" = '/u'
__fish_list_windows_users
__fish_print_windows_users
return
end
if __fish_seen_argument --windows 's'
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 --windows 'u'
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
@ -161,7 +161,7 @@ function __schtasks_end_complete_args --argument-names previous_token
/?\tShow help'
end
function __schtasks_query_complete_args --argument-names previous_token
function __schtasks_query_complete_args -a previous_token
if test "$previous_token" = '/fo'
echo -e 'TABLE
LIST
@ -170,15 +170,15 @@ CSV'
end
if test "$previous_token" = '/u'
__fish_list_windows_users
__fish_print_windows_users
return
end
if __fish_seen_argument --windows 's'
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 --windows 'u'
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
@ -189,22 +189,22 @@ CSV'
/?\tShow help'
end
function __schtasks_run_complete_args --argument-names previous_token
function __schtasks_run_complete_args -a previous_token
if test "$previous_token" = '/tn'
__schtasks_list_tasks
__schtasks_print_tasks
return
end
if test "$previous_token" = '/u'
__fish_list_windows_users
__fish_print_windows_users
return
end
if __fish_seen_argument --windows 's'
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 --windows 'u'
if __fish_seen_argument -w 'u'
echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end
@ -213,9 +213,9 @@ function __schtasks_run_complete_args --argument-names previous_token
/?\tShow help'
end
function __schtasks_complete_args --description 'Function to generate args'
if not __fish_seen_argument --windows change --windows create --windows delete --windows end \
--windows query --windows run
function __schtasks_complete_args -d 'Function to generate args'
if not __fish_seen_argument -w change -w create -w delete -w end \
-w query -w run
echo -e '/change\tChange one or more properties of a task
/create\tSchedule a new task
/delete\tDelete a scheduled task
@ -225,21 +225,21 @@ function __schtasks_complete_args --description 'Function to generate args'
return
end
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
set --local previous_token (commandline -oc)[-1]
if __fish_seen_argument --windows change
if __fish_seen_argument -w change
__schtasks_change_complete_args "$previous_token"
else if __fish_seen_argument --windows create
else if __fish_seen_argument -w create
__schtasks_create_complete_args "$previous_token"
else if __fish_seen_argument --windows delete
else if __fish_seen_argument -w delete
__schtasks_delete_complete_args "$previous_token"
else if __fish_seen_argument --windows end
else if __fish_seen_argument -w end
__schtasks_end_complete_args "$previous_token"
else if __fish_seen_argument --windows query
else if __fish_seen_argument -w query
__schtasks_query_complete_args "$previous_token"
else if __fish_seen_argument --windows run
else if __fish_seen_argument -w run
__schtasks_run_complete_args "$previous_token"
end
end
complete --command schtasks --no-files --arguments '(__schtasks_complete_args)'
complete -c schtasks -f -a '(__schtasks_complete_args)'

View file

@ -1,34 +1,32 @@
function __setx_complete_args --description 'Function to generate args'
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
function __setx_complete_args -d 'Function to generate args'
set -l previous_token (commandline -oc)[-1]
if test "$previous_token" = '/u'
__fish_list_windows_users
__fish_print_windows_users
return
end
if __fish_seen_argument --windows 's'
echo -e '/u\tRun the script with the credentials of the specified user account'
end
if __fish_seen_argument --windows 'u'
echo -e '/p\tSpecify the password of the user account that is specified in the /u parameter'
end
if not __fish_seen_argument --windows 'a' --windows 'r' --windows 'x'
echo -e '/a\tSpecify absolute coordinates and offset as search parameters
/r\tSpecify relative coordinates and offset
/x\tDisplay file coordinates, ignoring the /a, /r, and /d command-line options'
end
if __fish_seen_argument --windows 'a' --windows 'r'
echo -e '/m\tSpecify to set the variable in the system environment'
end
echo -e '/s\tSpecify the name or IP address of a remote computer
/k\tSpecify that the variable is set based on information from a registry key
/f\tSpecify the file that you want to use
/d\tSpecify delimiters to be used
/?\tShow help'
end
complete --command setx --no-files --arguments '(__setx_complete_args)'
complete -c setx -f -a '(__setx_complete_args)'
complete -c setx -f -n '__fish_seen_argument -w s' -a /u \
-d 'Run the script with the credentials of the specified user account'
complete -c setx -f -n '__fish_seen_argument -w u' -a /p \
-d 'Specify the password of the user account that is specified in the /u parameter'
complete -c setx -f -n 'not __fish_seen_argument -w a -w r -w x' -a /a \
-d 'Specify absolute coordinates and offset as search parameters'
complete -c setx -f -n 'not __fish_seen_argument -w a -w r -w x' -a /r \
-d 'Specify relative coordinates and offset'
complete -c setx -f -n 'not __fish_seen_argument -w a -w r -w x' -a /x \
-d 'Display file coordinates, ignoring the /a, /r, and /d command-line options'
complete -c setx -f -n '__fish_seen_argument -w a -w r' -a /m \
-d 'Specify to set the variable in the system environment'
complete -c setx -f -a /s -d 'Specify the name or IP address of a remote computer'
complete -c setx -f -a /k \
-d 'Specify that the variable is set based on information from a registry key'
complete -c setx -f -a /f -d 'Specify the file that you want to use'
complete -c setx -f -a /d -d 'Specify delimiters to be used'
complete -c setx -f -a '/?' -d 'Show help'

View file

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

View file

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