Skip to content
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

Indenting Despite --descriptions-only or exclude tasks #71

Open
entozoon opened this issue Mar 17, 2021 · 1 comment
Open

Indenting Despite --descriptions-only or exclude tasks #71

entozoon opened this issue Mar 17, 2021 · 1 comment

Comments

@entozoon
Copy link

entozoon commented Mar 17, 2021

{
  "scripts": {
    "foo": "foo",
    "bar baz qux quux quuz": "bar"
  },
  "ntl": {
    "descriptions": {
      "foo": "Lorem ipsum"
    }
  }
}

Even with using the descriptions only option, it still indents the script name as if those other option(s) were listed:

$ npx ntl
? Select a task to run: (Use arrow keys)
❯                   foo › Lorem ipsum 
  bar baz qux quux quuz ›  
  
$ npx ntl -o   
? Select a task to run: (Use arrow keys)
❯                   foo › Lorem ipsum 

Why does it matter?
If you have the situation where you only want to show scripts that have descriptions, but then some of the hidden script names are really long

Same thing occurs if you exclude a task with the -e exclude task arg

@entozoon entozoon changed the title Indenting Despite --descriptions-only Indenting Despite --descriptions-only, or exclude tasks Mar 17, 2021
@entozoon entozoon changed the title Indenting Despite --descriptions-only, or exclude tasks Indenting Despite --descriptions-only or exclude tasks Mar 17, 2021
@MangelMaxime
Copy link

The same is true if there are pre or post tasks.

With only a release task.

> release › Run the tests and release a new version of the differents packages if needed

With a prerelease and release tasks.

>    release › Run the tests and release a new version of the different packages if needed

The problem seems to be that getLongName doesn't apply the different filters as they are applied when constructing the input list only.

ntl/cli.js

Lines 219 to 220 in 7f4126c

const getLongName = (name, message = "", pad) =>
`${name.padStart(longestScriptName)}${message}`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants