Skip to content

Commit 19f3c01

Browse files
committed
fix: Make hidden command accept level comparison
1 parent 2172446 commit 19f3c01

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/util.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,14 @@ function cmd_count() {
247247
}
248248

249249
/**
250-
* Hide command unless options `--show-hidden` is specified.
251-
* @param { string | boolean } description - to display when comand is showed,
250+
* Hide command unless the option `--show-hidden` is specified.
251+
* @param { string | boolean } description - to display when comand is showed.
252+
* @param { integer } level - used to compare with command count.
252253
* @return Return a string to show command, else we return false.
253254
*/
254-
function hide_cmd(description) {
255+
function hide_cmd(description, level = 1) {
255256
if ((process.argv.includes('--show-hidden'))
256-
|| 1 <= cmd_count()) // When display in submenu!
257+
|| level <= cmd_count()) // When display in submenu!
257258
return description;
258259
return false;
259260
}

0 commit comments

Comments
 (0)