Distribute code into several functions for reg

This commit is contained in:
EmilySeville7cfg 2021-11-26 15:24:42 +10:00 committed by ridiculousfish
parent ee74ebd314
commit 5f1384c6c3

View file

@ -1,22 +1,4 @@
function __reg_generate_args --description 'Function to generate args' function __reg_add_generate_args --argument-names previous_token
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 to the registry
compare\tCompare specified registry subkeys or entries
copy\tCopy a registry entry to a specified location on the local or remote computer
delete\tDelete a subkey or entries from the registry
export\tCopy the specified subkeys, entries, and values of the local computer into a file
import\tCopy the contents of a file that contains registry data into the registry of the local computer
load\tWrite saved subkeys and entries into a different subkey in the registry
query\tReturn a list of the next tier of subkeys and entries
restore\tWrite saved subkeys and entries back to the registry
save\tSave a copy of specified subkeys, entries, and values of the registry in a specified file
unload\tRemove a section of the registry that was loaded using the reg load operation'
return
end
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
if __fish_seen_subcommand_from add
if test "$previous_token" = '/t' if test "$previous_token" = '/t'
echo 'REG_SZ echo 'REG_SZ
REG_MULTI_SZ REG_MULTI_SZ
@ -40,7 +22,9 @@ REG_EXPAND_SZ'
/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
/?\tShow help' /?\tShow help'
else if __fish_seen_subcommand_from compare end
function __reg_compare_generate_args --argument-names previous_token
if not __fish_seen_argument --windows 'v' --windows 've' if not __fish_seen_argument --windows 'v' --windows 've'
echo -e '/v\tSpecify the value name to compare under the subkey echo -e '/v\tSpecify the value name to compare under the subkey
/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'
@ -55,11 +39,15 @@ REG_EXPAND_SZ'
echo -e '/s\tSpecify the type for the registry entry echo -e '/s\tSpecify the type for the registry entry
/?\tShow help' /?\tShow help'
else if __fish_seen_subcommand_from copy end
function __reg_copy_generate_args --argument-names previous_token
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'
else if __fish_seen_subcommand_from delete end
function __reg_delete_generate_args --argument-names previous_token
if not __fish_seen_argument --windows 'v' --windows 've' --windows 'va' if not __fish_seen_argument --windows 'v' --windows 've' --windows '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
@ -68,10 +56,14 @@ REG_EXPAND_SZ'
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'
else if __fish_seen_subcommand_from export end
function __reg_export_generate_args --argument-names previous_token
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'
else if __fish_seen_subcommand_from query end
function __reg_query_generate_args --argument-names previous_token
if test "$previous_token" = '/t' if test "$previous_token" = '/t'
echo 'REG_SZ echo 'REG_SZ
REG_MULTI_SZ REG_MULTI_SZ
@ -99,10 +91,46 @@ REG_NONE'
/t\tSpecify registry types to search /t\tSpecify registry types to search
/z\tSpecify to include the numeric equivalent for the registry type in search results /z\tSpecify to include the numeric equivalent for the registry type in search results
/?\tShow help' /?\tShow help'
else if __fish_seen_subcommand_from save end
function __reg_save_generate_args --argument-names previous_token
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_generate_args --description '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 to the registry
compare\tCompare specified registry subkeys or entries
copy\tCopy a registry entry to a specified location on the local or remote computer
delete\tDelete a subkey or entries from the registry
export\tCopy the specified subkeys, entries, and values of the local computer into a file
import\tCopy the contents of a file that contains registry data into the registry of the local computer
load\tWrite saved subkeys and entries into a different subkey in the registry
query\tReturn a list of the next tier of subkeys and entries
restore\tWrite saved subkeys and entries back to the registry
save\tSave a copy of specified subkeys, entries, and values of the registry in a specified file
unload\tRemove a section of the registry that was loaded using the reg load operation'
return
end
set --local previous_token (commandline --tokenize --cut-at-cursor)[-1]
if __fish_seen_subcommand_from add
__reg_add_generate_args
else if __fish_seen_subcommand_from compare
__reg_compare_generate_args
else if __fish_seen_subcommand_from copy
__reg_copy_generate_args
else if __fish_seen_subcommand_from delete
__reg_delete_generate_args
else if __fish_seen_subcommand_from export
__reg_export_generate_args
else if __fish_seen_subcommand_from query
__reg_query_generate_args
else if __fish_seen_subcommand_from save
__reg_save_generate_args
end
end end
complete --command reg --no-files --arguments '(__reg_generate_args)' complete --command reg --no-files --arguments '(__reg_generate_args)'