-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathroot.go
42 lines (35 loc) · 902 Bytes
/
root.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
// Package s3hub is the root command of s3hub.
package s3hub
import (
"os"
"github.com/spf13/cobra"
)
// Execute starts the root command of s3hub.
func Execute() error {
if len(os.Args) == 1 {
return interactive()
}
return newRootCmd().Execute()
}
// newRootCmd returns a root command for s3hub.
func newRootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "s3hub",
Long: `s3hub is user-friendly S3 buckets management tool.
If you want to use interactive mode, run s3hub without any arguments.`,
}
cmd.CompletionOptions.DisableDefaultCmd = true
cmd.SilenceUsage = true
cmd.SilenceErrors = true
cmd.DisableFlagParsing = true
cmd.AddCommand(newVersionCmd())
cmd.AddCommand(newMbCmd())
cmd.AddCommand(newLsCmd())
cmd.AddCommand(newRmCmd())
cmd.AddCommand(newCpCmd())
return cmd
}
// commandName returns the s3hub command name.
func commandName() string {
return "s3hub"
}