dry-cli 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +12 -0
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +10 -0
- data/.github/ISSUE_TEMPLATE/---bug-report.md +30 -0
- data/.github/ISSUE_TEMPLATE/---feature-request.md +18 -0
- data/.github/workflows/custom_ci.yml +77 -0
- data/.github/workflows/docsite.yml +34 -0
- data/.github/workflows/sync_configs.yml +34 -0
- data/.gitignore +11 -0
- data/.rspec +4 -0
- data/.rubocop.yml +89 -0
- data/CHANGELOG.md +70 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +18 -0
- data/LICENSE +20 -0
- data/README.md +31 -0
- data/Rakefile +16 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docsite/source/index.html.md +588 -0
- data/dry-cli.gemspec +36 -0
- data/lib/dry/cli.rb +129 -0
- data/lib/dry/cli/banner.rb +127 -0
- data/lib/dry/cli/command.rb +367 -0
- data/lib/dry/cli/command_registry.rb +211 -0
- data/lib/dry/cli/errors.rb +39 -0
- data/lib/dry/cli/option.rb +132 -0
- data/lib/dry/cli/parser.rb +140 -0
- data/lib/dry/cli/program_name.rb +21 -0
- data/lib/dry/cli/registry.rb +328 -0
- data/lib/dry/cli/usage.rb +91 -0
- data/lib/dry/cli/utils/files.rb +443 -0
- data/lib/dry/cli/version.rb +8 -0
- data/script/ci +51 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ca4829f1591a699235699ea74d43bfa27270201e9052fd72683a6c4768d6d007
|
4
|
+
data.tar.gz: d4fa94fe8909cb3898cfe4b3fd2b80009deeab6078d7cb48396eb24297798057
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 574b4f554453f8df89670bf6a1ccd3bb156fef15a3b3a53a1fec4c05dbcf8dac843fcd04194c3a63b8a77bc5708608ec3ed462f6941a36e5053fd5c0667774c8
|
7
|
+
data.tar.gz: 402e1d35e7f12d93782f0ebb47762ac3a3db98bc687743e91997cf400f5fa64abd55e1e626347b9119ce27ce90a39e7eab23f14f05da6f008e0f1e0ebc717850
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F41B Bug report"
|
3
|
+
about: See CONTRIBUTING.md for more information
|
4
|
+
title: ''
|
5
|
+
labels: bug
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Before you submit this: WE ONLY ACCEPT BUG REPORTS AND FEATURE REQUESTS**
|
11
|
+
|
12
|
+
For more information see `CONTRIBUTING.md`.
|
13
|
+
|
14
|
+
**Describe the bug**
|
15
|
+
|
16
|
+
A clear and concise description of what the bug is.
|
17
|
+
|
18
|
+
**To Reproduce**
|
19
|
+
|
20
|
+
Provide detailed steps to reproduce, an executable script would be best.
|
21
|
+
|
22
|
+
**Expected behavior**
|
23
|
+
|
24
|
+
A clear and concise description of what you expected to happen.
|
25
|
+
|
26
|
+
**Your environment**
|
27
|
+
|
28
|
+
- Affects my production application: **YES/NO**
|
29
|
+
- Ruby version: ...
|
30
|
+
- OS: ...
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F6E0 Feature request"
|
3
|
+
about: See CONTRIBUTING.md for more information
|
4
|
+
title: ''
|
5
|
+
labels: feature
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
Summary of what the feature is supposed to do.
|
11
|
+
|
12
|
+
## Examples
|
13
|
+
|
14
|
+
Code examples showing how the feature could be used.
|
15
|
+
|
16
|
+
## Resources
|
17
|
+
|
18
|
+
Additional information, like a link to the discussion forum thread where the feature was discussed etc.
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
name: ci
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
paths:
|
8
|
+
- .github/workflows/ci.yml
|
9
|
+
- lib/**
|
10
|
+
- spec/**
|
11
|
+
- Gemfile
|
12
|
+
- "*.gemspec"
|
13
|
+
pull_request:
|
14
|
+
branches:
|
15
|
+
- master
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
tests-mri:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
ruby: ["2.6.x", "2.5.x", "2.4.x"]
|
24
|
+
include:
|
25
|
+
- ruby: "2.6.x"
|
26
|
+
coverage: "true"
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v1
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: actions/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{matrix.ruby}}
|
33
|
+
- name: Download test reporter
|
34
|
+
if: "matrix.coverage == 'true'"
|
35
|
+
run: |
|
36
|
+
mkdir -p tmp/
|
37
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
|
38
|
+
chmod +x ./tmp/cc-test-reporter
|
39
|
+
./tmp/cc-test-reporter before-build
|
40
|
+
- name: Run all tests
|
41
|
+
env:
|
42
|
+
COVERAGE: ${{matrix.coverage}}
|
43
|
+
run: |
|
44
|
+
gem install bundler
|
45
|
+
bundle install --jobs 4 --retry 3 --without tools docs benchmarks
|
46
|
+
script/ci
|
47
|
+
- name: Send coverage results
|
48
|
+
if: "matrix.coverage == 'true'"
|
49
|
+
env:
|
50
|
+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
|
51
|
+
GIT_COMMIT_SHA: ${{github.sha}}
|
52
|
+
GIT_BRANCH: ${{github.ref}}
|
53
|
+
GIT_COMMITTED_AT: ${{github.event.head_commit.timestamp}}
|
54
|
+
run: |
|
55
|
+
GIT_BRANCH=`ruby -e "puts ENV['GITHUB_REF'].split('/', 3).last"` \
|
56
|
+
GIT_COMMITTED_AT=`ruby -r time -e "puts Time.iso8601(ENV['GIT_COMMITTED_AT']).to_i"` \
|
57
|
+
./tmp/cc-test-reporter after-build
|
58
|
+
|
59
|
+
tests-others:
|
60
|
+
runs-on: ubuntu-latest
|
61
|
+
strategy:
|
62
|
+
fail-fast: false
|
63
|
+
matrix:
|
64
|
+
image: ["jruby:9.2.8", "ruby:rc"]
|
65
|
+
container:
|
66
|
+
image: ${{matrix.image}}
|
67
|
+
steps:
|
68
|
+
- uses: actions/checkout@v1
|
69
|
+
- name: Install git
|
70
|
+
run: |
|
71
|
+
apt-get update
|
72
|
+
apt-get install -y --no-install-recommends git
|
73
|
+
- name: Run all tests
|
74
|
+
run: |
|
75
|
+
gem install bundler
|
76
|
+
bundle install --jobs 4 --retry 3 --without tools docs benchmarks
|
77
|
+
script/ci
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
name: docsite
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
paths:
|
8
|
+
- docsite/**
|
9
|
+
- .github/workflows/docsite.yml
|
10
|
+
branches:
|
11
|
+
- master
|
12
|
+
- release-**
|
13
|
+
tags:
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
update-docs:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v1
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: actions/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: "2.6.x"
|
24
|
+
- name: Install dependencies
|
25
|
+
run: |
|
26
|
+
gem install bundler
|
27
|
+
bundle install --jobs 4 --retry 3 --without benchmarks sql
|
28
|
+
- name: Symlink ossy
|
29
|
+
run: mkdir -p bin && ln -sf "$(bundle show ossy)/bin/ossy" bin/ossy
|
30
|
+
- name: Trigger dry-rb.org deploy
|
31
|
+
env:
|
32
|
+
GITHUB_LOGIN: dry-bot
|
33
|
+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
34
|
+
run: bin/ossy github workflow dry-rb/dry-rb.org ci
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
name: sync_configs
|
4
|
+
|
5
|
+
on:
|
6
|
+
repository_dispatch:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
sync-configs:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
if: github.event.action == 'sync_configs'
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v1
|
14
|
+
- name: Update configuration files from devtools
|
15
|
+
env:
|
16
|
+
GITHUB_LOGIN: dry-bot
|
17
|
+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
18
|
+
run: |
|
19
|
+
git clone https://github.com/dry-rb/devtools.git tmp/devtools
|
20
|
+
|
21
|
+
if [ -f ".github/workflows/custom_ci.yml" ]; then
|
22
|
+
rsync -av --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
|
23
|
+
else
|
24
|
+
rsync -av tmp/devtools/shared/ . ;
|
25
|
+
fi
|
26
|
+
|
27
|
+
git config --local user.email "dry-bot@dry-rb.org"
|
28
|
+
git config --local user.name "dry-bot"
|
29
|
+
git add -A
|
30
|
+
git commit -m "[devtools] config sync" || echo "nothing changed"
|
31
|
+
- name: Push changes
|
32
|
+
uses: ad-m/github-push-action@master
|
33
|
+
with:
|
34
|
+
github_token: ${{ secrets.GH_PAT }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# this file is managed by dry-rb/devtools project
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.4
|
5
|
+
|
6
|
+
Style/EachWithObject:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Style/StringLiterals:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: single_quotes
|
12
|
+
|
13
|
+
Style/Alias:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/LambdaCall:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/StabbyLambdaParentheses:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/FormatString:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Layout/SpaceInLambdaLiteral:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Layout/MultilineMethodCallIndentation:
|
32
|
+
Enabled: true
|
33
|
+
EnforcedStyle: indented
|
34
|
+
|
35
|
+
Metrics/LineLength:
|
36
|
+
Max: 100
|
37
|
+
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Max: 22
|
40
|
+
|
41
|
+
Metrics/ClassLength:
|
42
|
+
Max: 150
|
43
|
+
|
44
|
+
Metrics/AbcSize:
|
45
|
+
Max: 20
|
46
|
+
|
47
|
+
Metrics/BlockLength:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Metrics/CyclomaticComplexity:
|
51
|
+
Enabled: true
|
52
|
+
Max: 10
|
53
|
+
|
54
|
+
Lint/BooleanSymbol:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/AccessModifierDeclarations:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/BlockDelimiters:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Layout/IndentFirstArrayElement:
|
64
|
+
EnforcedStyle: consistent
|
65
|
+
|
66
|
+
Style/ClassAndModuleChildren:
|
67
|
+
Exclude:
|
68
|
+
- "spec/**/*_spec.rb"
|
69
|
+
|
70
|
+
Lint/HandleExceptions:
|
71
|
+
Exclude:
|
72
|
+
- "spec/spec_helper.rb"
|
73
|
+
|
74
|
+
Naming/FileName:
|
75
|
+
Exclude:
|
76
|
+
- "lib/dry-*.rb"
|
77
|
+
|
78
|
+
Style/SymbolArray:
|
79
|
+
Exclude:
|
80
|
+
- "spec/**/*_spec.rb"
|
81
|
+
|
82
|
+
Style/ConditionalAssignment:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Naming/MethodName:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/AsciiComments:
|
89
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Dry::CLI
|
2
|
+
General purpose Command Line Interface (CLI) framework for Ruby
|
3
|
+
|
4
|
+
## v0.4.0 - 2019-12-10
|
5
|
+
### Added
|
6
|
+
- [Ivan Shamatov, Piotr Solnica, Luca Guidi] `hanami-cli` => `dry-cli`
|
7
|
+
|
8
|
+
## v0.3.1 - 2019-01-18
|
9
|
+
### Added
|
10
|
+
- [Luca Guidi] Official support for Ruby: MRI 2.6
|
11
|
+
- [Luca Guidi] Support `bundler` 2.0+
|
12
|
+
|
13
|
+
## v0.3.0 - 2018-10-24
|
14
|
+
|
15
|
+
## v0.3.0.beta1 - 2018-08-08
|
16
|
+
### Added
|
17
|
+
- [Anton Davydov & Alfonso Uceda] Introduce array type for arguments (`foo exec test spec/bookshelf/entities spec/bookshelf/repositories`)
|
18
|
+
- [Anton Davydov & Alfonso Uceda] Introduce array type for options (`foo generate config --apps=web,api`)
|
19
|
+
- [Alfonso Uceda] Introduce variadic arguments (`foo run ruby:latest -- ruby -v`)
|
20
|
+
- [Luca Guidi] Official support for JRuby 9.2.0.0
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
- [Anton Davydov] Print informative message when unknown or wrong option is passed (`"test" was called with arguments "--framework=unknown"`)
|
24
|
+
|
25
|
+
## v0.2.0 - 2018-04-11
|
26
|
+
|
27
|
+
## v0.2.0.rc2 - 2018-04-06
|
28
|
+
|
29
|
+
## v0.2.0.rc1 - 2018-03-30
|
30
|
+
|
31
|
+
## v0.2.0.beta2 - 2018-03-23
|
32
|
+
### Added
|
33
|
+
- [Anton Davydov & Luca Guidi] Support objects as callbacks
|
34
|
+
|
35
|
+
### Fixed
|
36
|
+
- [Anton Davydov & Luca Guidi] Ensure callbacks' context of execution (aka `self`) to be the command that is being executed
|
37
|
+
|
38
|
+
## v0.2.0.beta1 - 2018-02-28
|
39
|
+
### Added
|
40
|
+
- [Anton Davydov] Register `before`/`after` callbacks for commands
|
41
|
+
|
42
|
+
## v0.1.1 - 2018-02-27
|
43
|
+
### Added
|
44
|
+
- [Luca Guidi] Official support for Ruby: MRI 2.5
|
45
|
+
|
46
|
+
### Fixed
|
47
|
+
- [Alfonso Uceda] Ensure default values for arguments to be sent to commands
|
48
|
+
- [Alfonso Uceda] Ensure to fail when a missing required argument isn't provider, but an option is provided instead
|
49
|
+
|
50
|
+
## v0.1.0 - 2017-10-25
|
51
|
+
|
52
|
+
## v0.1.0.rc1 - 2017-10-16
|
53
|
+
|
54
|
+
## v0.1.0.beta3 - 2017-10-04
|
55
|
+
|
56
|
+
## v0.1.0.beta2 - 2017-10-03
|
57
|
+
### Added
|
58
|
+
- [Alfonso Uceda] Allow default value for arguments
|
59
|
+
|
60
|
+
## v0.1.0.beta1 - 2017-08-11
|
61
|
+
### Added
|
62
|
+
- [Alfonso Uceda, Luca Guidi] Commands banner and usage
|
63
|
+
- [Alfonso Uceda] Added support for subcommands
|
64
|
+
- [Alfonso Uceda] Validations for arguments and options
|
65
|
+
- [Alfonso Uceda] Commands arguments and options
|
66
|
+
- [Alfonso Uceda] Commands description
|
67
|
+
- [Alfonso Uceda, Oana Sipos] Commands aliases
|
68
|
+
- [Luca Guidi] Exit on unknown command
|
69
|
+
- [Luca Guidi, Alfonso Uceda, Oana Sipos] Command lookup
|
70
|
+
- [Luca Guidi, Tim Riley] Trie based registry to register commands and allow third-parties to override/add commands
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.4.0, available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Issue Guidelines
|
2
|
+
|
3
|
+
## Reporting bugs
|
4
|
+
|
5
|
+
If you found a bug, report an issue and describe what's the expected behavior versus what actually happens. If the bug causes a crash, attach a full backtrace. If possible, a reproduction script showing the problem is highly appreciated.
|
6
|
+
|
7
|
+
## Reporting feature requests
|
8
|
+
|
9
|
+
Report a feature request **only after discussing it first on [discourse.dry-rb.org](https://discourse.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
|
10
|
+
|
11
|
+
## Reporting questions, support requests, ideas, concerns etc.
|
12
|
+
|
13
|
+
**PLEASE DON'T** - use [discourse.dry-rb.org](http://discourse.dry-rb.org) instead.
|
14
|
+
|
15
|
+
# Pull Request Guidelines
|
16
|
+
|
17
|
+
A Pull Request will only be accepted if it addresses a specific issue that was reported previously, or fixes typos, mistakes in documentation etc.
|
18
|
+
|
19
|
+
Other requirements:
|
20
|
+
|
21
|
+
1) Do not open a pull request if you can't provide tests along with it. If you have problems writing tests, ask for help in the related issue.
|
22
|
+
2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
|
23
|
+
3) Add API documentation if it's a new feature
|
24
|
+
4) Update API documentation if it changes an existing feature
|
25
|
+
5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](github.com/dry-rb/dry-rb.org) which updates user documentation and guides
|
26
|
+
|
27
|
+
# Asking for help
|
28
|
+
|
29
|
+
If these guidelines aren't helpful, and you're stuck, please post a message on [discourse.dry-rb.org](https://discourse.dry-rb.org) or join [our chat](https://dry-rb.zulipchat.com).
|