Skip to content

Commit

Permalink
fix: Make hidden command accept level comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Nov 13, 2023
1 parent 2172446 commit 19f3c01
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,14 @@ function cmd_count() {
}

/**
* Hide command unless options `--show-hidden` is specified.
* @param { string | boolean } description - to display when comand is showed,
* Hide command unless the option `--show-hidden` is specified.
* @param { string | boolean } description - to display when comand is showed.
* @param { integer } level - used to compare with command count.
* @return Return a string to show command, else we return false.
*/
function hide_cmd(description) {
function hide_cmd(description, level = 1) {
if ((process.argv.includes('--show-hidden'))
|| 1 <= cmd_count()) // When display in submenu!
|| level <= cmd_count()) // When display in submenu!
return description;
return false;
}
Expand Down

0 comments on commit 19f3c01

Please sign in to comment.