diff --git a/cmd/stbak/cmd/archive.go b/cmd/stbak/cmd/archive.go index fefaebe..aaa1679 100644 --- a/cmd/stbak/cmd/archive.go +++ b/cmd/stbak/cmd/archive.go @@ -208,7 +208,7 @@ func archive( func init() { archiveCmd.PersistentFlags().IntP(recordSizeFlag, "e", 20, "Amount of 512-bit blocks per record") archiveCmd.PersistentFlags().StringP(srcFlag, "s", ".", "File or directory to archive") - archiveCmd.PersistentFlags().BoolP(overwriteFlag, "o", false, "Start writing from the start instead of from the end of the tape/file") + archiveCmd.PersistentFlags().BoolP(overwriteFlag, "o", false, "Start writing from the start instead of from the end of the tape or tar file") viper.AutomaticEnv() diff --git a/cmd/stbak/cmd/eject.go b/cmd/stbak/cmd/drive_eject.go similarity index 95% rename from cmd/stbak/cmd/eject.go rename to cmd/stbak/cmd/drive_eject.go index 43730dc..b4f9c1a 100644 --- a/cmd/stbak/cmd/eject.go +++ b/cmd/stbak/cmd/drive_eject.go @@ -35,5 +35,5 @@ var ejectCmd = &cobra.Command{ func init() { viper.AutomaticEnv() - rootCmd.AddCommand(ejectCmd) + driveCmd.AddCommand(ejectCmd) } diff --git a/cmd/stbak/cmd/drive_root.go b/cmd/stbak/cmd/drive_root.go new file mode 100644 index 0000000..6de66a8 --- /dev/null +++ b/cmd/stbak/cmd/drive_root.go @@ -0,0 +1,17 @@ +package cmd + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var driveCmd = &cobra.Command{ + Use: "drive", + Short: "Manage tape drives", +} + +func init() { + viper.AutomaticEnv() + + rootCmd.AddCommand(driveCmd) +} diff --git a/cmd/stbak/cmd/tell.go b/cmd/stbak/cmd/drive_tell.go similarity index 96% rename from cmd/stbak/cmd/tell.go rename to cmd/stbak/cmd/drive_tell.go index aba9359..173eeb8 100644 --- a/cmd/stbak/cmd/tell.go +++ b/cmd/stbak/cmd/drive_tell.go @@ -43,5 +43,5 @@ var tellCmd = &cobra.Command{ func init() { viper.AutomaticEnv() - rootCmd.AddCommand(tellCmd) + driveCmd.AddCommand(tellCmd) } diff --git a/cmd/stbak/cmd/move.go b/cmd/stbak/cmd/move.go index addfca0..fc05d56 100644 --- a/cmd/stbak/cmd/move.go +++ b/cmd/stbak/cmd/move.go @@ -66,7 +66,7 @@ var moveCmd = &cobra.Command{ return err } - // Append move headers to the tape/tar file + // Append move headers to the tape or tar file for _, dbhdr := range headersToMove { hdr, err := converters.DBHeaderToTarHeader(dbhdr) if err != nil { diff --git a/cmd/stbak/cmd/index.go b/cmd/stbak/cmd/recovery_index.go similarity index 97% rename from cmd/stbak/cmd/index.go rename to cmd/stbak/cmd/recovery_index.go index 0c9983d..906d455 100644 --- a/cmd/stbak/cmd/index.go +++ b/cmd/stbak/cmd/recovery_index.go @@ -219,11 +219,11 @@ func init() { indexCmd.PersistentFlags().IntP(recordSizeFlag, "e", 20, "Amount of 512-bit blocks per record") indexCmd.PersistentFlags().IntP(recordFlag, "r", 0, "Record to seek too before counting") indexCmd.PersistentFlags().IntP(blockFlag, "b", 0, "Block in record to seek too before counting") - indexCmd.PersistentFlags().BoolP(overwriteFlag, "o", false, "Start writing from the current position instead of from the end of the tape/file") + indexCmd.PersistentFlags().BoolP(overwriteFlag, "o", false, "Remove the old index before starting to index") viper.AutomaticEnv() - rootCmd.AddCommand(indexCmd) + recoveryCmd.AddCommand(indexCmd) } func indexHeader(record, block int64, hdr *tar.Header, metadataPersister *persisters.MetadataPersister) error { diff --git a/cmd/stbak/cmd/list.go b/cmd/stbak/cmd/recovery_list.go similarity index 99% rename from cmd/stbak/cmd/list.go rename to cmd/stbak/cmd/recovery_list.go index 798f49a..52264bf 100644 --- a/cmd/stbak/cmd/list.go +++ b/cmd/stbak/cmd/recovery_list.go @@ -190,5 +190,5 @@ func init() { viper.AutomaticEnv() - rootCmd.AddCommand(listCmd) + recoveryCmd.AddCommand(listCmd) } diff --git a/cmd/stbak/cmd/restore.go b/cmd/stbak/cmd/recovery_restore.go similarity index 98% rename from cmd/stbak/cmd/restore.go rename to cmd/stbak/cmd/recovery_restore.go index 9b0f6d4..7f4c7fc 100644 --- a/cmd/stbak/cmd/restore.go +++ b/cmd/stbak/cmd/recovery_restore.go @@ -113,5 +113,5 @@ func init() { viper.AutomaticEnv() - rootCmd.AddCommand(restoreCmd) + recoveryCmd.AddCommand(restoreCmd) } diff --git a/cmd/stbak/cmd/recovery_root.go b/cmd/stbak/cmd/recovery_root.go new file mode 100644 index 0000000..48296c1 --- /dev/null +++ b/cmd/stbak/cmd/recovery_root.go @@ -0,0 +1,17 @@ +package cmd + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var recoveryCmd = &cobra.Command{ + Use: "recovery", + Short: "Recover tapes or tar files", +} + +func init() { + viper.AutomaticEnv() + + rootCmd.AddCommand(recoveryCmd) +} diff --git a/cmd/stbak/cmd/remove.go b/cmd/stbak/cmd/remove.go index a28951c..6b7b444 100644 --- a/cmd/stbak/cmd/remove.go +++ b/cmd/stbak/cmd/remove.go @@ -73,7 +73,7 @@ var removeCmd = &cobra.Command{ return err } - // Append deletion headers to the tape/tar file + // Append deletion headers to the tape or tar file for _, dbhdr := range headersToDelete { hdr, err := converters.DBHeaderToTarHeader(dbhdr) if err != nil { diff --git a/cmd/stbak/cmd/update.go b/cmd/stbak/cmd/update.go index f9001ce..4760d57 100644 --- a/cmd/stbak/cmd/update.go +++ b/cmd/stbak/cmd/update.go @@ -168,7 +168,7 @@ func update( func init() { updateCmd.PersistentFlags().IntP(recordSizeFlag, "e", 20, "Amount of 512-bit blocks per record") updateCmd.PersistentFlags().StringP(srcFlag, "s", "", "Path of the file or directory to update") - updateCmd.PersistentFlags().BoolP(contentFlag, "c", false, "Replace the content on the tape/tar file") + updateCmd.PersistentFlags().BoolP(contentFlag, "c", false, "Replace the content on the tape or tar file") viper.AutomaticEnv()