Skip to content

Commit

Permalink
refactor: little things
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Jan 19, 2024
1 parent 56322e7 commit 9887d54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions modules/modules-docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ let
nixAndTOMLOrdered = optionsDocsPartitionedIsNixOnly.wrong;
nixExtra = optionsDocsPartitionedIsMain.wrong;
concatOpts = opts: (concatStringsSep "\n\n" (map optToMd opts));

# TODO: handle opt.relatedPackages. What is it for?
optToMd = opt:
let heading = (lib.showOption (filter isString opt.loc)) + (concatStrings (filter (x: !(isString x)) opt.loc)); in
let heading = lib.showOption (filter isString opt.loc) + concatStrings (filter (x: !(isString x)) opt.loc); in
''
### `${heading}`
Expand Down
6 changes: 2 additions & 4 deletions nix/commands/commandsType.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ rec {
}]
else alternative;

unknownFileName = "<unknown>";

normalizeCommandsFlat_ = { file ? unknownFileName, loc ? [ ], arg ? [ ] }:
normalizeCommandsFlat_ = { file ? unknownModule, loc ? [ ], arg ? [ ] }:
pipe arg [
(value: (mergeDefs loc [{ inherit file value; }]).defsFlat)
(map (config: flattenNonAttrsOrElse config config))
Expand All @@ -69,7 +67,7 @@ rec {
];


normalizeCommandsNested_ = { file ? unknownFileName, loc ? [ ], arg ? { } }:
normalizeCommandsNested_ = { file ? unknownModule, loc ? [ ], arg ? { } }:
pipe arg [
# typecheck and augment configs with missing attributes (if a config is an attrset)
(value: (mergeDefs loc [{ inherit file value; }]).defsNested)
Expand Down
2 changes: 1 addition & 1 deletion tests/core/commands.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ pkgs, devshell, runTest }:
let inherit (import ../../nix/commands/devshell.nix { inherit pkgs; }) devshellMenuCommandName; in
let inherit (import ../../nix/commands/lib.nix { inherit pkgs; }) devshellMenuCommandName; in
{
# Basic devshell usage
commands-1 =
Expand Down

0 comments on commit 9887d54

Please sign in to comment.