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

Is there a way to run cowthink directly via npx #46

Closed
dgwyer opened this issue Dec 1, 2018 · 3 comments · Fixed by #63
Closed

Is there a way to run cowthink directly via npx #46

dgwyer opened this issue Dec 1, 2018 · 3 comments · Fixed by #63

Comments

@dgwyer
Copy link

dgwyer commented Dec 1, 2018

With npx you don't have to have the module installed directly on your computer. So you can do something like:

npx cowsay Hello!

But, this doesn't work:

npx cowthink Hello!

Is this because npx runs the module name cowsay and just runs the first command it finds in the "bin" field in package.json? Is there a way to run cowthink directly from npx as it is or with some code changes to the module?

This is relevant to me as I'm using your module to teach myself how to create node cli modules and would be interested in running multiple cli commands from a module invoked directly via npm remote calls.

@piuccio
Copy link
Owner

piuccio commented Dec 3, 2018

I'm not quite sure how npx works, but if you find some documentation please post it here.

One option is to have a --think option, for now say and think is handled separately from other options but it wouldn't hurt to change that.

Feel free to open a PR

@ricksbrown
Copy link
Contributor

In java cowsay I faced a similar issue and have three main entry points:

  • Cowsay.say
  • Cowsay.think
  • Cowsay.main - this is the main entry point, it simply delegates to Cowsay.say unless it finds the flag --cowthink. The other methods do not recognise this arg.

I think a similar approach could work here.

@piuccio
Copy link
Owner

piuccio commented Aug 24, 2020

I just merged a PR that allows to run npx cowsay --think hello. It'll be published eventually with cowsay 2

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

Successfully merging a pull request may close this issue.

3 participants