-
Notifications
You must be signed in to change notification settings - Fork 90
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
New syntax for customize mode #1709
Conversation
f116ca3
to
e9c48b6
Compare
I haven't looked at the code yet, but for the bikeshedding I think I prefer having a consistent hierarchy of commands over grouping commands that we think might be used together. I don't feel like going from |
@jneem so, you propose to get rid of the |
Yeah, good question. I guess it feels like Maybe Edit: but also, I don't think we need to block the release on bikeshedding this. It's experimental anyway... |
cli/tests/snapshot/inputs/customize-mode/unkonwn_field_path.ncl
Outdated
Show resolved
Hide resolved
Co-authored-by: jneem <joeneeman@gmail.com>
Co-authored-by: jneem <joeneeman@gmail.com>
Co-authored-by: jneem <joeneeman@gmail.com>
1174102
to
ce6e616
Compare
Implement ideas described in #1408 to improve the customize mode and avoid clashes between arguments and predefined flags such as
--override
.Overview
We now use a
<field path>=<nickel expression>
syntax for the customize mode:$ nickel export config.ncl -- input.bar.baz=1 'input.foo.bar="Hello, world!"' --override output.value=false
Having positional assignments also leaves the ability to add subcommands. This PR adds two of them,
list
andshow
(plushelp
automatically generated byclap
):Refactoring
As part of this PR, a few structural changes have been performed:
cli::customize
module which handles extracting an interface from a term has been separated into its own submodulecli::customize::interface
. It might come in handy if we want to make this notion of interface useful beyond the customize mode (e.g. for generating a man page from a configuration).QueryPath
has been moved entirely in the parser (some post processing was still done inprogram
), to make it consistent with the new code introduced to parse assignments on the command lineQueryPath
is renamedFieldPath
, because it's now useful beyond queries, and is just a wrapper aroundVec<LocIdent>
which represents a structured field path.Bikeshedding
There are different possibilities for the subcommands introduced, and I'm not entirely set:
nickel eval examples/config-gcc/config-gcc.ncl -- show path_libc
is currently almost equivalent tonickel query examples/config-gcc/config-gcc.ncl --path path_libc
.nickel query
instead of introducingshow
? It's more consistent to avoid duplicate, but on the other hand, one could argue the users would be exploring possibilities directly from the customize mode, and that changing the main subcommand is a non-obvious context switchshow
, should we name itquery
as well to be consistent, or keepshow
to avoid confusion between the two variants ofquery
?-- list
is not very far fromnickel query
without specifying a field path. Though it is not exactly the case, because-- list
makes a distinction between input fields and overridable fields, which is important for the UX of the customize mode.Future work
-- list
prettier