Skip to content

Commit

Permalink
Merge pull request #1630 from eggplants/chore/capitalize-descriptions…
Browse files Browse the repository at this point in the history
…-shown-in-cli-help

Capitalize descriptions shown in CLI help
  • Loading branch information
Morriar authored Aug 31, 2023
2 parents a048821 + b0bcf65 commit 0c632f4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 20 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ Run `bundle install` and make sure Tapioca is properly installed:
$ tapioca help

Commands:
tapioca --version, -v # show version
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 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
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
Expand Down Expand Up @@ -120,7 +120,7 @@ Options:
# Default: sorbet/tapioca/config.yml
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes

get project ready for type checking
Get project ready for type checking
```
<!-- END_HELP_COMMAND_INIT -->

Expand Down Expand Up @@ -196,7 +196,7 @@ Options:
# Default: sorbet/tapioca/config.yml
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes

generate RBIs from gems
Generate RBIs from gems
```
<!-- END_HELP_COMMAND_GEM -->
Expand Down Expand Up @@ -483,7 +483,7 @@ Options:
# Default: sorbet/tapioca/config.yml
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
generate RBIs for dynamic methods
Generate RBIs for dynamic methods
```
<!-- END_HELP_COMMAND_DSL -->
Expand Down Expand Up @@ -846,7 +846,7 @@ Options:
# Default: sorbet/tapioca/config.yml
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
check duplicated definitions in shim RBIs
Check duplicated definitions in shim RBIs
```
<!-- END_HELP_COMMAND_CHECK_SHIMS -->
Expand Down
16 changes: 8 additions & 8 deletions lib/tapioca/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Cli < Thor
desc: "Verbose output for debugging purposes",
default: false

desc "init", "get project ready for type checking"
desc "init", "Get project ready for type checking"
def init
# We need to make sure that trackers stay enabled until the `gem` command is invoked
Runtime::Trackers.with_trackers_enabled do
Expand All @@ -41,7 +41,7 @@ def init
print_init_next_steps
end

desc "configure", "initialize folder structure and type checking configuration"
desc "configure", "Initialize folder structure and type checking configuration"
option :postrequire, type: :string, default: DEFAULT_POSTREQUIRE_FILE
def configure
command = Commands::Configure.new(
Expand All @@ -52,7 +52,7 @@ def configure
command.run
end

desc "require", "generate the list of files to be required by tapioca"
desc "require", "Generate the list of files to be required by tapioca"
option :postrequire, type: :string, default: DEFAULT_POSTREQUIRE_FILE
def require
command = Commands::Require.new(
Expand All @@ -62,7 +62,7 @@ def require
command.run
end

desc "todo", "generate the list of unresolved constants"
desc "todo", "Generate the list of unresolved constants"
option :todo_file,
type: :string,
desc: "Path to the generated todo RBI file",
Expand All @@ -79,7 +79,7 @@ def todo
command.run_with_deprecation
end

desc "dsl [constant...]", "generate RBIs for dynamic methods"
desc "dsl [constant...]", "Generate RBIs for dynamic methods"
option :outdir,
aliases: ["--out", "-o"],
banner: "directory",
Expand Down Expand Up @@ -168,7 +168,7 @@ def dsl(*constant_or_paths)
command.run
end

desc "gem [gem...]", "generate RBIs from gems"
desc "gem [gem...]", "Generate RBIs from gems"
option :outdir,
aliases: ["--out", "-o"],
banner: "directory",
Expand Down Expand Up @@ -298,7 +298,7 @@ def gem(*gems)
end
map "gems" => :gem

desc "check-shims", "check duplicated definitions in shim RBIs"
desc "check-shims", "Check duplicated definitions in shim RBIs"
option :gem_rbi_dir, type: :string, desc: "Path to gem RBIs", default: DEFAULT_GEM_DIR
option :dsl_rbi_dir, type: :string, desc: "Path to DSL RBIs", default: DEFAULT_DSL_DIR
option :shim_rbi_dir, type: :string, desc: "Path to shim RBIs", default: DEFAULT_SHIM_DIR
Expand Down Expand Up @@ -351,7 +351,7 @@ def annotations

map ["--version", "-v"] => :__print_version

desc "--version, -v", "show version"
desc "--version, -v", "Show version"
def __print_version
puts "Tapioca v#{Tapioca::VERSION}"
end
Expand Down
38 changes: 38 additions & 0 deletions spec/tapioca/cli/help_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# typed: strict
# frozen_string_literal: true

require "spec_helper"

module Tapioca
class HelpSpec < SpecWithProject
describe("cli::help") do
before(:all) do
project.bundle_install
end

it "must display the help when passing --help" do
result = @project.tapioca("--help")
stdout_lines = result.out.strip.split("\n")
assert_equal("Commands:", stdout_lines.first)
assert_empty_stderr(result)
assert_success_status(result)
end

it "must display the help when passing -h" do
result = @project.tapioca("-h")
stdout_lines = result.out.strip.split("\n")
assert_equal("Commands:", stdout_lines.first)
assert_empty_stderr(result)
assert_success_status(result)
end

it "must begin every command description of help text with a capital letter" do
result = @project.tapioca("--help")
stdout_lines = result.out.strip.split("\n")
assert_equal(stdout_lines.reject { / # [a-z]/.match?(_1) }.size, stdout_lines.size)
assert_empty_stderr(result)
assert_success_status(result)
end
end
end
end

0 comments on commit 0c632f4

Please sign in to comment.