better messaging for pull artifact command
- When there's an error stat'ing the output directory flux now prints the error: Before: ``` ✗ invalid output path ./ro-dir/foo ``` After: ``` ✗ invalid output path "./ro-dir/foo": stat ./ro-dir/foo: permission denied ``` - When no output directory is provided flux now explicitly says so in the error: Before: ``` ✗ invalid output path ``` After: ``` ✗ output path cannot be empty ``` Signed-off-by: Max Jonas Werner <mail@makk.es>
This commit is contained in:
@@ -67,11 +67,11 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ociURL := args[0]
|
||||
|
||||
if pullArtifactArgs.output == "" {
|
||||
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
|
||||
return fmt.Errorf("output path cannot be empty")
|
||||
}
|
||||
|
||||
if fs, err := os.Stat(pullArtifactArgs.output); err != nil || !fs.IsDir() {
|
||||
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
|
||||
return fmt.Errorf("invalid output path %q: %w", pullArtifactArgs.output, err)
|
||||
}
|
||||
|
||||
url, err := oci.ParseArtifactURL(ociURL)
|
||||
|
||||
Reference in New Issue
Block a user