Skip to content

Commit 8f9e261

Browse files
committed
fix: expose
1 parent fd93077 commit 8f9e261

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

nix/commands/commandsType.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,15 @@ rec {
106106
)
107107
helps;
108108

109-
prefix = attrByPath path (config.prefix or "") prefixes;
110-
111-
expose = attrByPath path (config.expose or (!forPackages)) exposes;
109+
prefix = attrByPath path config.prefix prefixes;
110+
111+
expose = attrByPath path
112+
(
113+
if config.expose != null
114+
then config.expose
115+
else (!forPackages)
116+
)
117+
exposes;
112118
in
113119
{
114120
"${if forPackages then "package" else "command"}" = value;

nix/commands/nestedOptions.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ in
166166

167167
expose = mkOption {
168168
type = types.nullOr types.bool;
169-
default = false;
169+
default = null;
170170
description = ''
171171
Can be used as ${flat "expose"} for all
172172
${nested "packages"} and ${nested "commands"}.

tests/extra/commands.lib.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ let inherit (pkgs) lib; in
6262
{
6363
category = "category 1";
6464
command = "${lib.getExe pkgs.gawk} $@";
65-
expose = false;
65+
expose = true;
6666
help = "[command] run awk";
6767
name = "a.b.awk";
6868
package = null;
@@ -71,7 +71,7 @@ let inherit (pkgs) lib; in
7171
{
7272
category = "category 1";
7373
command = "${lib.getExe pkgs.jq} $@";
74-
expose = false;
74+
expose = true;
7575
help = "[command] run jq";
7676
name = "a.b.jq-2";
7777
package = null;
@@ -80,7 +80,7 @@ let inherit (pkgs) lib; in
8080
{
8181
category = "category 1";
8282
command = ''printf "hello\n"'';
83-
expose = false;
83+
expose = true;
8484
help = ''[command] print "hello"'';
8585
name = "command with spaces";
8686
package = null;

0 commit comments

Comments
 (0)