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

Export command-line related helpers from bin #16

Open
goce-cz opened this issue Oct 9, 2020 · 2 comments
Open

Export command-line related helpers from bin #16

goce-cz opened this issue Oct 9, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@goce-cz
Copy link
Collaborator

goce-cz commented Oct 9, 2020

Currently the bin package doesn't export anything and publishes only the executable binaries.

The package however contains some interesting code related to parsing and handling command line arguments.
We should export these and make them usable for building custom commands with easy and full TS support.

Namely I'm suggesting to export a helper that would create a command from given definitions, make it validate the arguments and automatically generate usage guide (--help).

@goce-cz goce-cz added the enhancement New feature or request label Oct 9, 2020
@goce-cz goce-cz added this to the v1.1.0 milestone Oct 9, 2020
@Fezzzi
Copy link
Contributor

Fezzzi commented Oct 13, 2020

I am surprised something like this doesn't already exist but I wasn't able to find anything according to the description. I mean, why not export it when its already there, on the other hand, I am not entirely sure that this functionality has bigger usability as exported module then as another CLI command. Furthermore, I providing it as a CLI command would preserve mentioned structure of the bin package which I prefer (I am always a bit wierded out when I import some modular functionality from anything containing bin).

@goce-cz
Copy link
Collaborator Author

goce-cz commented Oct 14, 2020

I am surprised something like this doesn't already exist

The code in the bin package just uses command-line-args and command-line-usage packages. We simply

  • combine the packages together
  • add strict typpings around it
  • generate the Synopsis section for the usage guide
  • trigger the guide automatically on --help option

So the functionality does exist, but still requires some manual work to get it to the shape we have. The stuff we would export is an opiniated all-in-one utility for handling standard commands.

has bigger usability as exported module then as another CLI command

How would you use CLI command to setup a CLI command? 🤔 I'm not suggesting to export the prepare-release, set-version or check-version functionality (even though it crossed my mind already). It's merely the code that orchestrates those command when you call spicy <command>.

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

No branches or pull requests

2 participants