/
help.go
122 lines (96 loc) · 3.55 KB
/
help.go
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
package cmd
import (
"errors"
"flag"
"fmt"
"os"
"github.com/vim-volt/volt/logger"
)
// ErrShowedHelp is used in parsing argument function of subcommand when the
// subcommand showed help. Then caller can exit successfully and silently.
var ErrShowedHelp = errors.New("already showed help")
func init() {
cmdMap["help"] = &helpCmd{}
}
type helpCmd struct{}
func (cmd *helpCmd) ProhibitRootExecution(args []string) bool { return false }
func (cmd *helpCmd) FlagSet() *flag.FlagSet {
fs := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
fs.SetOutput(os.Stdout)
fs.Usage = func() {
fmt.Print(
" .----------------. .----------------. .----------------. .----------------.\n" +
"| .--------------. || .--------------. || .--------------. || .--------------. |\n" +
"| | ____ ____ | || | ____ | || | _____ | || | _________ | |\n" +
"| ||_ _| |_ _| | || | .' `. | || | |_ _| | || | | _ _ | | |\n" +
"| | \\ \\ / / | || | / .--. \\ | || | | | | || | |_/ | | \\_| | |\n" +
"| | \\ \\ / / | || | | | | | | || | | | _ | || | | | | |\n" +
"| | \\ ' / | || | \\ `--' / | || | _| |__/ | | || | _| |_ | |\n" +
"| | \\_/ | || | `.____.' | || | |________| | || | |_____| | |\n" +
"| | | || | | || | | || | | |\n" +
"| '--------------' || '--------------' || '--------------' || '--------------' |\n" +
" '----------------' '----------------' '----------------' '----------------'\n" +
`
Usage
volt COMMAND ARGS
Command
get [-l] [-u] [{repository} ...]
Install or upgrade given {repository} list, or add local {repository} list as plugins
rm [-r] [-p] {repository} [{repository2} ...]
Remove vim plugin from ~/.vim/pack/volt/opt/ directory
list [-f {text/template string}]
Vim plugin information extractor.
Unless -f flag was given, this command shows vim plugins of **current profile** (not all installed plugins) by default.
enable {repository} [{repository2} ...]
This is shortcut of:
volt profile add -current {repository} [{repository2} ...]
disable {repository} [{repository2} ...]
This is shortcut of:
volt profile rm -current {repository} [{repository2} ...]
profile set {name}
Set profile name
profile show {name}
Show profile info
profile list
List all profiles
profile new {name}
Create new profile
profile destroy {name}
Delete profile
profile rename {old} {new}
Rename profile {old} to {new}
profile add {name} {repository} [{repository2} ...]
Add one or more repositories to profile
profile rm {name} {repository} [{repository2} ...]
Remove one or more repositories to profile
build [-full]
Build ~/.vim/pack/volt/ directory
migrate {migration operation}
Perform miscellaneous migration operations.
See 'volt migrate -help' for all available operations
self-upgrade [-check]
Upgrade to the latest volt command, or if -check was given, it only checks the newer version is available
version
Show volt command version` + "\n\n")
//cmd.helped = true
}
return fs
}
func (cmd *helpCmd) Run(args []string) int {
if len(args) == 0 {
cmd.FlagSet().Usage()
return 0
}
if args[0] == "help" { // "volt help help"
fmt.Println("E478: Don't panic!")
return 0
}
fs, exists := cmdMap[args[0]]
if !exists {
logger.Errorf("Unknown command '%s'", args[0])
return 1
}
args = append([]string{"-help"}, args[1:]...)
fs.Run(args)
return 0
}