2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 11:28:54 +00:00

Merge pull request #1784 from restic/improve-error-list

list: Improve error message
This commit is contained in:
Alexander Neumann 2018-05-18 21:53:09 +02:00
commit c284712cae
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ The "list" command allows listing objects in the repository based on type.
`,
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {
return runList(globalOptions, args)
return runList(cmd, globalOptions, args)
},
}
@ -26,9 +26,9 @@ func init() {
cmdRoot.AddCommand(cmdList)
}
func runList(opts GlobalOptions, args []string) error {
func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error {
if len(args) != 1 {
return errors.Fatal("type not specified")
return errors.Fatal("type not specified, usage: " + cmd.Use)
}
repo, err := OpenRepository(opts)

View File

@ -86,7 +86,7 @@ func testRunList(t testing.TB, tpe string, opts GlobalOptions) restic.IDs {
globalOptions.stdout = os.Stdout
}()
rtest.OK(t, runList(opts, []string{tpe}))
rtest.OK(t, runList(cmdList, opts, []string{tpe}))
return parseIDsFromReader(t, buf)
}