-
Notifications
You must be signed in to change notification settings - Fork 26
/
app.go
48 lines (42 loc) · 996 Bytes
/
app.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
package main
import (
"fmt"
"os"
"github.com/urfave/cli/v2"
"github.com/yitsushi/totp-cli/internal/cmd"
"github.com/yitsushi/totp-cli/internal/info"
)
func newApplication() *cli.App {
stdErr := os.Stderr
return &cli.App{
Name: info.Name,
HelpName: "totp-cli",
Usage: "Authy/Google Authenticator like TOTP CLI tool written in Go.",
Version: info.Version,
Commands: []*cli.Command{
cmd.AddTokenCommand(),
cmd.ChangePasswordCommand(),
cmd.DeleteCommand(),
cmd.DumpCommand(),
cmd.GenerateCommand(),
cmd.ImportCommand(),
cmd.InstantCommand(),
cmd.ListCommand(),
cmd.SetPrefixCommand(),
cmd.SetLengthCommand(),
cmd.RenameCommand(),
},
Authors: []*cli.Author{
{Name: "Efertone", Email: "efertone@pm.me"},
},
EnableBashCompletion: true,
ExitErrHandler: func(ctx *cli.Context, err error) {
if err == nil {
return
}
_, _ = fmt.Fprintf(stdErr, " !!! %s\n", err)
_ = cli.ShowAppHelp(ctx)
},
Suggest: true,
}
}