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

Capitalize descriptions shown in CLI help #1630

Merged

Conversation

eggplants
Copy link
Contributor

@eggplants eggplants commented Aug 30, 2023

Motivation

I noticed that the casing of descriptions' initial letters are not unified, so I tried to capitalize them.

$ bundle exec tapioca --version
Tapioca v0.11.8

$ bundle exec tapioca -h
Commands:
  tapioca --version, -v      # show version
  tapioca annotations        # Pull gem RBI annotations from remote sources
  tapioca check-shims        # check duplicated definitions in shim RBIs
  tapioca configure          # initialize folder structure and type checking configuration
  tapioca dsl [constant...]  # generate RBIs for dynamic methods
  tapioca gem [gem...]       # generate RBIs from gems
  tapioca help [COMMAND]     # Describe available commands or one specific command
  tapioca init               # get project ready for type checking
  tapioca require            # generate the list of files to be required by tapioca
  tapioca todo               # generate the list of unresolved constants

Options:
  -c, [--config=<config file path>]  # Path to the Tapioca configuration file
                                     # Default: sorbet/tapioca/config.yml
  -V, [--verbose], [--no-verbose]    # Verbose output for debugging purposes

Implementation

I replaced with following oneliner:

cat lib/tapioca/cli.rb | ruby -ple '$_=~/^ *desc / ? $_.gsub(/[a-zA-Z][^"]+"$/){_1.capitalize} : $_'

Here is output after substitution:

$ bundle exec tapioca -h
Commands:
  tapioca --version, -v      # Show version
  tapioca annotations        # Pull gem RBI annotations from remote sources
  tapioca check-shims        # Check duplicated definitions in shim RBIs
  tapioca configure          # Initialize folder structure and type checking configuration
  tapioca dsl [constant...]  # Generate RBIs for dynamic methods
  tapioca gem [gem...]       # Generate RBIs from gems
  tapioca help [COMMAND]     # Describe available commands or one specific command
  tapioca init               # Get project ready for type checking
  tapioca require            # Generate the list of files to be required by tapioca
  tapioca todo               # Generate the list of unresolved constants

Options:
  -c, [--config=<config file path>]  # Path to the Tapioca configuration file
                                     # Default: sorbet/tapioca/config.yml
  -V, [--verbose], [--no-verbose]    # Verbose output for debugging purposes

Tests

Check if:

  • tapioca -h and tapioca --help are worked correctly
  • all descriptions of tapioca --help start with upper letter

@eggplants eggplants requested a review from a team as a code owner August 30, 2023 18:26
@eggplants eggplants force-pushed the chore/capitalize-descriptions-shown-in-cli-help branch from ccdecba to 7534d86 Compare August 30, 2023 18:31
@Morriar
Copy link
Collaborator

Morriar commented Aug 30, 2023

This created a diff with the commands we show in the README. You can run bin/readme and commit the results.

@eggplants
Copy link
Contributor Author

@Morriar Thank you for your suggestion! I just updated in b0bcf65.

@Morriar
Copy link
Collaborator

Morriar commented Aug 31, 2023

Thanks! ❤️

@Morriar Morriar merged commit 0c632f4 into Shopify:main Aug 31, 2023
15 checks passed
@eggplants eggplants deleted the chore/capitalize-descriptions-shown-in-cli-help branch August 31, 2023 14:35
@shopify-shipit shopify-shipit bot temporarily deployed to production September 13, 2023 22:55 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants