fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a9618477e
master
1function __schtasks_print_tasks -d'Helper function to print tasks' 2schtasks /query /fo csv /nh| awk -F',' '{ print $1 }' 3end 4 5function __schtasks_change_complete_args -a previous_token 6if test " $previous_token " = /tn 7__schtasks_print_tasks 8return 9end 10 11if string match -r -q --" $previous_token " '^/r?u$' 12__fish_print_windows_users 13return 14end 15 16if __fish_seen_argument -w s 17echo -e'/u\tRun this command with the permissions of the specified user account' 18end 19 20if __fish_seen_argument -w u 21echo -e'/p\tSpecify the password of the user account specified in the /u parameter' 22end 23 24if not __fish_seen_argument -w et -w du 25echo -e'/et\tSpecify the end time for the task 26/du\tA value that specifies the duration' 27end 28 29if not __fish_seen_argument -w ENABLE -w DISABLE 30echo -e'/ENABLE\tSpecify to enable the scheduled task 31/DISABLE\tSpecify to disable the scheduled task' 32end 33 34echo -e'/tn\tIdentify the task to be changed 35/s\tSpecify the name or IP address of a remote computer 36/ru\tChange the user name under which the scheduled task has to run 37/rp\tSpecify a new password for the existing user account, or the user account specified by /ru 38/tr\tChange the program that the task runs 39/st\tSpecify the start time for the task 40/ri\tSpecify the repetition interval for the scheduled task 41/k\tStop the program that the task runs at the time specified by /et or /du 42/sd\tSpecify the first date on which the task should be run 43/ed\tSpecify the last date on which the task should be run 44/it\tSpecify to run the scheduled task only when the run as user is logged on to the computer 45/z\tSpecify to delete the task upon the completion of its schedule 46/?\tShow help' 47end 48 49function __schtasks_create_complete_args -a previous_token 50if test " $previous_token " = /sc 51echo -e'MINUTE\tSpecify the number of minutes before the task should run 52HOURLY\tSpecify the number of hours before the task should run 53DAILY\tSpecify the number of days before the task should run 54WEEKLY\tSpecify the number of weeks before the task should run 55MONTHLY\tSpecify the number of months before the task should run 56ONCE\tSpecify that that task runs once at a specified date and time 57ONSTART\tSpecify that the task runs every time the system starts 58ONLOGON\tSpecify that the task runs whenever a user logs on 59ONIDLE\tSpecify that the task runs whenever the system is idle for a specified period of time' 60return 61end 62 63if string match -r -q --" $previous_token " '^/r?u$' 64__fish_print_windows_users 65return 66end 67 68if test " $previous_token " = /mo 69echo -e'MINUTE\tSpecify that the task runs every n minutes 70HOURLY\tSpecify that the task runs every n hours 71DAILY\tSpecify that the task runs every n days 72WEEKLY\tSpecify that the task runs every n weeks 73MONTHLY\tSpecify that the task runs every n months 74ONCE\tSpecify that the task runs once 75ONSTART\tSpecify that the task runs at startup 76ONLOGON\tSpecify that the task runs when the user specified by the /u parameter logs on 77ONIDLE\tSpecify that the task runs after the system is idle for the number of minutes specified by /i' 78return 79end 80 81if __fish_seen_argument -w s 82echo -e'/u\tRun this command with the permissions of the specified user account' 83end 84 85if __fish_seen_argument -w u 86echo -e'/p\tSpecify the password of the user account specified in the /u parameter' 87end 88 89if not __fish_seen_argument -w et -w du 90echo -e'/et\tSpecify the time of day that a minute or hourly task schedule ends 91/du\tSpecify a maximum length of time for a minute or hourly schedule' 92end 93 94echo -e'/sc\tSpecify the schedule type 95/tn\tSpecify a name for the task 96/tr\tSpecify the program or command that the task runs 97/s\tSpecify the name or IP address of a remote computer 98/ru\tRun the task with permissions of the specified user account 99/rp\tSpecify a the password for the existing user account, or the user account specified by /ru 100/mo\tSpecify how often the task runs within its schedule type 101/d\tSpecify how often the task runs within its schedule type 102/m\tSpecify a month or months of the year during which the scheduled task should run 103/i\tSpecify how many minutes the computer is idle before the task starts 104/st\tSpecify the start time for the task 105/ri\tSpecify the repetition interval for the scheduled task 106/k\tStop the program that the task runs at the time specified by /et or /du 107/sd\tSpecify the date on which the task schedule starts 108/ed\tSpecify the date on which the schedule ends 109/it\tSpecify to run the scheduled task only when the run as user is logged on to the computer 110/z\tSpecify to delete the task upon the completion of its schedule 111/f\tSpecify to create the task and suppress warnings if the specified task already exists 112/?\tShow help' 113end 114 115function __schtasks_delete_complete_args -a previous_token 116if test " $previous_token " = /tn 117__schtasks_print_tasks 118return 119end 120 121if test " $previous_token " = /u 122__fish_print_windows_users 123return 124end 125 126if __fish_seen_argument -w s 127echo -e'/u\tRun this command with the permissions of the specified user account' 128end 129 130if __fish_seen_argument -w u 131echo -e'/p\tSpecify the password of the user account specified in the /u parameter' 132end 133 134echo -e'/tn\tIdentify the task to be deleted 135/f\tSuppress the confirmation message 136/s\tSpecify the name or IP address of a remote computer 137/?\tShow help' 138end 139 140function __schtasks_end_complete_args -a previous_token 141if test " $previous_token " = /tn 142__schtasks_print_tasks 143return 144end 145 146if test " $previous_token " = /u 147__fish_print_windows_users 148return 149end 150 151if __fish_seen_argument -w s 152echo -e'/u\tRun this command with the permissions of the specified user account' 153end 154 155if __fish_seen_argument -w u 156echo -e'/p\tSpecify the password of the user account specified in the /u parameter' 157end 158 159echo -e'/tn\tIdentify the task that started the program 160/s\tSpecify the name or IP address of a remote computer 161/?\tShow help' 162end 163 164function __schtasks_query_complete_args -a previous_token 165if test " $previous_token " = /fo 166echo -e'TABLE 167LIST 168CSV' 169return 170end 171 172if test " $previous_token " = /u 173__fish_print_windows_users 174return 175end 176 177if __fish_seen_argument -w s 178echo -e'/u\tRun this command with the permissions of the specified user account' 179end 180 181if __fish_seen_argument -w u 182echo -e'/p\tSpecify the password of the user account specified in the /u parameter' 183end 184 185echo -e'/fo\tSpecify the output format 186/nh\tRemove column headings 187/v\tAdd the advanced properties of the task 188/s\tSpecify the name or IP address of a remote computer 189/?\tShow help' 190end 191 192function __schtasks_run_complete_args -a previous_token 193if test " $previous_token " = /tn 194__schtasks_print_tasks 195return 196end 197 198if test " $previous_token " = /u 199__fish_print_windows_users 200return 201end 202 203if __fish_seen_argument -w s 204echo -e'/u\tRun this command with the permissions of the specified user account' 205end 206 207if __fish_seen_argument -w u 208echo -e'/p\tSpecify the password of the user account specified in the /u parameter' 209end 210 211echo -e'/tn\tIdentify the task to start 212/s\tSpecify the name or IP address of a remote computer 213/?\tShow help' 214end 215 216function __schtasks_complete_args -d'Function to generate args' 217set --local previous_token( commandline -xc)[ -1 ] 218 219if __fish_seen_argument -w change 220__schtasks_change_complete_args " $previous_token " 221else if __fish_seen_argument -w create 222__schtasks_create_complete_args " $previous_token " 223else if __fish_seen_argument -w delete 224__schtasks_delete_complete_args " $previous_token " 225else if __fish_seen_argument -w end 226__schtasks_end_complete_args " $previous_token " 227else if __fish_seen_argument -w query 228__schtasks_query_complete_args " $previous_token " 229else if __fish_seen_argument -w run 230__schtasks_run_complete_args " $previous_token " 231end 232end 233 234complete -c schtasks -f -a'(__schtasks_complete_args)' 235 236complete -c schtasks -f -n'not __fish_seen_argument -w change -w create -w delete -w end \ 237-w query -w run' -a /change\ 238 -d'Change one or more properties of a task' 239complete -c schtasks -f -n'not __fish_seen_argument -w change -w create -w delete -w end \ 240-w query -w run' -a /create\ 241 -d'Schedule a new task' 242complete -c schtasks -f -n'not __fish_seen_argument -w change -w create -w delete -w end \ 243-w query -w run' -a /delete\ 244 -d'Delete a scheduled task' 245complete -c schtasks -f -n'not __fish_seen_argument -w change -w create -w delete -w end \ 246-w query -w run' -a /end\ 247 -d'Stop a program started by a task' 248complete -c schtasks -f -n'not __fish_seen_argument -w change -w create -w delete -w end \ 249-w query -w run' -a /query\ 250 -d'Display tasks scheduled to run on the computer' 251complete -c schtasks -f -n'not __fish_seen_argument -w change -w create -w delete -w end \ 252-w query -w run' -a /run\ 253 -d'Start a scheduled task immediately'