fix: let CLI options take precedence over user settings#19
Merged
Conversation
The command handlers merged user settings cli_opts on top of the
parsed CLI options via Keyword.merge(cli_opts, settings_opts). Since
Keyword.merge gives precedence to the second argument, any option set
in ~/.config/pix/settings.exs silently overrode the value passed
explicitly on the command line.
For example, with a settings default of
shell: %{cli_opts: [ssh: "default=~/.ssh/id_ed25519_hpe"]}
running 'pix shell --ssh="default=~/.ssh/athonet" ...' would still
mount id_ed25519_hpe, discarding the CLI value.
Swap the merge order so settings act as defaults and explicit CLI
options win. Applies to shell, run, ls, graph and upgrade commands.
visciang
approved these changes
Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Options set in
~/.config/pix/settings.exssilently override values passed explicitly on the command line.Each command handler merges the user settings on top of the parsed CLI options:
Keyword.merge(a, b)gives precedence to the second argument, so the settings file wins over the CLI.Reproduction
With a settings default:
running:
pix shell --ssh="default=~/.ssh/vm_key" dev_tools remote_load.sh my_service:latest 192.168.64.9still mounts
id_ed25519_workand discards the explicit--sshvalue:Fix
Swap the
Keyword.mergeargument order so user settings act as defaults and explicit CLI options take precedence:Applied consistently across all command handlers that perform this merge:
shell,run,ls,graph,upgrade.Notes
settings.exsdefaults keep working.:keep) options such asssh/secret/arg, an explicit CLI value now replaces the settings default for that key (CLI wins) rather than being clobbered by it.Verification
mix compile --warnings-as-errorspasses (pix app)mix format --check-formattedpasses