jj icon indicating copy to clipboard operation
jj copied to clipboard

cli: allow arg list in `ui.default-command`

Open evaporei opened this issue 1 year ago • 6 comments

Summary

Hello, I use ui.default-command a lot, but I miss it having default arguments too.

Since ui.diff.tool accepts both String and Vec<String>, I thought it wouldn't be a problem to implement it. If this is against any design consideration you all have, feel free to close it.

Thanks a lot for the CLI though, I've been enjoying it a lot over git :blush:

Checklist

If applicable:

  • [x] I have updated CHANGELOG.md
  • [x] I have updated the documentation (README.md, docs/, demos/)
  • [x] I have updated the config schema (cli/src/config-schema.json)
  • [ ] I have added tests to cover my changes

I'm not sure this is necessary

evaporei avatar Dec 19 '23 10:12 evaporei

Hey, thanks for your PR!

I'm not sure this is necessary

FYI this is currently possible:

[ui]
default-command = "sl"
[aliases]
sl = ["log", "-r", "crit"]

crackcomm avatar Dec 19 '23 11:12 crackcomm

Oh I see! it is just more indirect.

evaporei avatar Dec 19 '23 13:12 evaporei

The necessary part was about the tests 😅

evaporei avatar Dec 19 '23 13:12 evaporei

I would think this would also allow nice little variations like the following:

ui.default-command = ["foo", "-r", "::@"]
aliases.foo = [ "log", "--reversed" ]

Which would expand to jj log --reversed -r ::@ (I hope!)

This does work btw :)

2023-12-21_16-30

evaporei avatar Dec 21 '23 19:12 evaporei

Hi! I independently stumbled on this myself and wrote https://github.com/martinvonz/jj/pull/3195 without knowing this existed; are you still working on this? If so I'm happy to defer to you here, if not I can work on getting my own PR finalized instead.

torquestomp avatar Mar 03 '24 16:03 torquestomp

Hey @torquestomp I ended up not continuing because of personal issues (moving, sickness etc) I'll only be able to come back to it in a month or two. Feel free to continue/finish the work :slightly_smiling_face:

evaporei avatar Mar 05 '24 13:03 evaporei

Closing since #3195 was merged.

bnjmnt4n avatar Apr 27 '24 07:04 bnjmnt4n