Skip to content

Commit 0c632f4

Browse files
authored
Merge pull request #1630 from eggplants/chore/capitalize-descriptions-shown-in-cli-help
Capitalize descriptions shown in CLI help
2 parents a048821 + b0bcf65 commit 0c632f4

File tree

3 files changed

+58
-20
lines changed

3 files changed

+58
-20
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ Run `bundle install` and make sure Tapioca is properly installed:
7171
$ tapioca help
7272

7373
Commands:
74-
tapioca --version, -v # show version
74+
tapioca --version, -v # Show version
7575
tapioca annotations # Pull gem RBI annotations from remote sources
76-
tapioca check-shims # check duplicated definitions in shim RBIs
77-
tapioca configure # initialize folder structure and type checking configuration
78-
tapioca dsl [constant...] # generate RBIs for dynamic methods
79-
tapioca gem [gem...] # generate RBIs from gems
76+
tapioca check-shims # Check duplicated definitions in shim RBIs
77+
tapioca configure # Initialize folder structure and type checking configuration
78+
tapioca dsl [constant...] # Generate RBIs for dynamic methods
79+
tapioca gem [gem...] # Generate RBIs from gems
8080
tapioca help [COMMAND] # Describe available commands or one specific command
81-
tapioca init # get project ready for type checking
82-
tapioca require # generate the list of files to be required by tapioca
83-
tapioca todo # generate the list of unresolved constants
81+
tapioca init # Get project ready for type checking
82+
tapioca require # Generate the list of files to be required by tapioca
83+
tapioca todo # Generate the list of unresolved constants
8484

8585
Options:
8686
-c, [--config=<config file path>] # Path to the Tapioca configuration file
@@ -120,7 +120,7 @@ Options:
120120
# Default: sorbet/tapioca/config.yml
121121
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
122122

123-
get project ready for type checking
123+
Get project ready for type checking
124124
```
125125
<!-- END_HELP_COMMAND_INIT -->
126126

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

199-
generate RBIs from gems
199+
Generate RBIs from gems
200200
```
201201
<!-- END_HELP_COMMAND_GEM -->
202202
@@ -483,7 +483,7 @@ Options:
483483
# Default: sorbet/tapioca/config.yml
484484
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
485485
486-
generate RBIs for dynamic methods
486+
Generate RBIs for dynamic methods
487487
```
488488
<!-- END_HELP_COMMAND_DSL -->
489489
@@ -846,7 +846,7 @@ Options:
846846
# Default: sorbet/tapioca/config.yml
847847
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
848848
849-
check duplicated definitions in shim RBIs
849+
Check duplicated definitions in shim RBIs
850850
```
851851
<!-- END_HELP_COMMAND_CHECK_SHIMS -->
852852

lib/tapioca/cli.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Cli < Thor
2323
desc: "Verbose output for debugging purposes",
2424
default: false
2525

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

44-
desc "configure", "initialize folder structure and type checking configuration"
44+
desc "configure", "Initialize folder structure and type checking configuration"
4545
option :postrequire, type: :string, default: DEFAULT_POSTREQUIRE_FILE
4646
def configure
4747
command = Commands::Configure.new(
@@ -52,7 +52,7 @@ def configure
5252
command.run
5353
end
5454

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

65-
desc "todo", "generate the list of unresolved constants"
65+
desc "todo", "Generate the list of unresolved constants"
6666
option :todo_file,
6767
type: :string,
6868
desc: "Path to the generated todo RBI file",
@@ -79,7 +79,7 @@ def todo
7979
command.run_with_deprecation
8080
end
8181

82-
desc "dsl [constant...]", "generate RBIs for dynamic methods"
82+
desc "dsl [constant...]", "Generate RBIs for dynamic methods"
8383
option :outdir,
8484
aliases: ["--out", "-o"],
8585
banner: "directory",
@@ -168,7 +168,7 @@ def dsl(*constant_or_paths)
168168
command.run
169169
end
170170

171-
desc "gem [gem...]", "generate RBIs from gems"
171+
desc "gem [gem...]", "Generate RBIs from gems"
172172
option :outdir,
173173
aliases: ["--out", "-o"],
174174
banner: "directory",
@@ -298,7 +298,7 @@ def gem(*gems)
298298
end
299299
map "gems" => :gem
300300

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

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

354-
desc "--version, -v", "show version"
354+
desc "--version, -v", "Show version"
355355
def __print_version
356356
puts "Tapioca v#{Tapioca::VERSION}"
357357
end

spec/tapioca/cli/help_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# typed: strict
2+
# frozen_string_literal: true
3+
4+
require "spec_helper"
5+
6+
module Tapioca
7+
class HelpSpec < SpecWithProject
8+
describe("cli::help") do
9+
before(:all) do
10+
project.bundle_install
11+
end
12+
13+
it "must display the help when passing --help" do
14+
result = @project.tapioca("--help")
15+
stdout_lines = result.out.strip.split("\n")
16+
assert_equal("Commands:", stdout_lines.first)
17+
assert_empty_stderr(result)
18+
assert_success_status(result)
19+
end
20+
21+
it "must display the help when passing -h" do
22+
result = @project.tapioca("-h")
23+
stdout_lines = result.out.strip.split("\n")
24+
assert_equal("Commands:", stdout_lines.first)
25+
assert_empty_stderr(result)
26+
assert_success_status(result)
27+
end
28+
29+
it "must begin every command description of help text with a capital letter" do
30+
result = @project.tapioca("--help")
31+
stdout_lines = result.out.strip.split("\n")
32+
assert_equal(stdout_lines.reject { / # [a-z]/.match?(_1) }.size, stdout_lines.size)
33+
assert_empty_stderr(result)
34+
assert_success_status(result)
35+
end
36+
end
37+
end
38+
end

0 commit comments

Comments
 (0)