2022-11-27 13:26:25 +00:00
|
|
|
function __reg_run_reg_safely
|
|
|
|
set -l output (reg $argv | tr -d '\r' | tail --lines +2 | string collect)
|
|
|
|
if not string match -q -r "reg: Invalid syntax*" -- $output
|
|
|
|
set output (string split \n -- $output)
|
|
|
|
echo $output | string replace -a " " \n
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-01-24 10:10:56 +00:00
|
|
|
function __reg_add_complete_args -a previous_token
|
2022-11-27 13:26:25 +00:00
|
|
|
if test "$previous_token" = add
|
|
|
|
set -l current_token (commandline -tc)
|
|
|
|
__reg_run_reg_safely query $current_token
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if test "$previous_token" = /t
|
|
|
|
echo 'REG_SZ
|
2021-11-25 12:39:33 +00:00
|
|
|
REG_MULTI_SZ
|
|
|
|
REG_DWORD_BIG_ENDIAN
|
|
|
|
REG_DWORD
|
|
|
|
REG_BINARY
|
|
|
|
REG_DWORD_LITTLE_ENDIAN
|
|
|
|
REG_LINK
|
|
|
|
REG_FULL_RESOURCE_DESCRIPTOR
|
|
|
|
REG_EXPAND_SZ'
|
2022-01-27 06:02:23 +00:00
|
|
|
return
|
|
|
|
end
|
2021-11-25 12:39:33 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if not __fish_seen_argument -w v -w ve
|
|
|
|
echo -e '/v\tSpecify the name of the add registry entry
|
2021-11-25 09:37:38 +00:00
|
|
|
/ve\tSpecify that the added registry entry has a null value'
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/t\tSpecify the type for the registry entry
|
2021-12-15 22:03:02 +00:00
|
|
|
/s\tSpecify the character to be used
|
2021-11-25 09:37:38 +00:00
|
|
|
/d\tSpecify the data for the new registry entry
|
2021-11-25 12:39:33 +00:00
|
|
|
/f\tAdd the registry entry without prompting for confirmation
|
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-01-24 10:10:56 +00:00
|
|
|
function __reg_compare_complete_args
|
2022-01-27 06:02:23 +00:00
|
|
|
if not __fish_seen_argument -w v -w ve
|
|
|
|
echo -e '/v\tSpecify the value name
|
2021-11-25 09:37:38 +00:00
|
|
|
/ve\tSpecify that only entries that have a value name of null should be compared'
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if not __fish_seen_argument -w oa -w od -w os -w on
|
|
|
|
echo -e '/oa\tSpecify that all differences and matches are displayed
|
2021-11-25 09:37:38 +00:00
|
|
|
/od\tSpecify that only differences are displayed
|
|
|
|
/os\tSpecify that only matches are displayed
|
|
|
|
/on\tSpecify that nothing is displayed'
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/s\tCompare all subkeys and entries recursively
|
2021-11-25 12:39:33 +00:00
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-01-24 10:10:56 +00:00
|
|
|
function __reg_copy_complete_args
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/s\tCopy all subkeys and entries under the specified subkey
|
2021-11-25 12:39:33 +00:00
|
|
|
/f\tCopy the subkey without prompting for confirmation
|
2021-12-15 22:03:02 +00:00
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-11-27 13:26:25 +00:00
|
|
|
function __reg_delete_complete_args -a previous_token
|
|
|
|
if test "$previous_token" = delete
|
|
|
|
set -l current_token (commandline -tc)
|
|
|
|
__reg_run_reg_safely query $current_token
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if not __fish_seen_argument -w v -w ve -w va
|
|
|
|
echo -e '/v\tDelete a specific entry under the subkey
|
2021-11-25 09:37:38 +00:00
|
|
|
/ve\tSpecify that only entries that have no value will be deleted
|
|
|
|
/va\tDelete all entries under the specified subkey'
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/f\tDelete the existing registry subkey or entry without asking for confirmation
|
2021-11-25 12:39:33 +00:00
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-11-27 13:26:25 +00:00
|
|
|
function __reg_export_complete_args -a previous_token
|
|
|
|
if test "$previous_token" = export
|
|
|
|
set -l current_token (commandline -tc)
|
|
|
|
__reg_run_reg_safely query $current_token
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/y\tOverwrite any existing file with the name filename without prompting for confirmation
|
2021-12-15 22:03:02 +00:00
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-01-24 10:10:56 +00:00
|
|
|
function __reg_query_complete_args -a previous_token
|
2022-11-27 13:26:25 +00:00
|
|
|
if test "$previous_token" = query
|
|
|
|
set -l current_token (commandline -tc)
|
|
|
|
__reg_run_reg_safely query $current_token
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if test "$previous_token" = /t
|
|
|
|
echo 'REG_SZ
|
2021-11-25 12:39:33 +00:00
|
|
|
REG_MULTI_SZ
|
|
|
|
REG_EXPAND_SZ
|
|
|
|
REG_DWORD
|
|
|
|
REG_BINARY
|
|
|
|
REG_NONE'
|
2022-01-27 06:02:23 +00:00
|
|
|
return
|
|
|
|
end
|
2021-11-25 12:39:33 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if not __fish_seen_argument -w v -w ve
|
|
|
|
echo -e '/v\tSpecify the registry value name
|
2021-11-25 09:37:38 +00:00
|
|
|
/ve\tRun a query for value names that are empty'
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
if not __fish_seen_argument -w k -w d
|
|
|
|
echo -e '/k\tSpecify to search in key names only
|
2021-11-25 09:37:38 +00:00
|
|
|
/d\tSpecify to search in data only'
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/se\tSpecify the single value separator
|
2021-11-25 09:37:38 +00:00
|
|
|
/f\tSpecify the data or pattern to search for
|
|
|
|
/c\tSpecify that the query is case sensitive
|
|
|
|
/e\tSpecify to return only exact matches
|
|
|
|
/t\tSpecify registry types to search
|
2021-11-25 12:39:33 +00:00
|
|
|
/z\tSpecify to include the numeric equivalent for the registry type in search results
|
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-11-27 13:26:25 +00:00
|
|
|
function __reg_save_complete_args -a previous_token
|
|
|
|
if test "$previous_token" = save
|
|
|
|
set -l current_token (commandline -tc)
|
|
|
|
__reg_run_reg_safely query $current_token
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-01-27 06:02:23 +00:00
|
|
|
echo -e '/y\tOverwrite an existing file with the name filename without prompting for confirmation
|
2021-11-25 12:39:33 +00:00
|
|
|
/?\tShow help'
|
2021-11-26 05:24:42 +00:00
|
|
|
end
|
|
|
|
|
2022-01-24 10:10:56 +00:00
|
|
|
function __reg_complete_args -d 'Function to generate args'
|
2024-01-22 06:42:45 +00:00
|
|
|
set -l previous_token (commandline -xc)[-1]
|
2022-01-27 06:02:23 +00:00
|
|
|
|
|
|
|
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
|
2022-11-27 13:26:25 +00:00
|
|
|
__reg_delete_complete_args $previous_token
|
2022-01-27 06:02:23 +00:00
|
|
|
else if __fish_seen_subcommand_from export
|
2022-11-27 13:26:25 +00:00
|
|
|
__reg_export_complete_args $previous_token
|
2022-01-27 06:02:23 +00:00
|
|
|
else if __fish_seen_subcommand_from query
|
|
|
|
__reg_query_complete_args $previous_token
|
|
|
|
else if __fish_seen_subcommand_from save
|
2022-11-27 13:26:25 +00:00
|
|
|
__reg_save_complete_args $previous_token
|
2022-01-27 06:02:23 +00:00
|
|
|
end
|
2021-11-25 09:37:38 +00:00
|
|
|
end
|
|
|
|
|
2022-01-24 10:10:56 +00:00
|
|
|
complete -c reg -f -a '(__reg_complete_args)'
|
2022-01-24 10:43:28 +00:00
|
|
|
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a add \
|
|
|
|
-d 'Add a new subkey or entry'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a compare \
|
|
|
|
-d 'Compare specified registry subkeys or entries'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a copy \
|
|
|
|
-d 'Copy a registry entry'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a delete \
|
|
|
|
-d 'Delete a subkey or entries'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a export \
|
|
|
|
-d 'Copy the specified subkeys, entries, and values of the local computer into a file'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a import \
|
2024-05-16 16:49:52 +00:00
|
|
|
-d 'Copy contents of a file with registry data into the local registry'
|
2022-01-24 10:43:28 +00:00
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a load \
|
|
|
|
-d 'Write saved subkeys and entries into a different subkey in the registry'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a query \
|
|
|
|
-d 'Return a list of the next tier of subkeys and entries'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a restore \
|
|
|
|
-d 'Write saved subkeys and entries back'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a save \
|
|
|
|
-d 'Save a copy of specified subkeys, entries, and values of the registry in a specified file'
|
|
|
|
complete -c reg -f \
|
|
|
|
-n 'not __fish_seen_subcommand_from add compare copy delete export import load query restore save unload' -a unload \
|
|
|
|
-d 'Remove a section of the registry that was loaded using the reg load operation'
|