mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 18:27:38 +00:00
cli: allow overriding ui.editor
config by $JJ_EDITOR
variable
This commit is contained in:
parent
96d559a4b4
commit
d6d2b8b5bc
3 changed files with 13 additions and 1 deletions
|
@ -20,7 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
does, all files in the directory will be read, in alphabetical order.
|
does, all files in the directory will be read, in alphabetical order.
|
||||||
|
|
||||||
* You can now override the `$EDITOR` environment variable by setting the
|
* You can now override the `$EDITOR` environment variable by setting the
|
||||||
`ui.editor` config.
|
`ui.editor` config. There is also a new `$JJ_EDITOR` environment variable,
|
||||||
|
which has even higher priority than the config.
|
||||||
|
|
||||||
### Fixed bugs
|
### Fixed bugs
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@ fn env_overrides() -> config::Config {
|
||||||
if let Ok(value) = env::var("JJ_TIMESTAMP") {
|
if let Ok(value) = env::var("JJ_TIMESTAMP") {
|
||||||
builder = builder.set_override("user.timestamp", value).unwrap();
|
builder = builder.set_override("user.timestamp", value).unwrap();
|
||||||
}
|
}
|
||||||
|
if let Ok(value) = env::var("JJ_EDITOR") {
|
||||||
|
builder = builder.set_override("ui.editor", value).unwrap();
|
||||||
|
}
|
||||||
builder.build().unwrap()
|
builder.build().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,4 +77,12 @@ fn test_describe() {
|
||||||
.assert()
|
.assert()
|
||||||
.failure();
|
.failure();
|
||||||
assert!(get_stderr_string(&assert).contains("bad-editor-from-config"));
|
assert!(get_stderr_string(&assert).contains("bad-editor-from-config"));
|
||||||
|
|
||||||
|
// `$JJ_EDITOR` overrides `ui.editor` config
|
||||||
|
let assert = test_env
|
||||||
|
.jj_cmd(&repo_path, &["describe"])
|
||||||
|
.env("JJ_EDITOR", "bad-jj-editor-from-env")
|
||||||
|
.assert()
|
||||||
|
.failure();
|
||||||
|
assert!(get_stderr_string(&assert).contains("bad-jj-editor-from-env"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue