Closed dkarlovi closed 4 years ago
I'm not sure I understand what the error here is.
There is not a test:coverage
command. That is a valid error.
It was autocompleted, for whatever reason. Notice that cov
was not offered, for example.
Also, nothing gets completed with just test:
.
Oh, just figured out why coverage was completed, I have a folder named like that:
$ ls
coverage nest-cli.json package.json src tsconfig.build.json yarn.lock
dist node_modules README.md test tsconfig.json
$ touch x123
$ yarn run test:x<TAB>123 ^C
Did you try the suggestion in the bottom of the readme?
Just now (didn't notice it before). It behaves the same, only the options are presented differently. It would still complete coverage
, for example.
Then yeah not sure I'm able to do anything about it. I tried looking into this in the past and came up short.
Happy to hear suggestions though.
I've got package.json files with a similar convention and have found it not a big deal to do yarn t<Tab><Tab><Tab>
to get test:cov
completed.
This looks related: https://stackoverflow.com/a/12495727/672885
No, this specifically avoids redefining it, quote:
modifying COMP_WORDBREAKS in your completion script is not safe (as it is a global variable and it has the side effect of affecting the behavior of other completion scripts - for example scp). Therefore, bash completion offers some helper methods which you can use to achieve your goal in a better and more safer way.
I've checked with Maven, which uses this and the difference is their completion escapes the character:
$ mvn <TAB><TAB>
assembly:assembly dependency:sources
clean dependency:tree
compile dependency:unpack
dependency:analyze dependency:unpack-dependencies
dependency:analyze-dep-mgt deploy
dependency:analyze-duplicate eclipse:eclipse
dependency:analyze-only idea:idea
dependency:analyze-report install
dependency:build-classpath package
dependency:copy plexus:app
dependency:copy-dependencies plexus:bundle-application
dependency:get plexus:bundle-runtime
dependency:go-offline plexus:descriptor
dependency:list plexus:runtime
dependency:properties plexus:service
dependency:purge-local-repository site
dependency:resolve test/
dependency:resolve-plugins verify
$ mvn depe<TAB>ndency\:<TAB>
dependency:analyze dependency:list
dependency:analyze-dep-mgt dependency:properties
dependency:analyze-duplicate dependency:purge-local-repository
dependency:analyze-only dependency:resolve
dependency:analyze-report dependency:resolve-plugins
dependency:build-classpath dependency:sources
dependency:copy dependency:tree
dependency:copy-dependencies dependency:unpack
dependency:get dependency:unpack-dependencies
dependency:go-offline
$ mvn dependency\:ana<TAB>lyze<TAB>
dependency:analyze dependency:analyze-only
dependency:analyze-dep-mgt dependency:analyze-report
dependency:analyze-duplicate
Adding the backslash manually does work, I get test\:cov
completed correctly (but it again removes the backslash).
Escaping special chars like colons, spaced etc would probably fix it without other changes.
Fixed in #48
Example (generated by Nest.js CLI):
Sample: