-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_baup
More file actions
135 lines (114 loc) · 3.34 KB
/
Copy path_baup
File metadata and controls
135 lines (114 loc) · 3.34 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#compdef _baup baup
_baup() {
local line state
_arguments -C \
"1: :->cmds" \
"*::arg:->args"
case "$state" in
cmds)
_values "baup command" \
"import[Imports the config files to the backup directory]" \
"export[Exports the config files from the backup directory]" \
"git[Calls the git command]" \
"edit[Opens the file in which you specify the import/export paths and names]" \
"diff[Compares the files in the backup directory with the original files]" \
"clear[Deletes files in the backups folder]" \
"help[Prints this message or the help of the given subcommand(s)]" \
"-h[Prints help]" \
"--help[Prints help]" \
"-V[Prints version]" \
"--version[Prints version]" \
;;
args)
case $line[1] in
import)
_baup_import
;;
export)
_baup_export
;;
git)
_baup_git
;;
edit)
_baup_edit
;;
diff)
_baup_diff
;;
clear)
_baup_clear
;;
help)
_baup_help
;;
edit)
esac
;;
esac
}
_baup_import() {
_arguments -s \
{-p,--partial}'[Imports only one part of the files]' \
{-c,--auto-commit}'[Automatically creates a commit with the name of the files that have changes]' \
{-z,--zip}'[Creates a zip file with all the files after backing them up]' \
{-h,--help}'[Print help]' \
}
_baup_export() {
_arguments -s \
{-p,--partial}'[Exports only one part of the files]' \
{-h,--help}'[Print help]' \
}
_baup_clear() {
_arguments -s \
{-p,--partial}'[Deletes only one part of the files]' \
{-h,--help}'[Print help]' \
}
_baup_git() {
local line state
_arguments -C \
"1: :->cmds" \
case "$state" in
cmds)
_values "baup command" \
"checkout[ Checkout branch or paths to working tree]" \
"clone[ Clone repository into new directory]" \
"commit[ Record changes to repository]" \
"diff[ Show changes between commits, commit and working tree, etc.]" \
"init[ Create empty git repository or re-initialize an existing one]" \
"log[ Information about files in idex/working directory]" \
"merge[ Join two or more development histories together]" \
"pull[ Fetch from and merge with another repository or local branch]" \
"push[ Update remote refs along with associated objetcs]" \
"rebase[ Forward-port local commits to the updated upstream head]" \
"remote[ Manage set of tracked repositories]" \
"status[ Show working-tree status]" \
;;
esac
}
_baup_general() {
_arguments -s \
{-h,--help}'[Print help]' \
}
_baup_edit() {
_arguments -s \
{-c,--config}'[Open config file instead of backups file]' \
{-h,--help}'[Print help]' \
}
_baup_diff() {
_arguments -s \
{-p,--partial}'[Diffs only one part of the files]' \
{-h,--help}'[Print help]' \
}
_baup_help() {
_values "help command" \
"import[Import command help]" \
"export[Export command help]" \
"commit[Commit command help]" \
"push[Push command help]" \
"pull[Pull command help]" \
"edit[Edit command help]" \
"diff[Diff command help]" \
"clear[Clear command help]" \
"help[Help command help]" \
}