From 2447f3f110652190049d80682b66c800120a7ccf Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Thu, 27 Aug 2020 03:29:43 +0000 Subject: [PATCH] Update usage strings to put flags before args The standard UNIX-style ordering of command-line arguments places optional flags before other positional arguments. All of restic's commands support this ordering, but some of the usage strings showed the flags after the positional arguments (which restic also parses just fine). This change updates the doc strings to reflect the standard ordering. Because the `restic help` command comes directly from Cobra, there does not appear to be a way to update the argument ordering in its usage string, so it maintains the non-standard ordering (positional arguments before optional flags). --- cmd/restic/cmd_diff.go | 2 +- cmd/restic/cmd_generate.go | 2 +- cmd/restic/cmd_key.go | 2 +- cmd/restic/cmd_list.go | 2 +- cmd/restic/cmd_migrate.go | 2 +- cmd/restic/cmd_snapshots.go | 2 +- doc/020_installation.rst | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/restic/cmd_diff.go b/cmd/restic/cmd_diff.go index b2294d99..b2ce7fca 100644 --- a/cmd/restic/cmd_diff.go +++ b/cmd/restic/cmd_diff.go @@ -14,7 +14,7 @@ import ( ) var cmdDiff = &cobra.Command{ - Use: "diff snapshot-ID snapshot-ID", + Use: "diff [flags] snapshot-ID snapshot-ID", Short: "Show differences between two snapshots", Long: ` The "diff" command shows differences from the first to the second snapshot. The diff --git a/cmd/restic/cmd_generate.go b/cmd/restic/cmd_generate.go index d8588f33..e8c968f0 100644 --- a/cmd/restic/cmd_generate.go +++ b/cmd/restic/cmd_generate.go @@ -9,7 +9,7 @@ import ( ) var cmdGenerate = &cobra.Command{ - Use: "generate [command]", + Use: "generate [flags]", Short: "Generate manual pages and auto-completion files (bash, zsh)", Long: ` The "generate" command writes automatically generated files (like the man pages diff --git a/cmd/restic/cmd_key.go b/cmd/restic/cmd_key.go index 1ad74059..360ffb48 100644 --- a/cmd/restic/cmd_key.go +++ b/cmd/restic/cmd_key.go @@ -16,7 +16,7 @@ import ( ) var cmdKey = &cobra.Command{ - Use: "key [list|add|remove|passwd] [ID]", + Use: "key [flags] [list|add|remove|passwd] [ID]", Short: "Manage keys (passwords)", Long: ` The "key" command manages keys (passwords) for accessing the repository. diff --git a/cmd/restic/cmd_list.go b/cmd/restic/cmd_list.go index 6de6d1a3..3cde6714 100644 --- a/cmd/restic/cmd_list.go +++ b/cmd/restic/cmd_list.go @@ -9,7 +9,7 @@ import ( ) var cmdList = &cobra.Command{ - Use: "list [blobs|packs|index|snapshots|keys|locks]", + Use: "list [flags] [blobs|packs|index|snapshots|keys|locks]", Short: "List objects in the repository", Long: ` The "list" command allows listing objects in the repository based on type. diff --git a/cmd/restic/cmd_migrate.go b/cmd/restic/cmd_migrate.go index 7f8af12c..88764195 100644 --- a/cmd/restic/cmd_migrate.go +++ b/cmd/restic/cmd_migrate.go @@ -8,7 +8,7 @@ import ( ) var cmdMigrate = &cobra.Command{ - Use: "migrate [name]", + Use: "migrate [flags] [name]", Short: "Apply migrations", Long: ` The "migrate" command applies migrations to a repository. When no migration diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go index 42a335d5..d92499e3 100644 --- a/cmd/restic/cmd_snapshots.go +++ b/cmd/restic/cmd_snapshots.go @@ -14,7 +14,7 @@ import ( ) var cmdSnapshots = &cobra.Command{ - Use: "snapshots [snapshotID ...]", + Use: "snapshots [flags] [snapshotID ...]", Short: "List all snapshots", Long: ` The "snapshots" command lists all snapshots stored in the repository. diff --git a/doc/020_installation.rst b/doc/020_installation.rst index d4e4bd95..e714eb50 100644 --- a/doc/020_installation.rst +++ b/doc/020_installation.rst @@ -292,7 +292,7 @@ Restic can write out man pages and bash/zsh compatible autocompletion scripts: and the auto-completion files for bash and zsh). Usage: - restic generate [command] [flags] + restic generate [flags] [command] Flags: --bash-completion file write bash completion file