Merge pull request #2 from epage/boiler

chore: Align on boilerplate
This commit is contained in:
Ed Page 2021-11-17 15:32:41 -06:00 committed by GitHub
commit 58b0fe537e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 220 additions and 222 deletions

1
.github/FUNDING.yml vendored
View file

@ -1 +0,0 @@
open_collective: clap

View file

@ -1,45 +0,0 @@
<!--
Please use the following template to assist with creating an issue and to ensure a speedy resolution. If an area is not applicable, feel free to delete the area or mark with `N/A`
-->
### Rust Version
* Use the output of `rustc -V`
### Affected Version of clap
* Can be found in Cargo.lock of your project (i.e. `grep clap Cargo.lock`)
### Expected Behavior Summary
### Actual Behavior Summary
### Steps to Reproduce the issue
### Sample Code or Link to Sample Code
### Debug output
Compile clap with `debug` feature:
```toml
[dependencies]
clap = { version = "*", features = ["debug"] }
```
The output may be very long, so feel free to link to a gist or attach a text file
<details>
<summary> Debug Output </summary>
<pre>
<code>
Paste Debug Output Here
</code>
</pre>
</details>

View file

@ -1,27 +1,21 @@
name: Bug report
description: An issue with clap, clap_derive or clap_generate
description: Things not quite working right
labels: 'T: bug'
body:
- type: checkboxes
attributes:
label: Please complete the following tasks
options:
- label: I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
required: true
- label: I have searched the existing issues
required: true
- type: input
- type: textarea
attributes:
label: Rust Version
description: Output of `rustc -V`
label: Description
validations:
required: true
- type: input
attributes:
label: Clap Version
label: Version
description: Can be found in Cargo.lock or Cargo.toml of your project (i.e. `grep clap Cargo.lock`). PLEASE DO NOT PUT "latest" HERE, use precise version. Put `master` (or other branch) if you're using the repo directly.
validations:
required: true
- type: textarea
attributes:
label: Minimal reproducible code
@ -32,28 +26,14 @@ body:
```
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce the bug with the above code
description: A command like `cargo run -- options...` or multiple commands.
validations:
required: true
- type: textarea
attributes:
label: Actual Behaviour
description: When I do like *this*, *that* is happening and I think it shouldn't.
validations:
required: true
- type: textarea
attributes:
label: Expected Behaviour
description: I think *this* should happen instead.
validations:
required: true
- type: textarea
attributes:
label: Additional Context
description: Add any other context about the problem here.
- type: textarea
attributes:
label: Debug Output

View file

@ -1,6 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Ask a question
about: You've come to seek help or want to discuss something related to clap
about: For support or brainstorming
url: https://github.com/clap-rs/clap/discussions/new
# TODO: Question template (waiting for discussions template feature)

View file

@ -1,34 +0,0 @@
name: Documentation issue
description: An issue with our docs, like typo, something's missing, incorrect docs, etc...
labels: 'C: docs'
body:
- type: checkboxes
attributes:
label: Please complete the following tasks
options:
- label: I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
required: true
- label: I have searched the existing issues
required: true
- type: input
attributes:
label: Clap Version
description: Can be found in Cargo.lock or Cargo.toml of your project (i.e. `grep clap Cargo.lock`). PLEASE DO NOT PUT "latest" HERE, use precise version. Put `master` (or other branch) if you're using the repo directly.
validations:
required: true
- type: input
attributes:
label: Where?
description: A hyperlink, file path, some item, *something*.
validations:
required: true
- type: textarea
attributes:
label: What's wrong?
description: Explain what the issue is about, like - "The doc says that the sun is green!".
validations:
required: true
- type: textarea
attributes:
label: How to fix?
description: Any solution you think is right, like - "Everybody knows that the sun is blue!".

View file

@ -4,35 +4,22 @@ labels: 'T: new feature'
body:
- type: checkboxes
attributes:
label: Please complete the following tasks
options:
- label: I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
required: true
- label: I have searched the existing issues
required: true
- type: input
attributes:
label: Clap Version
label: Version
description: Can be found in Cargo.lock or Cargo.toml of your project (i.e. `grep clap Cargo.lock`). PLEASE DO NOT PUT "latest" HERE, use precise version. Put `master` (or other branch) if you're using the repo directly.
validations:
required: true
- type: textarea
attributes:
label: Describe your use case
description: Describe the problem you're trying to solve. This is not mandatory and we *do* consider features without a specific use case, but real problems have priority.
validations:
required: true
label: Use Case
description: Describe the problem you're trying to solve.
- type: textarea
attributes:
label: Describe the solution you'd like
description: Please explain what the wanted solution should look like. You are **strongly encouraged** to attach a snippet of (pseudo)code.
validations:
required: true
label: Requirements
description: Describe what is needed to satisfy your use case.
- type: textarea
attributes:
label: Alternatives, if applicable
description: A clear and concise description of any alternative solutions or features you've managed to come up with.
- type: textarea
attributes:
label: Additional Context
description: Add any other context about the feature request here.
label: Possible Solutions
description: A clear and concise description of any solutions or features you've managed to come up with.

View file

@ -1,5 +0,0 @@
<!--
If your PR closes some issues, please write `Closes #XXXX`
where `XXXX` is the number of the issue you want to fix.
Each issue goes on its own line.
-->

8
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: monthly
time: "07:00"
open-pull-requests-limit: 10

48
.github/settings.yml vendored Normal file
View file

@ -0,0 +1,48 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
repository:
description: A full featured, fast Command Line Argument Parser for Rust
homepage: docs.rs/clap
topics: rust cli command-line argparse clap
has_issues: true
has_projects: false
has_wiki: false
has_downloads: true
default_branch: main
allow_squash_merge: true
allow_merge_commit: true
allow_rebase_merge: true
# Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402
delete_branch_on_merge: true
labels:
# Type
- name: bug
color: '#b60205'
description: Not as expected
- name: enhancement
color: '#1d76db'
description: Improve the expected
# Flavor
- name: question
color: "#cc317c"
description: Uncertainty is involved
- name: breaking-change
color: "#e99695"
- name: good first issue
color: '#c2e0c6'
description: Help wanted!
branches:
- name: main
protection:
required_pull_request_reviews: null
required_conversation_resolution: true
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: false
contexts: ["CI", "Lint Commits", "Spell Check with Typos"]
enforce_admins: false
restrictions: null

21
.github/workflows/audit.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Security audit
on:
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
schedule:
- cron: '3 3 3 * *'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

14
.github/workflows/committed.yml vendored Normal file
View file

@ -0,0 +1,14 @@
name: Lint Commits
on: [pull_request]
jobs:
committed:
name: Lint Commits
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Lint Commits
uses: crate-ci/committed@master

12
.github/workflows/pre-commit.yml vendored Normal file
View file

@ -0,0 +1,12 @@
name: pre-commit
on:
pull_request:
push:
branches: [source]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3

12
.github/workflows/spelling.yml vendored Normal file
View file

@ -0,0 +1,12 @@
name: Spelling
on: [pull_request]
jobs:
spelling:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Spell Check Repo
uses: crate-ci/typos@master

35
.gitignore vendored
View file

@ -1,35 +1,2 @@
# Compiled files
*.o
*.so
*.rlib
*.dll
# Executables
*.exe
# Generated by Cargo
target/
# Cargo files
target
Cargo.lock
# Temp files
.*~
# Backup files
*.bak
*.bk
*.orig
# Project files
.vscode/*
.idea/*
clap-rs.iml
# Auxiliary files
test-results.test
expanded.rs
clap_derive/expanded.rs
# ctags
**/*.vi

21
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
stages: [commit]
- id: check-json
stages: [commit]
- id: check-toml
stages: [commit]
- id: check-merge-conflict
stages: [commit]
- id: check-case-conflict
stages: [commit]
- id: detect-private-key
stages: [commit]
- repo: https://github.com/crate-ci/committed
rev: v0.2.5
hooks:
- id: committed
stages: [commit-msg]

View file

@ -1,21 +1,22 @@
[workspace]
members = [
"clap_derive",
"clap_generate",
"clap_generate_fig",
]
[package]
name = "clap"
version = "3.0.0-beta.5"
edition = "2018"
description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
authors = [
"Kevin K. <kbknapp@gmail.com>",
"Clap Maintainers"
]
include = [
"src/**/*",
"Cargo.toml",
"LICENSE-*",
"README.md"
]
description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
repository = "https://github.com/clap-rs/clap"
documentation = "https://docs.rs/clap/"
homepage = "https://clap.rs/"
categories = ["command-line-interface"]
keywords = [
"argument",
"cli",
@ -23,9 +24,51 @@ keywords = [
"parser",
"parse"
]
categories = ["command-line-interface"]
edition = "2018"
license = "MIT OR Apache-2.0"
readme = "README.md"
include = [
"build.rs",
"src/**/*",
"Cargo.toml",
"LICENSE*",
"README.md",
"benches/**/*",
"examples/**/*"
]
[package.metadata.docs.rs]
features = ["yaml", "regex", "unstable-replace", "unstable-multicall", "unstable-grouped"]
[features]
default = [
"std",
"derive",
"cargo",
"color",
"env",
"suggestions",
"unicode",
]
debug = ["clap_derive/debug", "backtrace"] # Enables debug messages
# Used in default
std = ["indexmap/std"] # support for no_std in a backwards-compatible way
derive = ["clap_derive", "lazy_static"]
cargo = ["lazy_static"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
color = ["atty", "termcolor"]
env = [] # Use environment variables during arg parsing
suggestions = ["strsim"]
unicode = ["textwrap/unicode-width", "unicase"] # Support for unicode characters in arguments and help messages
# Optional
wrap_help = ["terminal_size", "textwrap/terminal_size"]
yaml = ["yaml-rust"]
# In-work features
unstable-replace = []
unstable-multicall = []
unstable-grouped = []
[lib]
bench = false
@ -90,36 +133,6 @@ path = "examples/24a_multicall_busybox.rs"
name = "hostname"
path = "examples/24b_multicall_hostname.rs"
[features]
default = [
"std",
"derive",
"cargo",
"color",
"env",
"suggestions",
"unicode",
]
debug = ["clap_derive/debug", "backtrace"] # Enables debug messages
# Used in default
std = ["indexmap/std"] # support for no_std in a backwards-compatible way
derive = ["clap_derive", "lazy_static"]
cargo = ["lazy_static"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
color = ["atty", "termcolor"]
env = [] # Use environment variables during arg parsing
suggestions = ["strsim"]
unicode = ["textwrap/unicode-width", "unicase"] # Support for unicode characters in arguments and help messages
# Optional
wrap_help = ["terminal_size", "textwrap/terminal_size"]
yaml = ["yaml-rust"]
# In-work features
unstable-replace = []
unstable-multicall = []
unstable-grouped = []
[profile.test]
opt-level = 1
@ -127,13 +140,3 @@ opt-level = 1
lto = true
codegen-units = 1
[package.metadata.docs.rs]
features = ["yaml", "regex", "unstable-replace", "unstable-multicall", "unstable-grouped"]
targets = ["x86_64-unknown-linux-gnu"]
[workspace]
members = [
"clap_derive",
"clap_generate",
"clap_generate_fig",
]

3
committed.toml Normal file
View file

@ -0,0 +1,3 @@
style="conventional"
ignore_author_re="dependabot"
merge_commit = false

View file

@ -821,7 +821,7 @@ impl<'help> App<'help> {
/// Does awesome things\n\
/// (C) me@mail.com\n\n\
///
/// USAGE: myapp <opts> <comamnd>\n\n\
/// USAGE: myapp <opts> <command>\n\n\
///
/// Options:\n\
/// -h, --help Display this message\n\
@ -829,7 +829,7 @@ impl<'help> App<'help> {
/// -s <stuff> Do something with stuff\n\
/// -v Be verbose\n\n\
///
/// Commmands:\n\
/// Commands:\n\
/// help Print this message\n\
/// work Do some work")
/// # ;
@ -2490,7 +2490,7 @@ impl<'help> App<'help> {
// Remove generated help and version args in the subcommand
//
// Don't remove if those args are futher mutated
// Don't remove if those args are further mutated
if is_generated {
let generated_pos = sc
.args
@ -2743,7 +2743,7 @@ impl<'help> App<'help> {
// Print val_name for positional arguments. e.g. <file_name>
x.name_no_brackets().to_string()
} else {
// Print useage string for flags arguments, e.g. <--help>
// Print usage string for flags arguments, e.g. <--help>
x.to_string()
}
})

View file

@ -4367,7 +4367,7 @@ impl<'help> Arg<'help> {
/// assert_eq!(files, ["file1", "file2", "file3"]);
/// ```
///
/// Although `MultipleVlaues` has been specified, we cannot use the argument more than once.
/// Although `MultipleValues` has been specified, we cannot use the argument more than once.
///
/// ```rust
/// # use clap::{App, Arg, ErrorKind, ArgSettings};
@ -5120,7 +5120,7 @@ where
}
}
} else if let Some(num_vals) = arg.num_vals {
// If number_of_values is sepcified, display the value multiple times.
// If number_of_values is specified, display the value multiple times.
let arg_name = format!("<{}>", arg.name);
let mut it = iter::repeat(&arg_name).take(num_vals).peekable();
while let Some(arg_name) = it.next() {

View file

@ -107,7 +107,7 @@ impl<'help> PossibleValue<'help> {
impl<'help> PossibleValue<'help> {
/// Creates a new instance of [`PossibleValue`] using a string name. The name will be used to
/// decide wether this value was provided by the user to an argument.
/// decide whether this value was provided by the user to an argument.
///
/// **NOTE:** In case it is not [hidden] it will also be shown in help messages for arguments
/// that use it as a [possible value] and have not hidden them through [`Arg::hide_possible_values(true)`].

View file

@ -1039,7 +1039,7 @@ mod test {
#[test]
fn display_width_handles_non_ascii() {
// Popular Danish tounge-twister, the name of a fruit dessert.
// Popular Danish tongue-twister, the name of a fruit dessert.
let text = "rødgrød med fløde";
assert_eq!(display_width(text), 17);
// Note that the string width is smaller than the string

8
typos.toml Normal file
View file

@ -0,0 +1,8 @@
files.extend-exclude = [
"CHANGELOG.md",
"tests",
]
[default.extend-words]
# Acronyms
als = "als"
lits = "lits"