-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path_dot
56 lines (53 loc) · 1.7 KB
/
_dot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#compdef dot_main
_dot() {
local context curcontext="$curcontext" state line cmds
cmds=(${(f)"$(dot_main -h |
sed -n '/^Commands:/,/^$/p' |
sed -e '1d;$d' |
cut -b3- |
sed -e 's/ */\:/'
)"})
_arguments -C \
'1: :->cmds' \
{-h,--help}'[Show help message.]: :' \
{-H,--help-all}'[Show manpage.]: :' \
{-c,--config}'[Specify the configuration to load]:specify configuration file:_files' \
'*::arg:->args' \
&& ret=0
case $state in
cmds)
_describe -t cmds "$DOT_COMMAND <commands> [<args>]" cmds \
&& ret=0
;;
args)
local subcmd=$line[1]
case $subcmd in
"clone"|"unlink")
_path_files && ret=0
;;
"pull")
_values "$DOT_COMMAND pull [--self]" \
'--self[Update $DOT_COMMAND framework from repository.]' \
'[Update the dotfiles directory by `git pull`.]' \
&& ret=0
;;
"add")
_arguments \
'*: :_path_files -X "$DOT_COMMAND add <file> [</path/to/the/file>]
Select the file to move to DOT_DIR (or an arbitrary path).
(And this command makes its symbolic link.)"' \
&& ret=0
;;
"set"|"update")
_values "$DOT_COMMAND (set | update) [options]"\
{-i,--ignore}'[No interaction mode(skip all conflicts).]' \
{-f,--force}'[Ignore conflicts and force make symbolic links.]' \
{-b,--backup}'[Ignore conflicts, make symbolic links and create its original backup.]' \
{-v,--verbose}'[Print verbose messages.]' \
&& ret=0
;;
esac
;;
esac
return ret
}