mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-02 00:11:56 +03:00
Use custom cli classes
This commit is contained in:
@@ -6,7 +6,12 @@ import (
|
||||
"github.com/9seconds/mtg/v2/mtglib"
|
||||
)
|
||||
|
||||
func runGenerateSecret(cli *CLI) {
|
||||
type cliCommandGenerateSecret struct {
|
||||
HostName string `arg optional help:"Hostname to use for domain fronting. Default is '${domain_front}'." name:"hostname" default:"${domain_front}"` // nolint: lll, govet
|
||||
Hex bool `help:"Print secret in hex encoding."`
|
||||
}
|
||||
|
||||
func (c *cliCommandGenerateSecret) Run(cli *CLI) error { // nolint: unparam
|
||||
secret := mtglib.GenerateSecret(cli.GenerateSecret.HostName)
|
||||
|
||||
if cli.GenerateSecret.Hex {
|
||||
@@ -14,4 +19,6 @@ func runGenerateSecret(cli *CLI) {
|
||||
} else {
|
||||
fmt.Println(secret.Base64()) // nolint: forbidigo
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user