Skip to content
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

Some config doesn't work when loaded via --config-file #5282

Closed
teatwig opened this issue Jan 6, 2025 · 4 comments
Closed

Some config doesn't work when loaded via --config-file #5282

teatwig opened this issue Jan 6, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@teatwig
Copy link

teatwig commented Jan 6, 2025

Description

It seems like some config such as aliases and ui.default-command don't work if they're loaded via --config-file, but do work if they're specified in the regular config file.

Other options like

[colors]
working_copy = { bold = false }

work without issues.

Steps to Reproduce the Problem

  1. Create a new file jjconfig2.toml with the following contents:
[aliases]
l = ["log"]
  1. Run jj --config-file=jjconfig2.toml l

Expected Behavior

The log is displayed.

Actual Behavior

error: unrecognized subcommand 'l'

Specifications

  • Platform: Linux
  • Version: 0.25.0
@yuja
Copy link
Contributor

yuja commented Jan 7, 2025

Since aliases have to be expanded before parsing arguments, they cannot be defined by --config-file/--config args. Best we can do here is to show warning if --config-file would affect the expanded command.

@yuja yuja added the enhancement New feature or request label Jan 7, 2025
@teatwig
Copy link
Author

teatwig commented Jan 7, 2025

That makes sense and explains why it's only those options.

Maybe some background of why I'm trying to do this:

With git I'm always using two config files:

  1. My shared config file in ~/.config/git/config that's synced between all machines
  2. My machine specific config file in ~/.gitconfig (which can easily be changed with the CLI since it's the default)

Since jj doesn't allow both ~/.jjconfig.toml and ~/.config/jj/config.toml to exist at the same time I created an alias that always loads the shared config file as well.

For now I could probably just switch the files (since not being able to set them via the CLI is not a super big deal), but it would be nice if there was some kind of include mechanism that also supports alias expansion.

@yuja
Copy link
Contributor

yuja commented Jan 7, 2025

See #4926 (comment) for the multiple config files issue. Maybe we can change the default to ~/.config/jj/*.toml, but for now, you'll need to set JJ_CONFIG= env.

@teatwig
Copy link
Author

teatwig commented Jan 7, 2025

Thank you! That works well enough for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants