-
Notifications
You must be signed in to change notification settings - Fork 89
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
Refactor commands #297
base: main
Are you sure you want to change the base?
Refactor commands #297
Conversation
deemp
commented
Jan 13, 2024
•
edited
Loading
edited
- Move parts of the commands module to separate files
d035c0d
to
945a241
Compare
thanks, LGTM but just needs a rebase |
945a241
to
a22d6c4
Compare
Rebased |
modules/modules-docs.nix
Outdated
@@ -121,7 +121,7 @@ let | |||
|
|||
# TODO: handle opt.relatedPackages. What is it for? | |||
optToMd = opt: | |||
let heading = lib.showOption opt.loc; in | |||
let heading = (lib.showOption (filter isString opt.loc)) + (concatStrings (filter (x: !(isString x)) opt.loc)); in |
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: the surrounding parenthesis is not needed
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.
Fixed that
```console | ||
(package or string convertible to it) or (list with two elements of types: [ string (package or string convertible to it) ]) or (flatOptions) | ||
``` |
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.
For flake-parts users, this mix of types would make it hard to merge commands coming from different places. I would rather keep either the list, or the attrset of commands, but not both.
Let's keep things simple.
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.
flake-parts
I had no problems with flake-parts. See repro. May require nix flake update
.
type of commands
I couldn't invent a new option name so I made commands
either a list or an attrset.
I prefer attrsets with attrNames as command group names.
I think it should be the first-class feature and should be documented and type checked.
So, I see these approaches:
- Allow
commands
only as anattrset
- Create a new option for commands as an attrset, leave commands as a
list
- What should be the name?
- Allow
commands
to be either alist
or anattrset
, do something about merging lists and attrsets for flake-parts users.- What in particular can make it hard to merge?
- I need a concrete example of a devshell setup with flake-parts
- I find it nice to have a simpler representation that can be used to explain the nested options.
- Provide just a function that converts a
commands
attrset to a list- I don't like this idea because then
commands
attrset won't be the first-class feature and can't naturally go into docs.
- I don't like this idea because then
a22d6c4
to
4b4d7ca
Compare
4b4d7ca
to
ffa33c6
Compare