1
0
mirror of synced 2026-02-06 19:05:55 +00:00

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:
Max Jonas Werner
2023-04-13 12:40:10 +02:00
parent 3d1173a2cd
commit 6700aac4a4

View File

@@ -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)