8000 Refined the definition of `build_cache.path` and the `--build-path` behaviour by cmaglie · Pull Request #2673 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

Refined the definition of build_cache.path and the --build-path behaviour #2673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed arguments.CheckFlagsConflicts helper
Previously it would reject only if ALL the arguments in the given set are used.

Now it rejects if AT LEAST TWO arguments of the given set are used.
  • Loading branch information
cmaglie committed Sep 18, 2024
commit f6e77b699231f6e016b4f60338eef44d8e3c204c
10 changes: 7 additions & 3 deletions internal/cli/arguments/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ import (

// CheckFlagsConflicts is a helper function useful to report errors when more than one conflicting flag is used
func CheckFlagsConflicts(command *cobra.Command, flagNames ...string) {
var used []string
for _, flagName := range flagNames {
if !command.Flag(flagName).Changed {
return
if command.Flag(flagName).Changed {
used = append(used, flagName)
}
}
flags := "--" + strings.Join(flagNames, ", --")
if len(used) <= 1 {
return
}
flags := "--" + strings.Join(used, ", --")
msg := i18n.Tr("Can't use the following flags together: %s", flags)
feedback.Fatal(msg, feedback.ErrBadArgument)
}
Expand Down
0