cli-template 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +28 -33
- data/lib/cli_template/git.rb +22 -0
- data/lib/cli_template/version.rb +1 -1
- data/lib/templates/colon_namespaces/.rspec +1 -0
- data/lib/templates/colon_namespaces/README.md.tt +1 -1
- data/lib/templates/colon_namespaces/lib/%underscored_name%/help/completions.md.tt +9 -9
- data/lib/templates/colon_namespaces/lib/%underscored_name%/help/completions/script.md.tt +1 -1
- data/lib/templates/colon_namespaces/lib/%underscored_name%/help/hello.md.tt +1 -1
- data/lib/templates/colon_namespaces/lib/%underscored_name%/help/main.md.tt +3 -1
- data/lib/templates/colon_namespaces/lib/%underscored_name%/help/sub/goodbye.md.tt +4 -4
- data/lib/templates/colon_namespaces/spec/lib/cli_spec.rb.tt +0 -2
- data/lib/templates/default/%project_name%.gemspec.tt +17 -4
- data/lib/templates/default/.rspec +1 -0
- data/lib/templates/default/README.md.tt +1 -1
- data/lib/templates/default/lib/%underscored_name%/help/completion.md.tt +1 -3
- data/lib/templates/default/lib/%underscored_name%/help/hello.md.tt +1 -1
- data/lib/templates/default/lib/%underscored_name%/help/sub/goodbye.md.tt +1 -1
- data/lib/templates/default/spec/lib/cli_spec.rb.tt +0 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574675906a5563a0fd58d1afd7c4e9d28aa72ca2689bdf8802ad11212f7b9d18
|
4
|
+
data.tar.gz: 3950f3c40baef9b16aa3a11115c153f148af09f5b7c0e673a8d1b985571b089f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad3011b0a62b11ede64d8272d8b990e6441afb860e778d07ed9aa8a7885574d700e5efce1e59cfdb359069ac500ce9a640c55a8e927a3eebabcf1233d42247b6
|
7
|
+
data.tar.gz: 56ce4cb3011d19e6740bfc7b2a16c007bc37641d112d087c4ff3930ec422f74986dc785ad271a09e9fe389d1ea5fc49e2416c64d5569524156c6b73348b8ebc8
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [4.0.1]
|
7
|
+
- dynamically get git user name and email in starter project
|
8
|
+
- update cli help menus
|
9
|
+
|
6
10
|
## [4.0.0]
|
7
11
|
- use zeitwerk for autoload
|
8
12
|
|
data/README.md
CHANGED
@@ -14,25 +14,28 @@ The generated CLI project comes with:
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
exe/mycli hello world
|
21
|
-
exe/mycli sub:goodbye world # namespaced command with colons
|
22
|
-
```
|
17
|
+
cli-template new mycli
|
18
|
+
cd mycli
|
19
|
+
exe/mycli hello world
|
23
20
|
|
24
21
|
The above generated a starter CLI project called `mycli` with a working hello command. The created project also has starter specs for you 😁
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
should goodbye world
|
23
|
+
$ rake
|
24
|
+
Mycli::CLI
|
25
|
+
mycli
|
26
|
+
should hello world
|
27
|
+
should goodbye world
|
32
28
|
|
33
|
-
Finished in 1.12 seconds (files took 0.71706 seconds to load)
|
34
|
-
2 examples, 0 failures
|
35
|
-
|
29
|
+
Finished in 1.12 seconds (files took 0.71706 seconds to load)
|
30
|
+
2 examples, 0 failures
|
31
|
+
|
32
|
+
### Subcommands
|
33
|
+
|
34
|
+
Use the `--subcommand` to have the generator also include a subcommand example.
|
35
|
+
|
36
|
+
cli-template new mycli --subcommand
|
37
|
+
cd mycli
|
38
|
+
exe/foo sub goodbye # subcommand example
|
36
39
|
|
37
40
|
## Release
|
38
41
|
|
@@ -44,9 +47,7 @@ Once you are satisfied with the CLI tool, you can release it as a gem.
|
|
44
47
|
|
45
48
|
And run:
|
46
49
|
|
47
|
-
|
48
|
-
rake release
|
49
|
-
```
|
50
|
+
rake release
|
50
51
|
|
51
52
|
When installed as a gem, you no longer have to prepend exe in front of the command. For example, `exe/mycli` becomes the `mycli` command.
|
52
53
|
|
@@ -59,11 +60,9 @@ There are 2 different templates that the tool generates from:
|
|
59
60
|
|
60
61
|
To use the different templates:
|
61
62
|
|
62
|
-
|
63
|
-
TEMPLATE=
|
64
|
-
|
65
|
-
cli-template new mycli # same as TEMPLATE=default
|
66
|
-
```
|
63
|
+
TEMPLATE=colon_namespaces cli-template new mycli
|
64
|
+
TEMPLATE=default cli-template new mycli
|
65
|
+
cli-template new mycli # same as TEMPLATE=default
|
67
66
|
|
68
67
|
## Auto Completion
|
69
68
|
|
@@ -73,13 +72,11 @@ There is support for TAB completion in the newly generated CLI project for the d
|
|
73
72
|
|
74
73
|
Remember to re-load the shell. Note, the auto completion will only work if the cli command is avaialble in your PATH. You can do this by installing the gem. You can also create a wrapper bash script that calls to your development cli command like so:
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
chmod a+x /usr/local/bin/mycli
|
82
|
-
```
|
75
|
+
cat > /usr/local/bin/mycli << 'EOL'
|
76
|
+
#!/bin/bash
|
77
|
+
exec ~/src/mycli/exe/mycli "$@"
|
78
|
+
EOL
|
79
|
+
chmod a+x /usr/local/bin/mycli
|
83
80
|
|
84
81
|
### Experimental Auto Completion Support for colon_namespaces Template
|
85
82
|
|
@@ -94,9 +91,7 @@ Suggestions to are appreciated!
|
|
94
91
|
|
95
92
|
## Installation
|
96
93
|
|
97
|
-
|
98
|
-
gem install cli-template
|
99
|
-
```
|
94
|
+
gem install cli-template
|
100
95
|
|
101
96
|
## Contributing
|
102
97
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module CliTemplate
|
2
|
+
class Git
|
3
|
+
class << self
|
4
|
+
def user_name
|
5
|
+
sh "git config --get user.name"
|
6
|
+
end
|
7
|
+
|
8
|
+
def user_email
|
9
|
+
sh "git config --get user.email"
|
10
|
+
end
|
11
|
+
|
12
|
+
def sh(command)
|
13
|
+
puts "=> #{command}"
|
14
|
+
stdout = `#{command}`
|
15
|
+
out = stdout.strip
|
16
|
+
puts "stdout #{stdout.inspect}"
|
17
|
+
puts "out #{out.inspect}"
|
18
|
+
return out if !out&.empty?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/cli_template/version.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Dependency Status](https://gemnasium.com/USER/REPO.png)](https://gemnasium.com/USER/REPO)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/USER/REPO/badge.png)](https://coveralls.io/r/USER/REPO)
|
7
7
|
[![Join the chat at https://gitter.im/USER/REPO](https://badges.gitter.im/USER/REPO.svg)](https://gitter.im/USER/REPO?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
8
|
-
[![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign
|
8
|
+
[![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=<%= project_name %>)
|
9
9
|
|
10
10
|
TODO: Write a gem description
|
11
11
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
Prints words for TAB auto-completion.
|
2
2
|
|
3
|
-
Examples
|
3
|
+
## Examples
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
<%= project_name %> completions
|
6
|
+
<%= project_name %> completions hello
|
7
|
+
<%= project_name %> completions hello name
|
8
8
|
|
9
9
|
To enable, TAB auto-completion add the following to your profile:
|
10
10
|
|
11
|
-
|
11
|
+
eval $(<%= project_name %> completions:script)
|
12
12
|
|
13
13
|
Auto-completion example usage:
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
<%= project_name %> [TAB]
|
16
|
+
<%= project_name %> hello [TAB]
|
17
|
+
<%= project_name %> hello name [TAB]
|
18
|
+
<%= project_name %> hello name --[TAB]
|
@@ -1,5 +1,5 @@
|
|
1
|
-
Examples
|
1
|
+
## Examples
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
<%= project_name %> sub:goodbye
|
4
|
+
<%= project_name %> sub:goodbye NAME
|
5
|
+
<%= project_name %> sub:goodbye NAME --from me
|
@@ -6,12 +6,12 @@ require "<%= underscored_name %>/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "<%= project_name %>"
|
8
8
|
spec.version = <%= project_class_name %>::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["<%= CliTemplate::Git.user_name %>"]
|
10
|
+
spec.email = ["<%= CliTemplate::Git.user_email %>"]
|
11
11
|
spec.summary = "Generated with cli-template tool. Please write a gem summary"
|
12
12
|
spec.description = "Generated with cli-template tool. Write a longer description or delete this line."
|
13
|
-
spec.homepage = ""
|
14
|
-
spec.license = "
|
13
|
+
spec.homepage = "https://github.com/USERNAME/<%= project_name %>" # TODO: changeme
|
14
|
+
spec.license = ""
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.bindir = "exe"
|
@@ -29,4 +29,17 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "cli_markdown"
|
30
30
|
spec.add_development_dependency "rake"
|
31
31
|
spec.add_development_dependency "rspec"
|
32
|
+
|
33
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
34
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
35
|
+
if spec.respond_to?(:metadata)
|
36
|
+
# spec.metadata["allowed_push_host"] = ""
|
37
|
+
|
38
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
39
|
+
|
40
|
+
# spec.metadata["source_code_uri"] = ""
|
41
|
+
# spec.metadata["changelog_uri"] = ""
|
42
|
+
else
|
43
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
44
|
+
end
|
32
45
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Dependency Status](https://gemnasium.com/USER/REPO.png)](https://gemnasium.com/USER/REPO)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/USER/REPO/badge.png)](https://coveralls.io/r/USER/REPO)
|
7
7
|
[![Join the chat at https://gitter.im/USER/REPO](https://badges.gitter.im/USER/REPO.svg)](https://gitter.im/USER/REPO?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
8
|
-
[![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign
|
8
|
+
[![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=<%= project_name %>)
|
9
9
|
|
10
10
|
TODO: Write a gem description
|
11
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/cli_template/autoloader.rb
|
175
175
|
- lib/cli_template/cli.rb
|
176
176
|
- lib/cli_template/command.rb
|
177
|
+
- lib/cli_template/git.rb
|
177
178
|
- lib/cli_template/help.rb
|
178
179
|
- lib/cli_template/help/new.md
|
179
180
|
- lib/cli_template/helper.rb
|
@@ -256,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
257
|
- !ruby/object:Gem::Version
|
257
258
|
version: '0'
|
258
259
|
requirements: []
|
259
|
-
rubygems_version: 3.0.
|
260
|
+
rubygems_version: 3.0.6
|
260
261
|
signing_key:
|
261
262
|
specification_version: 4
|
262
263
|
summary: Generate a CLI tool quickly
|