-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
49 lines (43 loc) · 1 KB
/
main.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
package main
import (
"fmt"
"github.com/Scarsz/bincli/cmd"
"github.com/spf13/cobra"
)
func main() {
rootCmd := &cobra.Command{Use: "bincli"}
cmdInfo := &cobra.Command{
Use: "info <bin>",
Short: "Get information about a bin",
Args: cobra.MinimumNArgs(1),
Run: cmd.Info,
}
cmdPurge := &cobra.Command{
Use: "purge",
Short: "Clear temporary folder of downloaded bins",
Run: cmd.Purge,
}
cmdGet := &cobra.Command{
Use: "get <bin>",
Short: "Download a bin",
Long: "Download a bin from the given URL",
Args: cobra.MinimumNArgs(1),
Run: cmd.Get,
}
cmdPost := &cobra.Command{
Use: "post <file>...",
Short: "Create a new bin from the given files",
Args: cobra.MinimumNArgs(1),
Run: cmd.Post,
}
cmdPaste := &cobra.Command{
Use: "paste <text>",
Short: "Create a new bin with the given text or piped input",
Run: cmd.Paste,
}
rootCmd.AddCommand(cmdInfo, cmdPurge, cmdGet, cmdPost, cmdPaste)
err := rootCmd.Execute()
if err != nil {
fmt.Println(err)
}
}