From 3b7228c8c1f6c3a7d78941ea8ef8346dd1d00d9e Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 30 Jun 2024 17:52:50 +0200 Subject: [PATCH] explicitly document exit code 1 on error --- cmd/restic/cmd_cache.go | 3 ++- cmd/restic/cmd_cat.go | 3 ++- cmd/restic/cmd_check.go | 3 ++- cmd/restic/cmd_copy.go | 6 ++++++ cmd/restic/cmd_debug.go | 3 ++- cmd/restic/cmd_diff.go | 3 ++- cmd/restic/cmd_dump.go | 3 ++- cmd/restic/cmd_features.go | 3 ++- cmd/restic/cmd_find.go | 3 ++- cmd/restic/cmd_forget.go | 3 ++- cmd/restic/cmd_generate.go | 3 ++- cmd/restic/cmd_init.go | 3 ++- cmd/restic/cmd_key_add.go | 3 ++- cmd/restic/cmd_key_list.go | 3 ++- cmd/restic/cmd_key_passwd.go | 3 ++- cmd/restic/cmd_key_remove.go | 3 ++- cmd/restic/cmd_list.go | 3 ++- cmd/restic/cmd_ls.go | 3 ++- cmd/restic/cmd_migrate.go | 3 ++- cmd/restic/cmd_mount.go | 3 ++- cmd/restic/cmd_options.go | 3 ++- cmd/restic/cmd_prune.go | 3 ++- cmd/restic/cmd_recover.go | 3 ++- cmd/restic/cmd_repair_index.go | 3 ++- cmd/restic/cmd_repair_packs.go | 3 ++- cmd/restic/cmd_repair_snapshots.go | 3 ++- cmd/restic/cmd_restore.go | 3 ++- cmd/restic/cmd_rewrite.go | 3 ++- cmd/restic/cmd_self_update.go | 3 ++- cmd/restic/cmd_snapshots.go | 3 ++- cmd/restic/cmd_stats.go | 3 ++- cmd/restic/cmd_tag.go | 3 ++- cmd/restic/cmd_unlock.go | 3 ++- cmd/restic/cmd_version.go | 3 ++- 34 files changed, 72 insertions(+), 33 deletions(-) diff --git a/cmd/restic/cmd_cache.go b/cmd/restic/cmd_cache.go index 651c65fcf..e71d38365 100644 --- a/cmd/restic/cmd_cache.go +++ b/cmd/restic/cmd_cache.go @@ -25,7 +25,8 @@ The "cache" command allows listing and cleaning local cache directories. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(_ *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_cat.go b/cmd/restic/cmd_cat.go index 23205771a..b830e1a35 100644 --- a/cmd/restic/cmd_cat.go +++ b/cmd/restic/cmd_cat.go @@ -21,7 +21,8 @@ The "cat" command is used to print internal objects to stdout. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index f416c9269..4b41f11ff 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -35,7 +35,8 @@ repository and not use a local cache. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_copy.go b/cmd/restic/cmd_copy.go index d12501dd9..861545816 100644 --- a/cmd/restic/cmd_copy.go +++ b/cmd/restic/cmd_copy.go @@ -30,6 +30,12 @@ This means that copied files, which existed in both the source and destination repository, /may occupy up to twice their space/ in the destination repository. This can be mitigated by the "--copy-chunker-params" option when initializing a new destination repository using the "init" command. + +EXIT STATUS +=========== + +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, 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 1a42995fd..2b5fe27c3 100644 --- a/cmd/restic/cmd_debug.go +++ b/cmd/restic/cmd_debug.go @@ -43,7 +43,8 @@ is used for debugging purposes only. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_diff.go b/cmd/restic/cmd_diff.go index fd54897f1..73cbee1fc 100644 --- a/cmd/restic/cmd_diff.go +++ b/cmd/restic/cmd_diff.go @@ -39,7 +39,8 @@ snapshot. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_dump.go b/cmd/restic/cmd_dump.go index 2a98a8ae8..d36972648 100644 --- a/cmd/restic/cmd_dump.go +++ b/cmd/restic/cmd_dump.go @@ -34,7 +34,8 @@ snapshot. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_features.go b/cmd/restic/cmd_features.go index 8125d3e26..497013696 100644 --- a/cmd/restic/cmd_features.go +++ b/cmd/restic/cmd_features.go @@ -28,7 +28,8 @@ A _deprecated_ feature is always disabled and cannot be enabled. The flag will b EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, Hidden: true, DisableAutoGenTag: true, diff --git a/cmd/restic/cmd_find.go b/cmd/restic/cmd_find.go index 59e34c468..b24301789 100644 --- a/cmd/restic/cmd_find.go +++ b/cmd/restic/cmd_find.go @@ -33,7 +33,8 @@ restic find --pack 025c1d06 EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_forget.go b/cmd/restic/cmd_forget.go index 4fd931ff0..26f41b52f 100644 --- a/cmd/restic/cmd_forget.go +++ b/cmd/restic/cmd_forget.go @@ -35,7 +35,8 @@ security considerations. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_generate.go b/cmd/restic/cmd_generate.go index ba710e708..b5c7cecb5 100644 --- a/cmd/restic/cmd_generate.go +++ b/cmd/restic/cmd_generate.go @@ -18,7 +18,8 @@ and the auto-completion files for bash, fish and zsh). EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(_ *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_init.go b/cmd/restic/cmd_init.go index e6ea69441..3c0319e55 100644 --- a/cmd/restic/cmd_init.go +++ b/cmd/restic/cmd_init.go @@ -23,7 +23,8 @@ The "init" command initializes a new repository. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_key_add.go b/cmd/restic/cmd_key_add.go index d38991f09..f438445cf 100644 --- a/cmd/restic/cmd_key_add.go +++ b/cmd/restic/cmd_key_add.go @@ -19,7 +19,8 @@ The "add" sub-command creates a new key and validates the key. Returns the new k EXIT STATUS =========== -Exit status is 0 if the command is successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, } diff --git a/cmd/restic/cmd_key_list.go b/cmd/restic/cmd_key_list.go index fcca6055a..513335787 100644 --- a/cmd/restic/cmd_key_list.go +++ b/cmd/restic/cmd_key_list.go @@ -23,7 +23,8 @@ used to access the repository. EXIT STATUS =========== -Exit status is 0 if the command is successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_key_passwd.go b/cmd/restic/cmd_key_passwd.go index 1a1200109..16ea9bbf4 100644 --- a/cmd/restic/cmd_key_passwd.go +++ b/cmd/restic/cmd_key_passwd.go @@ -19,7 +19,8 @@ Returns the new key ID. EXIT STATUS =========== -Exit status is 0 if the command is successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, } diff --git a/cmd/restic/cmd_key_remove.go b/cmd/restic/cmd_key_remove.go index 93babb4f3..a8a958f18 100644 --- a/cmd/restic/cmd_key_remove.go +++ b/cmd/restic/cmd_key_remove.go @@ -20,7 +20,8 @@ removing the current key being used to access the repository. EXIT STATUS =========== -Exit status is 0 if the command is successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_list.go b/cmd/restic/cmd_list.go index 6f4430420..172bf47f6 100644 --- a/cmd/restic/cmd_list.go +++ b/cmd/restic/cmd_list.go @@ -19,7 +19,8 @@ The "list" command allows listing objects in the repository based on type. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_ls.go b/cmd/restic/cmd_ls.go index 6e48b010f..cc253e2c2 100644 --- a/cmd/restic/cmd_ls.go +++ b/cmd/restic/cmd_ls.go @@ -39,7 +39,8 @@ a path separator); paths use the forward slash '/' as separator. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_migrate.go b/cmd/restic/cmd_migrate.go index 0f9bdde1a..28642a4b4 100644 --- a/cmd/restic/cmd_migrate.go +++ b/cmd/restic/cmd_migrate.go @@ -22,7 +22,8 @@ names are specified, these migrations are applied. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 5a10447f3..be7cdc431 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -64,7 +64,8 @@ The default path templates are: EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_options.go b/cmd/restic/cmd_options.go index 85e062220..4cd574b68 100644 --- a/cmd/restic/cmd_options.go +++ b/cmd/restic/cmd_options.go @@ -17,7 +17,8 @@ The "options" command prints a list of extended options. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, Hidden: true, DisableAutoGenTag: true, diff --git a/cmd/restic/cmd_prune.go b/cmd/restic/cmd_prune.go index f0bfa2b94..126a5c37c 100644 --- a/cmd/restic/cmd_prune.go +++ b/cmd/restic/cmd_prune.go @@ -28,7 +28,8 @@ referenced and therefore not needed any more. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { diff --git a/cmd/restic/cmd_recover.go b/cmd/restic/cmd_recover.go index 726f1bf65..3ea843a71 100644 --- a/cmd/restic/cmd_recover.go +++ b/cmd/restic/cmd_recover.go @@ -22,7 +22,8 @@ It can be used if, for example, a snapshot has been removed by accident with "fo EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { diff --git a/cmd/restic/cmd_repair_index.go b/cmd/restic/cmd_repair_index.go index 50ba16e33..2c8b59f43 100644 --- a/cmd/restic/cmd_repair_index.go +++ b/cmd/restic/cmd_repair_index.go @@ -19,7 +19,8 @@ repository. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { diff --git a/cmd/restic/cmd_repair_packs.go b/cmd/restic/cmd_repair_packs.go index ab8c7f475..4a4f7e422 100644 --- a/cmd/restic/cmd_repair_packs.go +++ b/cmd/restic/cmd_repair_packs.go @@ -23,7 +23,8 @@ the index to remove the damaged pack files and removes the pack files from the r EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_repair_snapshots.go b/cmd/restic/cmd_repair_snapshots.go index be5ef4ad9..4594991b9 100644 --- a/cmd/restic/cmd_repair_snapshots.go +++ b/cmd/restic/cmd_repair_snapshots.go @@ -37,7 +37,8 @@ snapshot! EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_restore.go b/cmd/restic/cmd_restore.go index e21d0bd94..ed3caad50 100644 --- a/cmd/restic/cmd_restore.go +++ b/cmd/restic/cmd_restore.go @@ -32,7 +32,8 @@ syntax, where "subfolder" is a path within the snapshot. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_rewrite.go b/cmd/restic/cmd_rewrite.go index 83ace7a11..a290744a2 100644 --- a/cmd/restic/cmd_rewrite.go +++ b/cmd/restic/cmd_rewrite.go @@ -38,7 +38,8 @@ use the "prune" command. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_self_update.go b/cmd/restic/cmd_self_update.go index 4b86c416f..5e5e93f22 100644 --- a/cmd/restic/cmd_self_update.go +++ b/cmd/restic/cmd_self_update.go @@ -24,7 +24,8 @@ files. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go index ea15af019..3bd410cea 100644 --- a/cmd/restic/cmd_snapshots.go +++ b/cmd/restic/cmd_snapshots.go @@ -23,7 +23,8 @@ The "snapshots" command lists all snapshots stored in the repository. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_stats.go b/cmd/restic/cmd_stats.go index 0f8e45f36..5717aa222 100644 --- a/cmd/restic/cmd_stats.go +++ b/cmd/restic/cmd_stats.go @@ -49,7 +49,8 @@ Refer to the online manual for more details about each mode. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_tag.go b/cmd/restic/cmd_tag.go index 033dc5ebe..1550b17bd 100644 --- a/cmd/restic/cmd_tag.go +++ b/cmd/restic/cmd_tag.go @@ -25,7 +25,8 @@ When no snapshotID is given, all snapshots matching the host, tag and path filte EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/restic/cmd_unlock.go b/cmd/restic/cmd_unlock.go index 6893f3365..96eef7e02 100644 --- a/cmd/restic/cmd_unlock.go +++ b/cmd/restic/cmd_unlock.go @@ -16,7 +16,8 @@ The "unlock" command removes stale locks that have been created by other restic EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, _ []string) error { diff --git a/cmd/restic/cmd_version.go b/cmd/restic/cmd_version.go index e3f9b3010..cd32e2470 100644 --- a/cmd/restic/cmd_version.go +++ b/cmd/restic/cmd_version.go @@ -18,7 +18,8 @@ and the version of this software. EXIT STATUS =========== -Exit status is 0 if the command was successful, and non-zero if there was any error. +Exit status is 0 if the command was successful. +Exit status is 1 if there was any error. `, DisableAutoGenTag: true, Run: func(_ *cobra.Command, _ []string) {