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

View File

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

View File

@ -1,10 +1,10 @@
function __cleanmgr_complete_args -d 'Function to generate args' 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' if test "$previous_token" = /d
__fish_print_windows_drives __fish_print_windows_drives
return return
end end
end end
complete -c cleanmgr -f -a '(__cleanmgr_complete_args)' complete -c cleanmgr -f -a '(__cleanmgr_complete_args)'

View File

@ -1,16 +1,16 @@
function __cmdkey_complete_args -d 'Function to generate args' function __cmdkey_complete_args -d 'Function to generate args'
set -l current_token (commandline -tc) set -l current_token (commandline -tc)
set -l previous_token (commandline -oc)[-1] set -l previous_token (commandline -oc)[-1]
switch $current_token switch $current_token
case '/user:*' case '/user:*'
__fish_print_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }" __fish_print_windows_users | awk "{ printf \"%s%s\n\", \"$current_token\", \$0 }"
case '*' case '*'
if test "$previous_token" = '/delete' if test "$previous_token" = /delete
echo -e '/ras\tDelete remote access entry' echo -e '/ras\tDelete remote access entry'
return return
end end
end end
end end
complete -c cmdkey -f -a '(__cmdkey_complete_args)' 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 --short-option '?' --old-option Help --description 'Show help'
complete --command powershell --old-option PSConsoleFile --require-parameter \ 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' \ 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 NoLogo --description 'Hides the copyright banner at startup'
complete --command powershell --old-option NoExit \ 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 \ 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 \ 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 NoProfile --description 'Does not load the PowerShell profile'
complete --command powershell --old-option NonInteractive \ 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 \ 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 \ 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 \ 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 \ complete --command powershell --old-option EncodedCommand --require-parameter \
--description 'Accept a base-64-encoded string version of a command' --description 'Accept a base-64-encoded string version of a command'
complete --command powershell --old-option ConfigurationName --no-files --require-parameter \ complete --command powershell --old-option ConfigurationName --no-files --require-parameter \
--description 'Specify a configuration endpoint in which PowerShell is run' --description 'Specify a configuration endpoint in which PowerShell is run'
complete --command powershell --old-option File --require-parameter complete --command powershell --old-option File --require-parameter
complete --command powershell --old-option ExecutionPolicy --no-files --require-parameter \ complete --command powershell --old-option ExecutionPolicy --no-files --require-parameter \
--arguments 'AllSigned Bypass Default RemoteSigned Restricted Undefined Unrestricted' \ --arguments 'AllSigned Bypass Default RemoteSigned Restricted Undefined Unrestricted' \
--description 'Sets the default execution policy for the current session' --description 'Sets the default execution policy for the current session'
complete --command powershell --old-option Command --no-files --require-parameter \ complete --command powershell --old-option Command --no-files --require-parameter \
--description 'Execute the specified commands at the PowerShell command prompt' --description 'Execute the specified commands at the PowerShell command prompt'

View File

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

View File

@ -1,37 +1,37 @@
function __schtasks_print_tasks -d 'Helper function to print tasks' 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 end
function __schtasks_change_complete_args -a previous_token function __schtasks_change_complete_args -a previous_token
if test "$previous_token" = '/tn' if test "$previous_token" = /tn
__schtasks_print_tasks __schtasks_print_tasks
return return
end end
if string match -r -q -- "$previous_token" '^/r?u$' if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users __fish_print_windows_users
return return
end end
if __fish_seen_argument -w 's' if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account' echo -e '/u\tRun this command with the permissions of the specified user account'
end end
if __fish_seen_argument -w 'u' if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter' echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end end
if not __fish_seen_argument -w 'et' -w 'du' if not __fish_seen_argument -w et -w du
echo -e '/et\tSpecify the end time for the task echo -e '/et\tSpecify the end time for the task
/du\tA value that specifies the duration' /du\tA value that specifies the duration'
end end
if not __fish_seen_argument -w 'ENABLE' -w 'DISABLE' if not __fish_seen_argument -w ENABLE -w DISABLE
echo -e '/ENABLE\tSpecify to enable the scheduled task echo -e '/ENABLE\tSpecify to enable the scheduled task
/DISABLE\tSpecify to disable 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 /s\tSpecify the name or IP address of a remote computer
/ru\tChange the user name under which the scheduled task has to run /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 /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 end
function __schtasks_create_complete_args -a previous_token function __schtasks_create_complete_args -a previous_token
if test "$previous_token" = '/sc' if test "$previous_token" = /sc
echo -e 'MINUTE\tSpecify the number of minutes before the task should run echo -e 'MINUTE\tSpecify the number of minutes before the task should run
HOURLY\tSpecify the number of hours 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 DAILY\tSpecify the number of days before the task should run
WEEKLY\tSpecify the number of weeks 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 ONSTART\tSpecify that the task runs every time the system starts
ONLOGON\tSpecify that the task runs whenever a user logs on 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' ONIDLE\tSpecify that the task runs whenever the system is idle for a specified period of time'
return return
end end
if string match -r -q -- "$previous_token" '^/r?u$' if string match -r -q -- "$previous_token" '^/r?u$'
__fish_print_windows_users __fish_print_windows_users
return return
end end
if test "$previous_token" = '/mo' if test "$previous_token" = /mo
echo -e 'MINUTE\tSpecify that the task runs every n minutes echo -e 'MINUTE\tSpecify that the task runs every n minutes
HOURLY\tSpecify that the task runs every n hours HOURLY\tSpecify that the task runs every n hours
DAILY\tSpecify that the task runs every n days DAILY\tSpecify that the task runs every n days
WEEKLY\tSpecify that the task runs every n weeks 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 ONSTART\tSpecify that the task runs at startup
ONLOGON\tSpecify that the task runs when the user specified by the /u parameter logs on 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' ONIDLE\tSpecify that the task runs after the system is idle for the number of minutes specified by /i'
return return
end end
if __fish_seen_argument -w 's' if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account' echo -e '/u\tRun this command with the permissions of the specified user account'
end end
if __fish_seen_argument -w 'u' if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter' echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end end
if not __fish_seen_argument -w 'et' -w '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 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' /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 /tn\tSpecify a name for the task
/tr\tSpecify the program or command that the task runs /tr\tSpecify the program or command that the task runs
/s\tSpecify the name or IP address of a remote computer /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 end
function __schtasks_delete_complete_args -a previous_token function __schtasks_delete_complete_args -a previous_token
if test "$previous_token" = '/tn' if test "$previous_token" = /tn
__schtasks_print_tasks __schtasks_print_tasks
return return
end end
if test "$previous_token" = '/u' if test "$previous_token" = /u
__fish_print_windows_users __fish_print_windows_users
return return
end end
if __fish_seen_argument -w 's' if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account' echo -e '/u\tRun this command with the permissions of the specified user account'
end end
if __fish_seen_argument -w 'u' if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter' echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end end
echo -e '/tn\tIdentify the task to be deleted echo -e '/tn\tIdentify the task to be deleted
/f\tSuppress the confirmation message /f\tSuppress the confirmation message
/s\tSpecify the name or IP address of a remote computer /s\tSpecify the name or IP address of a remote computer
/?\tShow help' /?\tShow help'
end end
function __schtasks_end_complete_args -a previous_token function __schtasks_end_complete_args -a previous_token
if test "$previous_token" = '/tn' if test "$previous_token" = /tn
__schtasks_print_tasks __schtasks_print_tasks
return return
end end
if test "$previous_token" = '/u' if test "$previous_token" = /u
__fish_print_windows_users __fish_print_windows_users
return return
end end
if __fish_seen_argument -w 's' if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account' echo -e '/u\tRun this command with the permissions of the specified user account'
end end
if __fish_seen_argument -w 'u' if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter' echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end 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 /s\tSpecify the name or IP address of a remote computer
/?\tShow help' /?\tShow help'
end end
function __schtasks_query_complete_args -a previous_token function __schtasks_query_complete_args -a previous_token
if test "$previous_token" = '/fo' if test "$previous_token" = /fo
echo -e 'TABLE echo -e 'TABLE
LIST LIST
CSV' CSV'
return return
end end
if test "$previous_token" = '/u' if test "$previous_token" = /u
__fish_print_windows_users __fish_print_windows_users
return return
end end
if __fish_seen_argument -w 's' if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account' echo -e '/u\tRun this command with the permissions of the specified user account'
end end
if __fish_seen_argument -w 'u' if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter' echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end end
echo -e '/fo\tSpecify the output format echo -e '/fo\tSpecify the output format
/nh\tRemove column headings /nh\tRemove column headings
/v\tAdd the advanced properties of the task /v\tAdd the advanced properties of the task
/s\tSpecify the name or IP address of a remote computer /s\tSpecify the name or IP address of a remote computer
@ -190,45 +190,45 @@ CSV'
end end
function __schtasks_run_complete_args -a previous_token function __schtasks_run_complete_args -a previous_token
if test "$previous_token" = '/tn' if test "$previous_token" = /tn
__schtasks_print_tasks __schtasks_print_tasks
return return
end end
if test "$previous_token" = '/u' if test "$previous_token" = /u
__fish_print_windows_users __fish_print_windows_users
return return
end end
if __fish_seen_argument -w 's' if __fish_seen_argument -w s
echo -e '/u\tRun this command with the permissions of the specified user account' echo -e '/u\tRun this command with the permissions of the specified user account'
end end
if __fish_seen_argument -w 'u' if __fish_seen_argument -w u
echo -e '/p\tSpecify the password of the user account specified in the /u parameter' echo -e '/p\tSpecify the password of the user account specified in the /u parameter'
end 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 /s\tSpecify the name or IP address of a remote computer
/?\tShow help' /?\tShow help'
end end
function __schtasks_complete_args -d 'Function to generate args' 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 if __fish_seen_argument -w change
__schtasks_change_complete_args "$previous_token" __schtasks_change_complete_args "$previous_token"
else if __fish_seen_argument -w create else if __fish_seen_argument -w create
__schtasks_create_complete_args "$previous_token" __schtasks_create_complete_args "$previous_token"
else if __fish_seen_argument -w delete else if __fish_seen_argument -w delete
__schtasks_delete_complete_args "$previous_token" __schtasks_delete_complete_args "$previous_token"
else if __fish_seen_argument -w end else if __fish_seen_argument -w end
__schtasks_end_complete_args "$previous_token" __schtasks_end_complete_args "$previous_token"
else if __fish_seen_argument -w query else if __fish_seen_argument -w query
__schtasks_query_complete_args "$previous_token" __schtasks_query_complete_args "$previous_token"
else if __fish_seen_argument -w run else if __fish_seen_argument -w run
__schtasks_run_complete_args "$previous_token" __schtasks_run_complete_args "$previous_token"
end end
end end
complete -c schtasks -f -a '(__schtasks_complete_args)' complete -c schtasks -f -a '(__schtasks_complete_args)'

View File

@ -1,10 +1,10 @@
function __setx_complete_args -d 'Function to generate args' 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' if test "$previous_token" = /u
__fish_print_windows_users __fish_print_windows_users
return return
end end
end end
complete -c setx -f -a '(__setx_complete_args)' complete -c setx -f -a '(__setx_complete_args)'

View File

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

View File

@ -1,3 +1,3 @@
function __fish_print_windows_users --description 'Print Windows user names' function __fish_print_windows_users --description 'Print Windows user names'
wmic useraccount get name | tail +2 wmic useraccount get name | tail +2
end 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 --local tokens (commandline --current-process --tokenize --cut-at-cursor)
set --erase tokens[1] set --erase tokens[1]
for t in $tokens for t in $tokens
for s in $_flag_s for s in $_flag_s
if string match --regex --quiet -- "^-[A-z0-9]*"$s"[A-z0-9]*\$" $t if string match --regex --quiet -- "^-[A-z0-9]*"$s"[A-z0-9]*\$" $t