fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
00e0d6ad9
master
1function __reg_run_reg_safely 2set -l output( reg $argv | tr -d'\r' | tail --lines+2 | string collect) 3if not string match -q -r"reg: Invalid syntax*" --$output 4set output( string split\n --$output ) 5echo $output | string replace -a" " \n 6end 7end 8 9function __reg_add_complete_args -a previous_token 10if test " $previous_token " = add 11set -l current_token( commandline -tc) 12__reg_run_reg_safely query$current_token 13return 14end 15 16if test " $previous_token " = /t 17echo 'REG_SZ 18REG_MULTI_SZ 19REG_DWORD_BIG_ENDIAN 20REG_DWORD 21REG_BINARY 22REG_DWORD_LITTLE_ENDIAN 23REG_LINK 24REG_FULL_RESOURCE_DESCRIPTOR 25REG_EXPAND_SZ' 26return 27end 28 29if not __fish_seen_argument -w v -w ve 30echo -e'/v\tSpecify the name of the add registry entry 31/ve\tSpecify that the added registry entry has a null value' 32end 33 34echo -e'/t\tSpecify the type for the registry entry 35/s\tSpecify the character to be used 36/d\tSpecify the data for the new registry entry 37/f\tAdd the registry entry without prompting for confirmation 38/?\tShow help' 39end 40 41function __reg_compare_complete_args 42if not __fish_seen_argument -w v -w ve 43echo -e'/v\tSpecify the value name 44/ve\tSpecify that only entries that have a value name of null should be compared' 45end 46 47if not __fish_seen_argument -w oa -w od -w os -w on 48echo -e'/oa\tSpecify that all differences and matches are displayed 49/od\tSpecify that only differences are displayed 50/os\tSpecify that only matches are displayed 51/on\tSpecify that nothing is displayed' 52end 53 54echo -e'/s\tCompare all subkeys and entries recursively 55/?\tShow help' 56end 57 58function __reg_copy_complete_args 59echo -e'/s\tCopy all subkeys and entries under the specified subkey 60/f\tCopy the subkey without prompting for confirmation 61/?\tShow help' 62end 63 64function __reg_delete_complete_args -a previous_token 65if test " $previous_token " = delete 66set -l current_token( commandline -tc) 67__reg_run_reg_safely query$current_token 68return 69end 70 71if not __fish_seen_argument -w v -w ve -w va 72echo -e'/v\tDelete a specific entry under the subkey 73/ve\tSpecify that only entries that have no value will be deleted 74/va\tDelete all entries under the specified subkey' 75end 76 77echo -e'/f\tDelete the existing registry subkey or entry without asking for confirmation 78/?\tShow help' 79end 80 81function __reg_export_complete_args -a previous_token 82if test " $previous_token " = export 83set -l current_token( commandline -tc) 84__reg_run_reg_safely query$current_token 85return 86end 87 88echo -e'/y\tOverwrite any existing file with the name filename without prompting for confirmation 89/?\tShow help' 90end 91 92function __reg_query_complete_args -a previous_token 93if test " $previous_token " = query 94set -l current_token( commandline -tc) 95__reg_run_reg_safely query$current_token 96return 97end 98 99if test " $previous_token " = /t 100echo 'REG_SZ 101REG_MULTI_SZ 102REG_EXPAND_SZ 103REG_DWORD 104REG_BINARY 105REG_NONE' 106return 107end 108 109if not __fish_seen_argument -w v -w ve 110echo -e'/v\tSpecify the registry value name 111/ve\tRun a query for value names that are empty' 112end 113 114if not __fish_seen_argument -w k -w d 115echo -e'/k\tSpecify to search in key names only 116/d\tSpecify to search in data only' 117end 118 119echo -e'/se\tSpecify the single value separator 120/f\tSpecify the data or pattern to search for 121/c\tSpecify that the query is case sensitive 122/e\tSpecify to return only exact matches 123/t\tSpecify registry types to search 124/z\tSpecify to include the numeric equivalent for the registry type in search results 125/?\tShow help' 126end 127 128function __reg_save_complete_args -a previous_token 129if test " $previous_token " = save 130set -l current_token( commandline -tc) 131__reg_run_reg_safely query$current_token 132return 133end 134 135echo -e'/y\tOverwrite an existing file with the name filename without prompting for confirmation 136/?\tShow help' 137end 138 139function __reg_complete_args -d'Function to generate args' 140set -l previous_token( commandline -xc)[ -1 ] 141 142if __fish_seen_subcommand_from add 143__reg_add_complete_args $previous_token 144else if __fish_seen_subcommand_from compare 145__reg_compare_complete_args 146else if __fish_seen_subcommand_from copy 147__reg_copy_complete_args 148else if __fish_seen_subcommand_from delete 149__reg_delete_complete_args $previous_token 150else if __fish_seen_subcommand_from export 151__reg_export_complete_args $previous_token 152else if __fish_seen_subcommand_from query 153__reg_query_complete_args $previous_token 154else if __fish_seen_subcommand_from save 155__reg_save_complete_args $previous_token 156end 157end 158 159complete -c reg -f -a'(__reg_complete_args)' 160 161complete -c reg -f\ 162 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a add\ 163 -d'Add a new subkey or entry' 164complete -c reg -f\ 165 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a compare\ 166 -d'Compare specified registry subkeys or entries' 167complete -c reg -f\ 168 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a copy\ 169 -d'Copy a registry entry' 170complete -c reg -f\ 171 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a delete\ 172 -d'Delete a subkey or entries' 173complete -c reg -f\ 174 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a export\ 175 -d'Copy the specified subkeys, entries, and values of the local computer into a file' 176complete -c reg -f\ 177 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a import\ 178 -d'Copy contents of a file with registry data into the local registry' 179complete -c reg -f\ 180 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a load\ 181 -d'Write saved subkeys and entries into a different subkey in the registry' 182complete -c reg -f\ 183 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a query\ 184 -d'Return a list of the next tier of subkeys and entries' 185complete -c reg -f\ 186 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a restore\ 187 -d'Write saved subkeys and entries back' 188complete -c reg -f\ 189 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a save\ 190 -d'Save a copy of specified subkeys, entries, and values of the registry in a specified file' 191complete -c reg -f\ 192 -n'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a unload\ 193 -d'Remove a section of the registry that was loaded using the reg load operation'