127 lines
2.3 KiB
Go
127 lines
2.3 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/schultz-is/passgen"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var appNewCommand = &cli.Command{
|
|
Name: "new",
|
|
Flags: []cli.Flag{
|
|
ServerFlag,
|
|
DomainFlag,
|
|
AppNameFlag,
|
|
PassFlag,
|
|
SecretsFlag,
|
|
},
|
|
}
|
|
var appDeployCommand = &cli.Command{
|
|
Name: "deploy",
|
|
Flags: []cli.Flag{
|
|
UpdateFlag,
|
|
ForceFlag,
|
|
SkipVersionCheckFlag,
|
|
NoDomainPollFlag,
|
|
},
|
|
}
|
|
var appUndeployCommand = &cli.Command{
|
|
Name: "undeploy",
|
|
}
|
|
var appBackupCommand = &cli.Command{
|
|
Name: "backup",
|
|
Flags: []cli.Flag{AllFlag},
|
|
}
|
|
var appRestoreCommand = &cli.Command{
|
|
Name: "restore",
|
|
Flags: []cli.Flag{AllFlag},
|
|
ArgsUsage: "<service> [<backup file>]",
|
|
}
|
|
var appListCommand = &cli.Command{
|
|
Name: "list",
|
|
Aliases: []string{"ls"},
|
|
Flags: []cli.Flag{StatusFlag, ServerFlag, TypeFlag},
|
|
}
|
|
var appCheckCommand = &cli.Command{
|
|
Name: "check",
|
|
}
|
|
var appCpCommand = &cli.Command{
|
|
Name: "cp",
|
|
ArgsUsage: "<src> <dst>",
|
|
}
|
|
var appConfigCommand = &cli.Command{
|
|
Name: "config",
|
|
}
|
|
var appLogsCommand = &cli.Command{
|
|
Name: "logs",
|
|
ArgsUsage: "[<service>]",
|
|
}
|
|
|
|
var appPsCommand = &cli.Command{
|
|
Name: "ps",
|
|
}
|
|
var appRemoveCommand = &cli.Command{
|
|
Name: "remove",
|
|
Flags: []cli.Flag{VolumesFlag, SecretsFlag},
|
|
}
|
|
var appRunCommand = &cli.Command{
|
|
Name: "run",
|
|
Flags: []cli.Flag{
|
|
NoTTYFlag,
|
|
UserFlag,
|
|
},
|
|
ArgsUsage: "<service> <args>...",
|
|
}
|
|
|
|
var appRollbackCommand = &cli.Command{
|
|
Name: "rollback",
|
|
ArgsUsage: "[<version>]",
|
|
}
|
|
|
|
// TODO: Replicating what the bash abra does might be hard
|
|
// with the mix of subcommands and flags
|
|
var appSecretCommand = &cli.Command{
|
|
Name: "secret",
|
|
Flags: []cli.Flag{AllFlag, PassFlag},
|
|
Action: func(c *cli.Context) error {
|
|
passwords, err := passgen.GeneratePassphrases(
|
|
1,
|
|
passgen.PassphraseWordCountDefault,
|
|
rune('-'),
|
|
passgen.PassphraseCasingDefault,
|
|
passgen.WordListDefault,
|
|
)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
for _, password := range passwords {
|
|
fmt.Println(password)
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
|
|
var AppCommand = &cli.Command{
|
|
Name: "app",
|
|
HideHelp: true,
|
|
Subcommands: []*cli.Command{
|
|
appNewCommand,
|
|
appConfigCommand,
|
|
appDeployCommand,
|
|
appUndeployCommand,
|
|
appBackupCommand,
|
|
appRestoreCommand,
|
|
appRemoveCommand,
|
|
appCheckCommand,
|
|
appListCommand,
|
|
appPsCommand,
|
|
appLogsCommand,
|
|
appCpCommand,
|
|
appRunCommand,
|
|
appRollbackCommand,
|
|
appSecretCommand,
|
|
},
|
|
}
|