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:
commit
c284712cae
@ -18,7 +18,7 @@ The "list" command allows listing objects in the repository based on type.
|
|||||||
`,
|
`,
|
||||||
DisableAutoGenTag: true,
|
DisableAutoGenTag: true,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
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)
|
cmdRoot.AddCommand(cmdList)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runList(opts GlobalOptions, args []string) error {
|
func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error {
|
||||||
if len(args) != 1 {
|
if len(args) != 1 {
|
||||||
return errors.Fatal("type not specified")
|
return errors.Fatal("type not specified, usage: " + cmd.Use)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := OpenRepository(opts)
|
repo, err := OpenRepository(opts)
|
||||||
|
@ -86,7 +86,7 @@ func testRunList(t testing.TB, tpe string, opts GlobalOptions) restic.IDs {
|
|||||||
globalOptions.stdout = os.Stdout
|
globalOptions.stdout = os.Stdout
|
||||||
}()
|
}()
|
||||||
|
|
||||||
rtest.OK(t, runList(opts, []string{tpe}))
|
rtest.OK(t, runList(cmdList, opts, []string{tpe}))
|
||||||
return parseIDsFromReader(t, buf)
|
return parseIDsFromReader(t, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user