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

🚀 Feature: Add a --help CLI option #703

Closed
3 tasks done
JoshuaKGoldberg opened this issue Aug 25, 2023 · 2 comments · Fixed by #775
Closed
3 tasks done

🚀 Feature: Add a --help CLI option #703

JoshuaKGoldberg opened this issue Aug 25, 2023 · 2 comments · Fixed by #775
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Aug 25, 2023

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

Now that npx template-typescript-node-package is a supported -even recommended- use case, folks will want to be able to run npx template-typescript-node-package --help. Let's have it print out, for each of the available CLI options, what they do. Also the package version

Vaguely:

npx template-typescript-node-package --help

✨ template-typescript-node-package v1.2.3 ✨

A quickstart-friendly TypeScript template with comprehensive formatting, linting, releases, testing, and other great tooling built-in.

--base: Whether to scaffold the repository with:
  - `everything` that comes with the template _(recommended)_
  - `minimum` amounts of tooling, essentially opting out of everything
  - `prompt` for which portions to exclude
--create-repository: Whether to create a corresponding repository on github.com (if it doesn't yet exist)
...

👉 See https://github.com/JoshuaKGoldberg/template-typescript-node-package for more documentation.

Additional Info

See https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/77c10eb9d8dd384ae8e6417d26b92211185b6487/docs/Options.md for descriptions of existing CLI flags. You can directly copy & paste from there.

I'd also suggest running parseArgs to make sure Options.md isn't missing any options (it's entirely possible I forgot about one...).

Arguments are first parsed here: https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/0307eba66fe59c3a89a189352fd4797aad37736f/src/bin/index.ts#L34-L40

I think you'll want to add a --help arg there with a -h shorthand. See https://nodejs.org/api/util.html#utilparseargsconfig for examples of short.

@JoshuaKGoldberg JoshuaKGoldberg added type: feature New enhancement or request status: accepting prs Please, send a pull request to resolve this! labels Aug 25, 2023
@dominicduffin1
Copy link
Contributor

I'll have a go at this!

@dominicduffin1 dominicduffin1 mentioned this issue Sep 3, 2023
3 tasks
JoshuaKGoldberg added a commit that referenced this issue Nov 8, 2023
<!-- 👋 Hi, thanks for sending a PR to create-typescript-app! 💖.
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

- [x] Addresses an existing open issue: fixes #703 
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

<!-- Description of what is changed and how the code change does that.
-->

I've added functionality to print to the terminal help documentation
based on the existing docs when the `--help` or `-h` terminal flags are
used.

This will run in place of the functionality.

I've marked this as a draft PR as I have a few questions so it is not
yet complete, maybe you can assist @JoshuaKGoldberg :

- What kind of test coverage would you be looking for for this
functionality?
- What is the best approach to fetch the version number?
- I'm not clear what is meant by "running `parseargs`" to check for
missing options (from the issue).

Beyond that, is what I've included and how I've formatted the printout
what you were expecting?

---------

Co-authored-by: Josh Goldberg ✨ <[email protected]>
Copy link

github-actions bot commented Nov 8, 2023

🎉 This is included in version v1.43.0 🎉

The release is available on:

Cheers! 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants