2
2
mirror of https://github.com/octoleo/restic.git synced 2024-09-30 07:29:02 +00:00

Merge pull request #806 from oysols/consistent-cli

Fix inconsistencies in CLI
This commit is contained in:
Alexander Neumann 2017-02-15 15:26:27 +01:00
commit c973a1f875
10 changed files with 17 additions and 17 deletions

View File

@ -68,10 +68,10 @@ func init() {
f := cmdBackup.Flags() f := cmdBackup.Flags()
f.StringVar(&backupOptions.Parent, "parent", "", "use this parent snapshot (default: last snapshot in the repo that has the same target files/directories)") f.StringVar(&backupOptions.Parent, "parent", "", "use this parent snapshot (default: last snapshot in the repo that has the same target files/directories)")
f.BoolVarP(&backupOptions.Force, "force", "f", false, `force re-reading the target files/directories. Overrides the "parent" flag`) f.BoolVarP(&backupOptions.Force, "force", "f", false, `force re-reading the target files/directories (overrides the "parent" flag)`)
f.StringSliceVarP(&backupOptions.Excludes, "exclude", "e", []string{}, "exclude a `pattern` (can be specified multiple times)") f.StringSliceVarP(&backupOptions.Excludes, "exclude", "e", []string{}, "exclude a `pattern` (can be specified multiple times)")
f.StringVar(&backupOptions.ExcludeFile, "exclude-file", "", "read exclude patterns from a file") f.StringVar(&backupOptions.ExcludeFile, "exclude-file", "", "read exclude patterns from a file")
f.BoolVarP(&backupOptions.ExcludeOtherFS, "one-file-system", "x", false, "Exclude other file systems") f.BoolVarP(&backupOptions.ExcludeOtherFS, "one-file-system", "x", false, "exclude other file systems")
f.BoolVar(&backupOptions.Stdin, "stdin", false, "read backup from stdin") f.BoolVar(&backupOptions.Stdin, "stdin", false, "read backup from stdin")
f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "file name to use when reading from stdin") f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "file name to use when reading from stdin")
f.StringSliceVar(&backupOptions.Tags, "tag", []string{}, "add a `tag` for the new snapshot (can be specified multiple times)") f.StringSliceVar(&backupOptions.Tags, "tag", []string{}, "add a `tag` for the new snapshot (can be specified multiple times)")

View File

@ -38,8 +38,8 @@ func init() {
cmdRoot.AddCommand(cmdCheck) cmdRoot.AddCommand(cmdCheck)
f := cmdCheck.Flags() f := cmdCheck.Flags()
f.BoolVar(&checkOptions.ReadData, "read-data", false, "Read all data blobs") f.BoolVar(&checkOptions.ReadData, "read-data", false, "read all data blobs")
f.BoolVar(&checkOptions.CheckUnused, "check-unused", false, "Find unused blobs") f.BoolVar(&checkOptions.CheckUnused, "check-unused", false, "find unused blobs")
} }
func newReadProgress(gopts GlobalOptions, todo restic.Stat) *restic.Progress { func newReadProgress(gopts GlobalOptions, todo restic.Stat) *restic.Progress {

View File

@ -22,7 +22,7 @@ var cmdDump = &cobra.Command{
Use: "dump [indexes|snapshots|trees|all|packs]", Use: "dump [indexes|snapshots|trees|all|packs]",
Short: "dump data structures", Short: "dump data structures",
Long: ` Long: `
The "dump" command dumps data structures from a repository as JSON objects. It The "dump" command dumps data structures from the repository as JSON objects. It
is used for debugging purposes only.`, is used for debugging purposes only.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return runDump(globalOptions, args) return runDump(globalOptions, args)

View File

@ -36,9 +36,9 @@ func init() {
cmdRoot.AddCommand(cmdFind) cmdRoot.AddCommand(cmdFind)
f := cmdFind.Flags() f := cmdFind.Flags()
f.StringVarP(&findOptions.Oldest, "oldest", "o", "", "Oldest modification date/time") f.StringVarP(&findOptions.Oldest, "oldest", "o", "", "oldest modification date/time")
f.StringVarP(&findOptions.Newest, "newest", "n", "", "Newest modification date/time") f.StringVarP(&findOptions.Newest, "newest", "n", "", "newest modification date/time")
f.StringVarP(&findOptions.Snapshot, "snapshot", "s", "", "Snapshot ID to search in") f.StringVarP(&findOptions.Snapshot, "snapshot", "s", "", "snapshot ID to search in")
} }
type findPattern struct { type findPattern struct {

View File

@ -14,7 +14,7 @@ var cmdKey = &cobra.Command{
Use: "key [list|add|rm|passwd] [ID]", Use: "key [list|add|rm|passwd] [ID]",
Short: "manage keys (passwords)", Short: "manage keys (passwords)",
Long: ` Long: `
The "key" command manages keys (passwords) for accessing a repository. The "key" command manages keys (passwords) for accessing the repository.
`, `,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return runKey(globalOptions, args) return runKey(globalOptions, args)
@ -120,7 +120,7 @@ func changePassword(gopts GlobalOptions, repo *repository.Repository) error {
} }
func runKey(gopts GlobalOptions, args []string) error { func runKey(gopts GlobalOptions, args []string) error {
if len(args) < 1 || (args[0] == "rm" && len(args) != 2) { if len(args) < 1 || (args[0] == "rm" && len(args) != 2) || (args[0] != "rm" && len(args) != 1) {
return errors.Fatal("wrong number of arguments") return errors.Fatal("wrong number of arguments")
} }

View File

@ -11,9 +11,9 @@ import (
var cmdList = &cobra.Command{ var cmdList = &cobra.Command{
Use: "list [blobs|packs|index|snapshots|keys|locks]", Use: "list [blobs|packs|index|snapshots|keys|locks]",
Short: "list items in the repository", Short: "list objects in the repository",
Long: ` Long: `
The "list" command allows listing objects in the repository based on type.
`, `,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return runList(globalOptions, args) return runList(globalOptions, args)

View File

@ -10,8 +10,8 @@ var cmdRebuildIndex = &cobra.Command{
Use: "rebuild-index [flags]", Use: "rebuild-index [flags]",
Short: "build a new index file", Short: "build a new index file",
Long: ` Long: `
The "rebuild-index" command creates a new index by combining the index files The "rebuild-index" command creates a new index based on the pack files in the
into a new one. repository.
`, `,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return runRebuildIndex(globalOptions) return runRebuildIndex(globalOptions)

View File

@ -15,7 +15,7 @@ var cmdSnapshots = &cobra.Command{
Use: "snapshots", Use: "snapshots",
Short: "list all snapshots", Short: "list all snapshots",
Long: ` Long: `
The "snapshots" command lists all snapshots stored in a repository. The "snapshots" command lists all snapshots stored in the repository.
`, `,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return runSnapshots(snapshotOptions, globalOptions, args) return runSnapshots(snapshotOptions, globalOptions, args)

View File

@ -27,7 +27,7 @@ var unlockOptions UnlockOptions
func init() { func init() {
cmdRoot.AddCommand(unlockCmd) cmdRoot.AddCommand(unlockCmd)
unlockCmd.Flags().BoolVar(&unlockOptions.RemoveAll, "remove-all", false, "Remove all locks, even non-stale ones") unlockCmd.Flags().BoolVar(&unlockOptions.RemoveAll, "remove-all", false, "remove all locks, even non-stale ones")
} }
func runUnlock(opts UnlockOptions, gopts GlobalOptions) error { func runUnlock(opts UnlockOptions, gopts GlobalOptions) error {

View File

@ -9,7 +9,7 @@ import (
var versionCmd = &cobra.Command{ var versionCmd = &cobra.Command{
Use: "version", Use: "version",
Short: "Print version information", Short: "print version information",
Long: ` Long: `
The "version" command prints detailed information about the build environment The "version" command prints detailed information about the build environment
and the version of this software. and the version of this software.