-
Notifications
You must be signed in to change notification settings - Fork 358
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
cli: improve discoverability of template-aliases #3189
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -561,6 +561,10 @@ impl TemplateAliasesMap { | |
Self::default() | ||
} | ||
|
||
pub fn symbol_aliases_keys(&self) -> Vec<&str> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
self.symbol_aliases.keys().map(|s| s.as_str()).collect_vec() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: simply return |
||
} | ||
|
||
/// Adds new substitution rule `decl = defn`. | ||
/// | ||
/// Returns error if `decl` is invalid. The `defn` part isn't checked. A bad | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,7 +179,7 @@ fn test_log_with_or_without_diff() { | |
insta::assert_snapshot!(stderr, @r###" | ||
error: the argument '--git' cannot be used with '--color-words' | ||
|
||
Usage: jj log --template <TEMPLATE> --no-graph --patch --git [PATHS]... | ||
Usage: jj log --template [<TEMPLATE>] --no-graph --patch --git [PATHS]... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unfortunate that the Another implementation idea is to inspect the
Doing that seems intrusive, but I think it's okay because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've implemented this variant in #3200. Please take a look. |
||
|
||
For more information, try '--help'. | ||
"###); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: something like
writeln!(hint, " {name}").unwrap()
also works. Or simply.map(|name| format!(..)).join("\n")
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format!
will allocate a new string. It's not that important here of course, but still... I thinkwriteln!(hint, " {name}").unwrap()
will be fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. It's not important here, but clippy might complain about that.