diff --git a/cmd/disk_partition.go b/cmd/disk_partition.go index a775029..b5d24c1 100644 --- a/cmd/disk_partition.go +++ b/cmd/disk_partition.go @@ -43,9 +43,8 @@ func init() { diskCommand.AddCommand(diskPartitionCommand) - rootCmd.AddCommand(&cobra.Command{ - Use: "partition-disk", - Deprecated: "use \"disk partition\"", - Run: diskPartitionCommand.Run, - }) + deprecated := *diskPartitionCommand + deprecated.Use = "partition-disk" + deprecated.Deprecated = "use \"disk partition\"" + rootCmd.AddCommand(&deprecated) } diff --git a/cmd/disk_wipe.go b/cmd/disk_wipe.go index dc89cba..7a48cec 100644 --- a/cmd/disk_wipe.go +++ b/cmd/disk_wipe.go @@ -5,6 +5,7 @@ import ( "context" "errors" "os" + "time" "github.com/bmc-toolbox/common" "github.com/metal-toolbox/ironlib" @@ -32,9 +33,9 @@ func init() { logger.With("error", err).Fatal("--timeout argument is invalid") } - verbose, err := cmd.Flags().GetBool("verbose") + verbose, err := cmd.Flags().GetBool("debug") if err != nil { - logger.With("error", err).Fatal("--verbose argument is invalid") + logger.With("error", err).Fatal("--debug argument is invalid") } driveName := args[0] @@ -90,5 +91,6 @@ func init() { }, } + diskCommand.PersistentFlags().Duration("timeout", 1*time.Minute, "Time to wait for wipe to complete") diskCommand.AddCommand(cmd) } diff --git a/cmd/partition_format.go b/cmd/partition_format.go index 45e86a5..cadaccc 100644 --- a/cmd/partition_format.go +++ b/cmd/partition_format.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" ) -var partitionFormatPartitionCommand = &cobra.Command{ +var partitionFormatCommand = &cobra.Command{ Use: "format", Short: "Formats a partition", Long: "Formats a partition with your choice of filesystem", @@ -49,21 +49,20 @@ var partitionFormatPartitionCommand = &cobra.Command{ } func init() { - partitionFormatPartitionCommand.PersistentFlags().String("device", "", "Block device") - partitionFormatPartitionCommand.PersistentFlags().String("filesystem-device", "", "Filesystem Block device") + partitionFormatCommand.PersistentFlags().String("device", "", "Block device") + partitionFormatCommand.PersistentFlags().String("filesystem-device", "", "Filesystem Block device") - partitionFormatPartitionCommand.PersistentFlags().Uint("partition", 0, "Partition number") + partitionFormatCommand.PersistentFlags().Uint("partition", 0, "Partition number") - partitionFormatPartitionCommand.PersistentFlags().String("format", "ext4", "Filesystem to be applied to the partition") - markFlagAsRequired(partitionFormatPartitionCommand, "format") + partitionFormatCommand.PersistentFlags().String("format", "ext4", "Filesystem to be applied to the partition") + markFlagAsRequired(partitionFormatCommand, "format") - partitionFormatPartitionCommand.PersistentFlags().String("mount-point", "/", "Filesystem mount point") - partitionFormatPartitionCommand.PersistentFlags().StringSlice("options", []string{}, "Filesystem creation options") - partitionCommand.AddCommand(partitionFormatPartitionCommand) + partitionFormatCommand.PersistentFlags().String("mount-point", "/", "Filesystem mount point") + partitionFormatCommand.PersistentFlags().StringSlice("options", []string{}, "Filesystem creation options") + partitionCommand.AddCommand(partitionFormatCommand) - rootCmd.AddCommand(&cobra.Command{ - Use: "format-partition", - Deprecated: "use \"partition format\"", - Run: partitionFormatPartitionCommand.Run, - }) + deprecated := *partitionFormatCommand + deprecated.Use = "format-partition" + deprecated.Deprecated = "use \"partition format\"" + rootCmd.AddCommand(&deprecated) }