mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 09:29:17 +00:00
Merge pull request #244 from lelgenio/master
Improvements to fish completion
This commit is contained in:
@@ -19,16 +19,41 @@ function comp_opt -a "command"
|
|||||||
$argv[2..-1]
|
$argv[2..-1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function list_profiles
|
||||||
|
dotdrop profiles \
|
||||||
|
--grepable \
|
||||||
|
--no-banner \
|
||||||
|
2> /dev/null
|
||||||
|
end
|
||||||
|
|
||||||
|
function list_test_keys -a "test_arg"
|
||||||
|
# Return only dotdrop keys in which the src field matches a test(1) criteria
|
||||||
|
# ^⌣ ^ ← "Slide Time!!"
|
||||||
|
dotdrop files \
|
||||||
|
--grepable \
|
||||||
|
--no-banner \
|
||||||
|
2> /dev/null |
|
||||||
|
while read line
|
||||||
|
# Single use variable because fish's output capture may change soon
|
||||||
|
set -l dst (echo $line | cut -d, -f2 | cut -d: -f2 )
|
||||||
|
if test $test_arg "$dst"
|
||||||
|
echo $line
|
||||||
|
end
|
||||||
|
end |
|
||||||
|
cut -d, -f1
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# Complete subcommands
|
# Complete subcommands
|
||||||
#
|
#
|
||||||
comp_sub -a "install" -d "Install dotfiles"
|
comp_sub -k -a "profiles" -d "List available profiles"
|
||||||
comp_sub -a "import" -d "Import dotfiles into dotdrop"
|
comp_sub -k -a "detail" -d "List managed dotfiles details"
|
||||||
comp_sub -a "compare" -d "Compare your local dotfiles with managed dotfiles"
|
comp_sub -k -a "files" -d "List managed dotfiles"
|
||||||
comp_sub -a "update" -d "Update a managed dotfile"
|
comp_sub -k -a "remove" -d "Remove a managed dotfile"
|
||||||
comp_sub -a "remove" -d "Remove a managed dotfile"
|
comp_sub -k -a "update" -d "Update a managed dotfile"
|
||||||
comp_sub -a "files" -d "List managed dotfiles"
|
comp_sub -k -a "compare" -d "Compare your local dotfiles with managed dotfiles"
|
||||||
comp_sub -a "detail" -d "List managed dotfiles details"
|
comp_sub -k -a "import" -d "Import dotfiles into dotdrop"
|
||||||
comp_sub -a "profiles" -d "List available profiles"
|
comp_sub -k -a "install" -d "Install dotfiles"
|
||||||
|
|
||||||
# Lone options
|
# Lone options
|
||||||
#
|
#
|
||||||
@@ -98,7 +123,8 @@ comp_opt "files profiles"\
|
|||||||
#
|
#
|
||||||
comp_opt "install import compare update remove files detail"\
|
comp_opt "install import compare update remove files detail"\
|
||||||
-x -s p -l profile\
|
-x -s p -l profile\
|
||||||
-d "Specify the profile to use [default: "(uname -n)"]"
|
-d "Specify the profile to use [default: "(uname -n)"]"\
|
||||||
|
-a "(list_profiles)"
|
||||||
|
|
||||||
comp_opt "compare update"\
|
comp_opt "compare update"\
|
||||||
-x -s i -l ignore\
|
-x -s i -l ignore\
|
||||||
@@ -129,12 +155,15 @@ comp_opt "update"\
|
|||||||
comp_opt "remove"\
|
comp_opt "remove"\
|
||||||
-F
|
-F
|
||||||
|
|
||||||
# TODO: complete keys
|
comp_opt "install detail"\
|
||||||
comp_opt "install"\
|
-f\
|
||||||
-f
|
-d "File"\
|
||||||
|
-a "(list_test_keys -f)"
|
||||||
|
|
||||||
comp_opt "detail"\
|
comp_opt "install detail"\
|
||||||
-f
|
-f\
|
||||||
|
-d "Directory"\
|
||||||
|
-a "(list_test_keys -d)"
|
||||||
|
|
||||||
# dotdrop.sh
|
# dotdrop.sh
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user