1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-12 04:49:00 +00:00

use namespacing for for function names

This commit is contained in:
lelgenio
2021-02-15 23:07:41 -03:00
parent 0684210367
commit 335424a3ec

View File

@@ -8,25 +8,25 @@ set commands\
# Aliases to avoid walls of text # Aliases to avoid walls of text
# #
function comp_sub function __fish_dotdrop_comp_sub
complete -f -c dotdrop\ complete -f -c dotdrop\
-n "not __fish_seen_subcommand_from $commands"\ -n "not __fish_seen_subcommand_from $commands"\
$argv $argv
end end
function comp_opt -a "command" function __fish_dotdrop_comp_opt -a "command"
complete -c dotdrop\ complete -c dotdrop\
-n "__fish_seen_subcommand_from $command"\ -n "__fish_seen_subcommand_from $command"\
$argv[2..-1] $argv[2..-1]
end end
function list_profiles function __fish_dotdrop_list_profiles
dotdrop profiles \ dotdrop profiles \
--grepable \ --grepable \
--no-banner \ --no-banner \
2> /dev/null 2> /dev/null
end end
function list_test_keys -a "test_arg" function __fish_dotdrop_list_test_keys -a "test_arg"
# Return only dotdrop keys in which the src field matches a test(1) criteria # Return only dotdrop keys in which the src field matches a test(1) criteria
# ^⌣ ^ ← "Slide Time!!" # ^⌣ ^ ← "Slide Time!!"
dotdrop files \ dotdrop files \
@@ -46,124 +46,129 @@ end
# Complete subcommands # Complete subcommands
# #
comp_sub -k -a "profiles" -d "List available profiles" __fish_dotdrop_comp_sub -k -a "profiles" -d "List available profiles"
comp_sub -k -a "detail" -d "List managed dotfiles details" __fish_dotdrop_comp_sub -k -a "detail" -d "List managed dotfiles details"
comp_sub -k -a "files" -d "List managed dotfiles" __fish_dotdrop_comp_sub -k -a "files" -d "List managed dotfiles"
comp_sub -k -a "remove" -d "Remove a managed dotfile" __fish_dotdrop_comp_sub -k -a "remove" -d "Remove a managed dotfile"
comp_sub -k -a "update" -d "Update a managed dotfile" __fish_dotdrop_comp_sub -k -a "update" -d "Update a managed dotfile"
comp_sub -k -a "compare" -d "Compare your local dotfiles with managed dotfiles" __fish_dotdrop_comp_sub -k -a "compare" -d "Compare your local dotfiles with managed dotfiles"
comp_sub -k -a "import" -d "Import dotfiles into dotdrop" __fish_dotdrop_comp_sub -k -a "import" -d "Import dotfiles into dotdrop"
comp_sub -k -a "install" -d "Install dotfiles" __fish_dotdrop_comp_sub -k -a "install" -d "Install dotfiles"
# Lone options # Lone options
# #
comp_sub -s h -l help __fish_dotdrop_comp_sub -s h -l help
comp_sub -s v -l version __fish_dotdrop_comp_sub -s v -l version
# Common options to all subcommands # Common options to all subcommands
# #
comp_opt "$commands"\ __fish_dotdrop_comp_opt "$commands"\
-s V -l Verbose\ -s V -l Verbose\
-d "Show version" -d "Show version"
comp_opt "$commands"\ __fish_dotdrop_comp_opt "$commands"\
-s b -l no-banner\ -s b -l no-banner\
-d "Do not display the banner" -d "Do not display the banner"
comp_opt "$commands"\ __fish_dotdrop_comp_opt "$commands"\
-rF -s c -l cfg\ -rF -s c -l cfg\
-d "Path to the config" -d "Path to the config"
# Subcommand specific options # Subcommand specific options
# #
comp_opt "install import update remove detail"\ __fish_dotdrop_comp_opt "install import update remove detail"\
-s f -l force\ -s f -l force\
-d "Do not ask user confirmation for anything" -d "Do not ask user confirmation for anything"
comp_opt "install import update remove"\ __fish_dotdrop_comp_opt "install import update remove"\
-s d -l dry\ -s d -l dry\
-d "Dry run" -d "Dry run"
comp_opt "update remove"\ __fish_dotdrop_comp_opt "update remove"\
-s k -l key\ -s k -l key\
-d "Treat <path> as a dotfile key" -d "Treat <path> as a dotfile key"
comp_opt "files"\ __fish_dotdrop_comp_opt "files"\
-s T -l template\ -s T -l template\
-d "Only template dotfiles" -d "Only template dotfiles"
comp_opt "install"\ __fish_dotdrop_comp_opt "install"\
-s t -l temp\ -s t -l temp\
-d "Install to a temporary directory for review" -d "Install to a temporary directory for review"
comp_opt "install"\ __fish_dotdrop_comp_opt "install"\
-s n -l nodiff\ -s n -l nodiff\
-d "Do not diff when installing" -d "Do not diff when installing"
comp_opt "install"\ __fish_dotdrop_comp_opt "install"\
-s D -l showdiff\ -s D -l showdiff\
-d "Show a diff before overwriting" -d "Show a diff before overwriting"
comp_opt "install"\ __fish_dotdrop_comp_opt "install"\
-s a -l force-actions\ -s a -l force-actions\
-d "Execute all actions even if no dotfile is installed" -d "Execute all actions even if no dotfile is installed"
comp_opt "update"\ __fish_dotdrop_comp_opt "update"\
-s P -l show-patch\ -s P -l show-patch\
-d "Provide a one-liner to manually patch template" -d "Provide a one-liner to manually patch template"
comp_opt "files profiles"\ __fish_dotdrop_comp_opt "files profiles"\
-s G -l grepable\ -s G -l grepable\
-d "Grepable output" -d "Grepable output"
# Command specific options with parameters # Command specific options with parameters
# #
comp_opt "install import compare update remove files detail"\
-x -s p -l profile\
-d "Specify the profile to use [default: "(uname -n)"]"\
-a "(list_profiles)"
comp_opt "compare update"\ if test -z "$DOTDROP_PROFILE"
set -l DOTDROP_PROFILE (uname -n)
end
__fish_dotdrop_comp_opt "install import compare update remove files detail"\
-x -s p -l profile\
-d "Specify the profile to use [default: $DOTDROP_PROFILE]"\
-a "(__fish_dotdrop_list_profiles)"
__fish_dotdrop_comp_opt "compare update"\
-x -s i -l ignore\ -x -s i -l ignore\
-d "Pattern to ignore" -d "Pattern to ignore"
comp_opt "compare"\ __fish_dotdrop_comp_opt "compare"\
-rF -s C -l file\ -rF -s C -l file\
-d "Path of dotfile to compare" -d "Path of dotfile to compare"
comp_opt "import"\ __fish_dotdrop_comp_opt "import"\
-rf -s l -l link\ -rf -s l -l link\
-a "nolink link link_children"\ -a "nolink link link_children"\
-d "Link option" -d "Link option"
comp_opt "import"\ __fish_dotdrop_comp_opt "import"\
-rF -s s -l as\ -rF -s s -l as\
-d "Import as a different path from actual path" -d "Import as a different path from actual path"
# Subcommand arguments # Subcommand arguments
# #
comp_opt "import"\ __fish_dotdrop_comp_opt "import"\
-rF -rF
comp_opt "update"\ __fish_dotdrop_comp_opt "update"\
-F -F
comp_opt "remove"\ __fish_dotdrop_comp_opt "remove"\
-F -F
comp_opt "install detail"\ __fish_dotdrop_comp_opt "install detail"\
-f\ -f\
-d "File"\ -d "File"\
-a "(list_test_keys -f)" -a "(__fish_dotdrop_list_test_keys -f)"
comp_opt "install detail"\ __fish_dotdrop_comp_opt "install detail"\
-f\ -f\
-d "Directory"\ -d "Directory"\
-a "(list_test_keys -d)" -a "(__fish_dotdrop_list_test_keys -d)"
# dotdrop.sh # dotdrop.sh
# #