Skip to content

Commit 9aa7f1b

Browse files
authored
Merge pull request #1464 from montag451/display-alias-expansion-on-error
incus: Display the alias expansion when execution of an alias fails
2 parents 315cb17 + e7f83d4 commit 9aa7f1b

File tree

14 files changed

+1597
-1462
lines changed

14 files changed

+1597
-1462
lines changed

cmd/incus/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"path"
99
"slices"
1010

11+
"github.com/kballard/go-shellquote"
1112
"github.com/spf13/cobra"
1213

1314
incus "github.com/lxc/incus/v6/client"
@@ -337,7 +338,11 @@ If you already added a remote server, make it the default with "incus remote swi
337338
}
338339

339340
// Default error handling
340-
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
341+
if os.Getenv("INCUS_ALIASES") == "1" {
342+
fmt.Fprintf(os.Stderr, i18n.G("Error while executing alias expansion: %s\n"), shellquote.Join(os.Args...))
343+
}
344+
345+
fmt.Fprintf(os.Stderr, i18n.G("Error: %v\n"), err)
341346

342347
// If custom exit status not set, use default error status.
343348
if globalCmd.ret == 0 {

0 commit comments

Comments
 (0)