diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 28b6c7feb..562108a33 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -55,6 +55,7 @@ Exit status is 12 if the password is incorrect. backupOptions.Host = hostname } }, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { term, cancel := setupTermstatus() diff --git a/cmd/restic/cmd_cache.go b/cmd/restic/cmd_cache.go index e71d38365..e54c73451 100644 --- a/cmd/restic/cmd_cache.go +++ b/cmd/restic/cmd_cache.go @@ -28,6 +28,7 @@ EXIT STATUS Exit status is 0 if the command was successful. Exit status is 1 if there was any error. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(_ *cobra.Command, args []string) error { return runCache(cacheOptions, globalOptions, args) diff --git a/cmd/restic/cmd_cat.go b/cmd/restic/cmd_cat.go index ac03798d2..6160c54df 100644 --- a/cmd/restic/cmd_cat.go +++ b/cmd/restic/cmd_cat.go @@ -29,6 +29,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runCat(cmd.Context(), globalOptions, args) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index b0749e022..dcf7f27df 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -41,6 +41,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { term, cancel := setupTermstatus() diff --git a/cmd/restic/cmd_copy.go b/cmd/restic/cmd_copy.go index 40015b13c..cd92193ac 100644 --- a/cmd/restic/cmd_copy.go +++ b/cmd/restic/cmd_copy.go @@ -40,6 +40,8 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, + DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runCopy(cmd.Context(), copyOptions, globalOptions, args) }, diff --git a/cmd/restic/cmd_debug.go b/cmd/restic/cmd_debug.go index 18b4b7631..b92192492 100644 --- a/cmd/restic/cmd_debug.go +++ b/cmd/restic/cmd_debug.go @@ -29,8 +29,10 @@ import ( ) var cmdDebug = &cobra.Command{ - Use: "debug", - Short: "Debug commands", + Use: "debug", + Short: "Debug commands", + GroupID: cmdGroupDefault, + DisableAutoGenTag: true, } var cmdDebugDump = &cobra.Command{ diff --git a/cmd/restic/cmd_diff.go b/cmd/restic/cmd_diff.go index 24f445b64..594e387e8 100644 --- a/cmd/restic/cmd_diff.go +++ b/cmd/restic/cmd_diff.go @@ -45,6 +45,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runDiff(cmd.Context(), diffOptions, globalOptions, args) diff --git a/cmd/restic/cmd_dump.go b/cmd/restic/cmd_dump.go index a5794ad30..7d6652e17 100644 --- a/cmd/restic/cmd_dump.go +++ b/cmd/restic/cmd_dump.go @@ -40,6 +40,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runDump(cmd.Context(), dumpOptions, globalOptions, args) diff --git a/cmd/restic/cmd_features.go b/cmd/restic/cmd_features.go index 497013696..a2f04be31 100644 --- a/cmd/restic/cmd_features.go +++ b/cmd/restic/cmd_features.go @@ -31,7 +31,7 @@ EXIT STATUS Exit status is 0 if the command was successful. Exit status is 1 if there was any error. `, - Hidden: true, + GroupID: cmdGroupAdvanced, DisableAutoGenTag: true, RunE: func(_ *cobra.Command, args []string) error { if len(args) != 0 { diff --git a/cmd/restic/cmd_find.go b/cmd/restic/cmd_find.go index f84ad43c3..cb5c0e5e0 100644 --- a/cmd/restic/cmd_find.go +++ b/cmd/restic/cmd_find.go @@ -39,6 +39,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runFind(cmd.Context(), findOptions, globalOptions, args) diff --git a/cmd/restic/cmd_forget.go b/cmd/restic/cmd_forget.go index 01fe0e606..58a9d25b7 100644 --- a/cmd/restic/cmd_forget.go +++ b/cmd/restic/cmd_forget.go @@ -41,6 +41,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { term, cancel := setupTermstatus() diff --git a/cmd/restic/cmd_init.go b/cmd/restic/cmd_init.go index 3c0319e55..2a2aae1dc 100644 --- a/cmd/restic/cmd_init.go +++ b/cmd/restic/cmd_init.go @@ -26,6 +26,7 @@ EXIT STATUS Exit status is 0 if the command was successful. Exit status is 1 if there was any error. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runInit(cmd.Context(), initOptions, globalOptions, args) diff --git a/cmd/restic/cmd_key.go b/cmd/restic/cmd_key.go index c687eca53..a94caa0d8 100644 --- a/cmd/restic/cmd_key.go +++ b/cmd/restic/cmd_key.go @@ -11,6 +11,8 @@ var cmdKey = &cobra.Command{ The "key" command allows you to set multiple access keys or passwords per repository. `, + DisableAutoGenTag: true, + GroupID: cmdGroupDefault, } func init() { diff --git a/cmd/restic/cmd_list.go b/cmd/restic/cmd_list.go index 4aa9f43bb..1a4791e31 100644 --- a/cmd/restic/cmd_list.go +++ b/cmd/restic/cmd_list.go @@ -26,6 +26,7 @@ Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, DisableAutoGenTag: true, + GroupID: cmdGroupDefault, RunE: func(cmd *cobra.Command, args []string) error { return runList(cmd.Context(), globalOptions, args) }, diff --git a/cmd/restic/cmd_ls.go b/cmd/restic/cmd_ls.go index 7c712e481..69e278103 100644 --- a/cmd/restic/cmd_ls.go +++ b/cmd/restic/cmd_ls.go @@ -46,6 +46,7 @@ Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, DisableAutoGenTag: true, + GroupID: cmdGroupDefault, RunE: func(cmd *cobra.Command, args []string) error { return runLs(cmd.Context(), lsOptions, globalOptions, args) }, diff --git a/cmd/restic/cmd_migrate.go b/cmd/restic/cmd_migrate.go index 2cc44bff0..5c3e425ed 100644 --- a/cmd/restic/cmd_migrate.go +++ b/cmd/restic/cmd_migrate.go @@ -29,6 +29,7 @@ Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, DisableAutoGenTag: true, + GroupID: cmdGroupDefault, RunE: func(cmd *cobra.Command, args []string) error { term, cancel := setupTermstatus() defer cancel() diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 0b79afe45..2f57a6d1f 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -71,6 +71,7 @@ Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, DisableAutoGenTag: true, + GroupID: cmdGroupDefault, RunE: func(cmd *cobra.Command, args []string) error { return runMount(cmd.Context(), mountOptions, globalOptions, args) }, diff --git a/cmd/restic/cmd_options.go b/cmd/restic/cmd_options.go index 4cd574b68..9c07b2626 100644 --- a/cmd/restic/cmd_options.go +++ b/cmd/restic/cmd_options.go @@ -20,7 +20,7 @@ EXIT STATUS Exit status is 0 if the command was successful. Exit status is 1 if there was any error. `, - Hidden: true, + GroupID: cmdGroupAdvanced, DisableAutoGenTag: true, Run: func(_ *cobra.Command, _ []string) { fmt.Printf("All Extended Options:\n") diff --git a/cmd/restic/cmd_prune.go b/cmd/restic/cmd_prune.go index e19c2e04b..e8473bd6f 100644 --- a/cmd/restic/cmd_prune.go +++ b/cmd/restic/cmd_prune.go @@ -34,6 +34,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { term, cancel := setupTermstatus() diff --git a/cmd/restic/cmd_recover.go b/cmd/restic/cmd_recover.go index 0ff6e2d66..a6ef59cc2 100644 --- a/cmd/restic/cmd_recover.go +++ b/cmd/restic/cmd_recover.go @@ -28,6 +28,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { return runRecover(cmd.Context(), globalOptions) diff --git a/cmd/restic/cmd_repair.go b/cmd/restic/cmd_repair.go index aefe02f3c..6a1a1f9dc 100644 --- a/cmd/restic/cmd_repair.go +++ b/cmd/restic/cmd_repair.go @@ -5,8 +5,10 @@ import ( ) var cmdRepair = &cobra.Command{ - Use: "repair", - Short: "Repair the repository", + Use: "repair", + Short: "Repair the repository", + GroupID: cmdGroupDefault, + DisableAutoGenTag: true, } func init() { diff --git a/cmd/restic/cmd_restore.go b/cmd/restic/cmd_restore.go index eb437a11d..c58b0b80d 100644 --- a/cmd/restic/cmd_restore.go +++ b/cmd/restic/cmd_restore.go @@ -38,6 +38,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { term, cancel := setupTermstatus() diff --git a/cmd/restic/cmd_rewrite.go b/cmd/restic/cmd_rewrite.go index d1088d00b..7788016b7 100644 --- a/cmd/restic/cmd_rewrite.go +++ b/cmd/restic/cmd_rewrite.go @@ -44,6 +44,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runRewrite(cmd.Context(), rewriteOptions, globalOptions, args) diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go index 442c57375..42677918f 100644 --- a/cmd/restic/cmd_snapshots.go +++ b/cmd/restic/cmd_snapshots.go @@ -29,6 +29,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runSnapshots(cmd.Context(), snapshotOptions, globalOptions, args) diff --git a/cmd/restic/cmd_stats.go b/cmd/restic/cmd_stats.go index 552eaff6d..dd51175d3 100644 --- a/cmd/restic/cmd_stats.go +++ b/cmd/restic/cmd_stats.go @@ -55,6 +55,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runStats(cmd.Context(), statsOptions, globalOptions, args) diff --git a/cmd/restic/cmd_tag.go b/cmd/restic/cmd_tag.go index 47e3c02ad..c7bf725e9 100644 --- a/cmd/restic/cmd_tag.go +++ b/cmd/restic/cmd_tag.go @@ -31,6 +31,7 @@ Exit status is 10 if the repository does not exist. Exit status is 11 if the repository is already locked. Exit status is 12 if the password is incorrect. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { return runTag(cmd.Context(), tagOptions, globalOptions, args) diff --git a/cmd/restic/cmd_unlock.go b/cmd/restic/cmd_unlock.go index 96eef7e02..d87cde065 100644 --- a/cmd/restic/cmd_unlock.go +++ b/cmd/restic/cmd_unlock.go @@ -19,6 +19,7 @@ EXIT STATUS Exit status is 0 if the command was successful. Exit status is 1 if there was any error. `, + GroupID: cmdGroupDefault, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { return runUnlock(cmd.Context(), unlockOptions, globalOptions) diff --git a/cmd/restic/main.go b/cmd/restic/main.go index b366a6ad3..4cb135c48 100644 --- a/cmd/restic/main.go +++ b/cmd/restic/main.go @@ -84,6 +84,22 @@ The full documentation can be found at https://restic.readthedocs.io/ . }, } +var cmdGroupDefault = "default" +var cmdGroupAdvanced = "advanced" + +func init() { + cmdRoot.AddGroup( + &cobra.Group{ + ID: cmdGroupDefault, + Title: "Available Commands:", + }, + &cobra.Group{ + ID: cmdGroupAdvanced, + Title: "Advanced Options:", + }, + ) +} + // Distinguish commands that need the password from those that work without, // so we don't run $RESTIC_PASSWORD_COMMAND for no reason (it might prompt the // user for authentication). diff --git a/doc/manual_rest.rst b/doc/manual_rest.rst index a7a0f96e0..031f4fc52 100644 --- a/doc/manual_rest.rst +++ b/doc/manual_rest.rst @@ -28,8 +28,6 @@ Usage help is available: dump Print a backed-up file to stdout find Find a file, a directory or restic IDs forget Remove snapshots from the repository - generate Generate manual pages and auto-completion files (bash, fish, zsh, powershell) - help Help about any command init Initialize a new repository key Manage keys (passwords) list List objects in the repository @@ -41,11 +39,19 @@ Usage help is available: repair Repair the repository restore Extract the data from a snapshot rewrite Rewrite snapshots to exclude unwanted files - self-update Update the restic binary snapshots List all snapshots stats Scan the repository and show basic statistics tag Modify tags on snapshots unlock Remove locks other processes created + + Advanced Options: + features Print list of feature flags + options Print list of extended options + + Additional Commands: + generate Generate manual pages and auto-completion files (bash, fish, zsh, powershell) + help Help about any command + self-update Update the restic binary version Print version information Flags: