turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Tab completion in cli

Open TxHawks opened this issue 2 years ago • 4 comments

Describe the feature you'd like to request

A really nice feature of pnpm is it's tab completion (see here and here), which is available out of the box.

To me, pnpm's tab completion is most useful when used after the --filter flag, e.g., pnpm --filter <tab><tab>. With the --filter RFC in place, I think this could be a great productivity boost to the Turborepo cli.

Describe the solution you'd like

I'd like

  • turbo <tab><tab> to show a list of commands and flags
  • turbo --<tab><tab> to show a list of flags
  • turbo run <tab><tab> to show a list pipeline tasks and flags
  • turbo run [task] --<tab><tab> to show a list flags for the task
  • turbo run [task] --filter<tab><tab> to show a list of workspace packages

Describe alternatives you've considered

This can be developed as a third party npm package pretty easily, but this would probably make it more likely to get out of sync with changes to the Turborepo cli

TxHawks avatar Mar 21 '22 17:03 TxHawks

turbo should be moving to Cobra which has built in support for completion, the only problem is you would have to install turbo globally to get any use out of it since if you prefix it with yarn or pnpm I don't think completion will show.

samchouse avatar Mar 22 '22 11:03 samchouse

You could add something like this to your .bashrc or .zshrc: PATH="$PATH:./node_modules/.bin"

This will add the local node_modules to your path, and then there's no need to run Turbo through Yarn or pnpm.

TxHawks avatar Mar 22 '22 11:03 TxHawks

Yeah, that should do it. We would have to document this so that beginners are able to set this up too.

samchouse avatar Mar 22 '22 11:03 samchouse

+1 reason to moving to cobra, although mitchellh/cli supports this as well

jaredpalmer avatar Mar 22 '22 14:03 jaredpalmer

Going to close in favor of #3802 since it's much more recent.

anthonyshew avatar Feb 05 '24 06:02 anthonyshew