diff --git a/docs/cli-reference/ark.md b/docs/cli-reference/ark.md index 5f5f12185..fe1e05db4 100644 --- a/docs/cli-reference/ark.md +++ b/docs/cli-reference/ark.md @@ -5,10 +5,13 @@ Back up and restore Kubernetes cluster resources. ### Synopsis -Heptio Ark is a tool for managing disaster recovery, specifically for -Kubernetes cluster resources. It provides a simple, configurable, -and operationally robust way to back up your application state and -associated data. +Heptio Ark is a tool for managing disaster recovery, specifically for Kubernetes +cluster resources. It provides a simple, configurable, and operationally robust +way to back up your application state and associated data. + +If you're familiar with kubectl, Ark supports a similar model, allowing you to +execute commands such as 'ark get backup' and 'ark create schedule'. The same +operations can also be performed as 'ark backup get' and 'ark schedule create'. ### Options @@ -26,6 +29,8 @@ associated data. ### SEE ALSO * [ark backup](ark_backup.md) - Work with backups +* [ark create](ark_create.md) - Create ark resources +* [ark get](ark_get.md) - Get ark resources * [ark restore](ark_restore.md) - Work with restores * [ark schedule](ark_schedule.md) - Work with schedules * [ark server](ark_server.md) - Run the ark server diff --git a/docs/cli-reference/ark_create.md b/docs/cli-reference/ark_create.md new file mode 100644 index 000000000..34d37dcde --- /dev/null +++ b/docs/cli-reference/ark_create.md @@ -0,0 +1,34 @@ +## ark create + +Create ark resources + +### Synopsis + + +Create ark resources + +### Options + +``` + -h, --help help for create +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark](ark.md) - Back up and restore Kubernetes cluster resources. +* [ark create backup](ark_create_backup.md) - Create a backup +* [ark create restore](ark_create_restore.md) - Create a restore +* [ark create schedule](ark_create_schedule.md) - Create a schedule + diff --git a/docs/cli-reference/ark_create_backup.md b/docs/cli-reference/ark_create_backup.md new file mode 100644 index 000000000..592be219a --- /dev/null +++ b/docs/cli-reference/ark_create_backup.md @@ -0,0 +1,47 @@ +## ark create backup + +Create a backup + +### Synopsis + + +Create a backup + +``` +ark create backup NAME [flags] +``` + +### Options + +``` + --exclude-namespaces stringArray namespaces to exclude from the backup + --exclude-resources stringArray resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io + -h, --help help for backup + --include-cluster-resources optionalBool[=true] include cluster-scoped resources in the backup + --include-namespaces stringArray namespaces to include in the backup (use '*' for all namespaces) (default *) + --include-resources stringArray resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources) + --label-columns stringArray a comma-separated list of labels to be displayed as columns + --labels mapStringString labels to apply to the backup + -o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. + -l, --selector labelSelector only back up resources matching this label selector (default ) + --show-labels show labels in the last column + --snapshot-volumes optionalBool[=true] take snapshots of PersistentVolumes as part of the backup + --ttl duration how long before the backup can be garbage collected (default 24h0m0s) +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark create](ark_create.md) - Create ark resources + diff --git a/docs/cli-reference/ark_create_restore.md b/docs/cli-reference/ark_create_restore.md new file mode 100644 index 000000000..b0422c175 --- /dev/null +++ b/docs/cli-reference/ark_create_restore.md @@ -0,0 +1,46 @@ +## ark create restore + +Create a restore + +### Synopsis + + +Create a restore + +``` +ark create restore BACKUP [flags] +``` + +### Options + +``` + --exclude-namespaces stringArray namespaces to exclude from the restore + --exclude-resources stringArray resources to exclude from the restore, formatted as resource.group, such as storageclasses.storage.k8s.io + -h, --help help for restore + --include-namespaces stringArray namespaces to include in the restore (use '*' for all namespaces) (default *) + --include-resources stringArray resources to include in the restore, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources) + --label-columns stringArray a comma-separated list of labels to be displayed as columns + --labels mapStringString labels to apply to the restore + --namespace-mappings mapStringString namespace mappings from name in the backup to desired restored name in the form src1:dst1,src2:dst2,... + -o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. + --restore-volumes optionalBool[=true] whether to restore volumes from snapshots + -l, --selector labelSelector only restore resources matching this label selector (default ) + --show-labels show labels in the last column +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark create](ark_create.md) - Create ark resources + diff --git a/docs/cli-reference/ark_create_schedule.md b/docs/cli-reference/ark_create_schedule.md new file mode 100644 index 000000000..f9911e334 --- /dev/null +++ b/docs/cli-reference/ark_create_schedule.md @@ -0,0 +1,48 @@ +## ark create schedule + +Create a schedule + +### Synopsis + + +Create a schedule + +``` +ark create schedule NAME [flags] +``` + +### Options + +``` + --exclude-namespaces stringArray namespaces to exclude from the backup + --exclude-resources stringArray resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io + -h, --help help for schedule + --include-cluster-resources optionalBool[=true] include cluster-scoped resources in the backup + --include-namespaces stringArray namespaces to include in the backup (use '*' for all namespaces) (default *) + --include-resources stringArray resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources) + --label-columns stringArray a comma-separated list of labels to be displayed as columns + --labels mapStringString labels to apply to the backup + -o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. + --schedule string a cron expression specifying a recurring schedule for this backup to run + -l, --selector labelSelector only back up resources matching this label selector (default ) + --show-labels show labels in the last column + --snapshot-volumes optionalBool[=true] take snapshots of PersistentVolumes as part of the backup + --ttl duration how long before the backup can be garbage collected (default 24h0m0s) +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark create](ark_create.md) - Create ark resources + diff --git a/docs/cli-reference/ark_get.md b/docs/cli-reference/ark_get.md new file mode 100644 index 000000000..949a84231 --- /dev/null +++ b/docs/cli-reference/ark_get.md @@ -0,0 +1,34 @@ +## ark get + +Get ark resources + +### Synopsis + + +Get ark resources + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark](ark.md) - Back up and restore Kubernetes cluster resources. +* [ark get backups](ark_get_backups.md) - Get backups +* [ark get restores](ark_get_restores.md) - Get restores +* [ark get schedules](ark_get_schedules.md) - Get schedules + diff --git a/docs/cli-reference/ark_get_backups.md b/docs/cli-reference/ark_get_backups.md new file mode 100644 index 000000000..7ffa1b493 --- /dev/null +++ b/docs/cli-reference/ark_get_backups.md @@ -0,0 +1,39 @@ +## ark get backups + +Get backups + +### Synopsis + + +Get backups + +``` +ark get backups [flags] +``` + +### Options + +``` + -h, --help help for backups + --label-columns stringArray a comma-separated list of labels to be displayed as columns + -o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. (default "table") + -l, --selector string only show items matching this label selector + --show-labels show labels in the last column +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark get](ark_get.md) - Get ark resources + diff --git a/docs/cli-reference/ark_get_restores.md b/docs/cli-reference/ark_get_restores.md new file mode 100644 index 000000000..ff615a2a1 --- /dev/null +++ b/docs/cli-reference/ark_get_restores.md @@ -0,0 +1,39 @@ +## ark get restores + +Get restores + +### Synopsis + + +Get restores + +``` +ark get restores [flags] +``` + +### Options + +``` + -h, --help help for restores + --label-columns stringArray a comma-separated list of labels to be displayed as columns + -o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. (default "table") + -l, --selector string only show items matching this label selector + --show-labels show labels in the last column +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark get](ark_get.md) - Get ark resources + diff --git a/docs/cli-reference/ark_get_schedules.md b/docs/cli-reference/ark_get_schedules.md new file mode 100644 index 000000000..7329b897d --- /dev/null +++ b/docs/cli-reference/ark_get_schedules.md @@ -0,0 +1,39 @@ +## ark get schedules + +Get schedules + +### Synopsis + + +Get schedules + +``` +ark get schedules [flags] +``` + +### Options + +``` + -h, --help help for schedules + --label-columns stringArray a comma-separated list of labels to be displayed as columns + -o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. (default "table") + -l, --selector string only show items matching this label selector + --show-labels show labels in the last column +``` + +### Options inherited from parent commands + +``` + --alsologtostderr log to standard error as well as files + --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) + --log_dir string If non-empty, write log files in this directory + --logtostderr log to standard error instead of files + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) + -v, --v Level log level for V logs + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging +``` + +### SEE ALSO +* [ark get](ark_get.md) - Get ark resources + diff --git a/docs/cli-reference/ark_restore.md b/docs/cli-reference/ark_restore.md index 5d68f202a..4b8b6ea3c 100644 --- a/docs/cli-reference/ark_restore.md +++ b/docs/cli-reference/ark_restore.md @@ -30,6 +30,6 @@ Work with restores * [ark](ark.md) - Back up and restore Kubernetes cluster resources. * [ark restore create](ark_restore_create.md) - Create a restore * [ark restore delete](ark_restore_delete.md) - Delete a restore -* [ark restore get](ark_restore_get.md) - get restores +* [ark restore get](ark_restore_get.md) - Get restores * [ark restore logs](ark_restore_logs.md) - Get restore logs diff --git a/docs/cli-reference/ark_restore_get.md b/docs/cli-reference/ark_restore_get.md index 987cc803c..c4e3738cc 100644 --- a/docs/cli-reference/ark_restore_get.md +++ b/docs/cli-reference/ark_restore_get.md @@ -1,11 +1,11 @@ ## ark restore get -get restores +Get restores ### Synopsis -get restores +Get restores ``` ark restore get [flags] diff --git a/pkg/cmd/ark/ark.go b/pkg/cmd/ark/ark.go index 26a7e0707..984b4f2a5 100644 --- a/pkg/cmd/ark/ark.go +++ b/pkg/cmd/ark/ark.go @@ -23,6 +23,8 @@ import ( "github.com/heptio/ark/pkg/client" "github.com/heptio/ark/pkg/cmd/cli/backup" + "github.com/heptio/ark/pkg/cmd/cli/create" + "github.com/heptio/ark/pkg/cmd/cli/get" "github.com/heptio/ark/pkg/cmd/cli/restore" "github.com/heptio/ark/pkg/cmd/cli/schedule" "github.com/heptio/ark/pkg/cmd/server" @@ -33,10 +35,13 @@ func NewCommand(name string) *cobra.Command { c := &cobra.Command{ Use: name, Short: "Back up and restore Kubernetes cluster resources.", - Long: `Heptio Ark is a tool for managing disaster recovery, specifically for -Kubernetes cluster resources. It provides a simple, configurable, -and operationally robust way to back up your application state and -associated data.`, + Long: `Heptio Ark is a tool for managing disaster recovery, specifically for Kubernetes +cluster resources. It provides a simple, configurable, and operationally robust +way to back up your application state and associated data. + +If you're familiar with kubectl, Ark supports a similar model, allowing you to +execute commands such as 'ark get backup' and 'ark create schedule'. The same +operations can also be performed as 'ark backup get' and 'ark schedule create'.`, } f := client.NewFactory(name) @@ -48,6 +53,8 @@ associated data.`, restore.NewCommand(f), server.NewCommand(), version.NewCommand(), + get.NewCommand(f), + create.NewCommand(f), ) // add the glog flags diff --git a/pkg/cmd/cli/backup/backup.go b/pkg/cmd/cli/backup/backup.go index 63db36a3e..3167c9924 100644 --- a/pkg/cmd/cli/backup/backup.go +++ b/pkg/cmd/cli/backup/backup.go @@ -30,8 +30,8 @@ func NewCommand(f client.Factory) *cobra.Command { } c.AddCommand( - NewCreateCommand(f), - NewGetCommand(f), + NewCreateCommand(f, "create"), + NewGetCommand(f, "get"), NewLogsCommand(f), NewDownloadCommand(f), diff --git a/pkg/cmd/cli/backup/create.go b/pkg/cmd/cli/backup/create.go index 77de7d0d1..25933d64b 100644 --- a/pkg/cmd/cli/backup/create.go +++ b/pkg/cmd/cli/backup/create.go @@ -33,11 +33,11 @@ import ( "github.com/heptio/ark/pkg/cmd/util/output" ) -func NewCreateCommand(f client.Factory) *cobra.Command { +func NewCreateCommand(f client.Factory, use string) *cobra.Command { o := NewCreateOptions() c := &cobra.Command{ - Use: "create NAME", + Use: use + " NAME", Short: "Create a backup", Run: func(c *cobra.Command, args []string) { cmd.CheckError(o.Validate(c, args)) diff --git a/pkg/cmd/cli/backup/get.go b/pkg/cmd/cli/backup/get.go index 0d0d35c62..ba1c8e6fc 100644 --- a/pkg/cmd/cli/backup/get.go +++ b/pkg/cmd/cli/backup/get.go @@ -27,11 +27,11 @@ import ( "github.com/heptio/ark/pkg/cmd/util/output" ) -func NewGetCommand(f client.Factory) *cobra.Command { +func NewGetCommand(f client.Factory, use string) *cobra.Command { var listOptions metav1.ListOptions c := &cobra.Command{ - Use: "get", + Use: use, Short: "Get backups", Run: func(c *cobra.Command, args []string) { err := output.ValidateFlags(c) diff --git a/pkg/cmd/cli/create/create.go b/pkg/cmd/cli/create/create.go new file mode 100644 index 000000000..a7c9a2715 --- /dev/null +++ b/pkg/cmd/cli/create/create.go @@ -0,0 +1,42 @@ +/* +Copyright 2017 Heptio Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package create + +import ( + "github.com/spf13/cobra" + + "github.com/heptio/ark/pkg/client" + "github.com/heptio/ark/pkg/cmd/cli/backup" + "github.com/heptio/ark/pkg/cmd/cli/restore" + "github.com/heptio/ark/pkg/cmd/cli/schedule" +) + +func NewCommand(f client.Factory) *cobra.Command { + c := &cobra.Command{ + Use: "create", + Short: "Create ark resources", + Long: "Create ark resources", + } + + c.AddCommand( + backup.NewCreateCommand(f, "backup"), + schedule.NewCreateCommand(f, "schedule"), + restore.NewCreateCommand(f, "restore"), + ) + + return c +} diff --git a/pkg/cmd/cli/get/get.go b/pkg/cmd/cli/get/get.go new file mode 100644 index 000000000..be832655c --- /dev/null +++ b/pkg/cmd/cli/get/get.go @@ -0,0 +1,51 @@ +/* +Copyright 2017 Heptio Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package get + +import ( + "github.com/spf13/cobra" + + "github.com/heptio/ark/pkg/client" + "github.com/heptio/ark/pkg/cmd/cli/backup" + "github.com/heptio/ark/pkg/cmd/cli/restore" + "github.com/heptio/ark/pkg/cmd/cli/schedule" +) + +func NewCommand(f client.Factory) *cobra.Command { + c := &cobra.Command{ + Use: "get", + Short: "Get ark resources", + Long: "Get ark resources", + } + + backupCommand := backup.NewGetCommand(f, "backups") + backupCommand.Aliases = []string{"backup"} + + scheduleCommand := schedule.NewGetCommand(f, "schedules") + scheduleCommand.Aliases = []string{"schedule"} + + restoreCommand := restore.NewGetCommand(f, "restores") + restoreCommand.Aliases = []string{"restore"} + + c.AddCommand( + backupCommand, + scheduleCommand, + restoreCommand, + ) + + return c +} diff --git a/pkg/cmd/cli/restore/create.go b/pkg/cmd/cli/restore/create.go index 6e98337e9..d0caf2054 100644 --- a/pkg/cmd/cli/restore/create.go +++ b/pkg/cmd/cli/restore/create.go @@ -33,11 +33,11 @@ import ( "github.com/heptio/ark/pkg/cmd/util/output" ) -func NewCreateCommand(f client.Factory) *cobra.Command { +func NewCreateCommand(f client.Factory, use string) *cobra.Command { o := NewCreateOptions() c := &cobra.Command{ - Use: "create BACKUP", + Use: use + " BACKUP", Short: "Create a restore", Run: func(c *cobra.Command, args []string) { cmd.CheckError(o.Validate(c, args)) diff --git a/pkg/cmd/cli/restore/get.go b/pkg/cmd/cli/restore/get.go index df4c1d74f..ec52fafd2 100644 --- a/pkg/cmd/cli/restore/get.go +++ b/pkg/cmd/cli/restore/get.go @@ -27,12 +27,12 @@ import ( "github.com/heptio/ark/pkg/cmd/util/output" ) -func NewGetCommand(f client.Factory) *cobra.Command { +func NewGetCommand(f client.Factory, use string) *cobra.Command { var listOptions metav1.ListOptions c := &cobra.Command{ - Use: "get", - Short: "get restores", + Use: use, + Short: "Get restores", Run: func(c *cobra.Command, args []string) { err := output.ValidateFlags(c) cmd.CheckError(err) diff --git a/pkg/cmd/cli/restore/restore.go b/pkg/cmd/cli/restore/restore.go index 1ee9c2db2..5aa199963 100644 --- a/pkg/cmd/cli/restore/restore.go +++ b/pkg/cmd/cli/restore/restore.go @@ -30,8 +30,8 @@ func NewCommand(f client.Factory) *cobra.Command { } c.AddCommand( - NewCreateCommand(f), - NewGetCommand(f), + NewCreateCommand(f, "create"), + NewGetCommand(f, "get"), NewLogsCommand(f), // Will implement later // NewDescribeCommand(f), diff --git a/pkg/cmd/cli/schedule/create.go b/pkg/cmd/cli/schedule/create.go index e0ea3801d..f6a5156e0 100644 --- a/pkg/cmd/cli/schedule/create.go +++ b/pkg/cmd/cli/schedule/create.go @@ -32,11 +32,11 @@ import ( "github.com/heptio/ark/pkg/cmd/util/output" ) -func NewCreateCommand(f client.Factory) *cobra.Command { +func NewCreateCommand(f client.Factory, use string) *cobra.Command { o := NewCreateOptions() c := &cobra.Command{ - Use: "create NAME", + Use: use + " NAME", Short: "Create a schedule", Run: func(c *cobra.Command, args []string) { cmd.CheckError(o.Validate(c, args)) diff --git a/pkg/cmd/cli/schedule/get.go b/pkg/cmd/cli/schedule/get.go index 78c7bcf6c..f15206df8 100644 --- a/pkg/cmd/cli/schedule/get.go +++ b/pkg/cmd/cli/schedule/get.go @@ -27,11 +27,11 @@ import ( "github.com/heptio/ark/pkg/cmd/util/output" ) -func NewGetCommand(f client.Factory) *cobra.Command { +func NewGetCommand(f client.Factory, use string) *cobra.Command { var listOptions metav1.ListOptions c := &cobra.Command{ - Use: "get", + Use: use, Short: "Get schedules", Run: func(c *cobra.Command, args []string) { err := output.ValidateFlags(c) diff --git a/pkg/cmd/cli/schedule/schedule.go b/pkg/cmd/cli/schedule/schedule.go index 4e5e83467..9a0e99576 100644 --- a/pkg/cmd/cli/schedule/schedule.go +++ b/pkg/cmd/cli/schedule/schedule.go @@ -30,8 +30,8 @@ func NewCommand(f client.Factory) *cobra.Command { } c.AddCommand( - NewCreateCommand(f), - NewGetCommand(f), + NewCreateCommand(f, "create"), + NewGetCommand(f, "get"), // Will implement later // NewDescribeCommand(f), NewDeleteCommand(f),