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: " []", } 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: " ", } var appConfigCommand = &cli.Command{ Name: "config", } var appLogsCommand = &cli.Command{ Name: "logs", ArgsUsage: "[]", } 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: " ...", } var appRollbackCommand = &cli.Command{ Name: "rollback", ArgsUsage: "[]", } // 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, }, }