Commit graph

5899 commits

Author SHA1 Message Date
Ed Page
d43f1dbf6f docs: Move everything to docs.rs
A couple of things happened when preparing to release 3.0
- We needed derive documentation
  - I had liked how serde handled theres
  - I had bad experiences finding things in structopt's documentation
- The examples were broken and we needed tests
- The examples seemed to follow a pattern of having tutorial content and
  cookbook content
- We had been getting bug reports from people looking at master and
  thinking they were looking at what is currently released
- We had gotten feedback to keep down the number of places that
  documentation was located

From this, we went with a mix of docs.rs and github
- We kept the number of content locations at 2 rather than 3 by not
  having an external site like serde
- We rewrote the examples into explicit tutorials and cookbooks to align
  with the 4 styles of documentation
- We could test our examples by running `console` code blocks with
  trycmd
- Documentation was versioned and the README pointed to the last release

This had downsides
- The tutorials didn't have the code inlined
- Users still had a hard time finding and navigating between the
  different forms of documentation
- In practice, we were less likely to cross-link between the different
  types of documentation

Moving to docs.rs would offer a lot of benefits, even if it is only
designed for Rust-reference documentation and isn't good for Rust derive
reference documentation, tutorials, cookbooks, etc.  The big problem was
keeping the examples tested to keep maintenance costs down.  Maybe its
just me but its easy to overlook
- You can pull documentation from a file using `#[doc = "path"]`
- Repeated doc attributes get concatenated rather than first or last
  writer winning

Remember these when specifically thinking about Rust documentation made
me realize that we could get everything into docs.rs.

When doing this
- Tutorial code got brought in as was one of the aims
- We needed to split the lib documentation and the README to have all of
  the linking work.  This allowed us to specialize them according to
  their rule (user vs contributor)
- We needed to avoid users getting caught up in making a decision
  between Derive and Builder APIs so we put the focus on the derive API
  with links to the FAQ to help users decide when to use one or the
  other.
- Improved cross-referencing between different parts of the
  documentation
- Limited inline comments were added to example code
  - Introductory example code intentionally does not have teaching
    comments in it as its meant to give a flavor or sense of things and
    not meant to teach on its own.

This is a first attempt.  There will be a lot of room for further
improvement.  Current know downsides:
- Content source is more split up for the tutorials

This hopefully addresses #3189
2022-07-19 13:30:38 -05:00
Ed Page
a8a7a61f56 chore: Release 2022-07-14 09:38:54 -05:00
Ed Page
ed8837f2cc docs: Update changelog 2022-07-14 09:38:47 -05:00
Ed Page
afc540153b
Merge pull request #3902 from tmccombs/get-conflicts-with-group
Include groups in `get_arg_conflicts_with`
2022-07-14 09:37:45 -05:00
Thayne McCombs
f27f1f57ea fix: Include groups in get_arg_conflicts_with
So that it doesn't panic if trying to get the conflicts for an Arg that
conflicts with a group.

Fixes: #3900
2022-07-14 01:08:06 -06:00
Ed Page
2df0732df4 chore: Release 2022-07-13 09:08:35 -05:00
Ed Page
1c2242251b docs: Update changelog 2022-07-13 09:08:21 -05:00
Ed Page
e8374e3f2e
Merge pull request #3913 from emersonford/expose-non-visible-arg-aliases
feat: Add method to get non-visible arg aliases
2022-07-13 09:07:17 -05:00
Emerson Ford
e39156e0b9 feat: Add method to get non-visible arg aliases 2022-07-12 11:23:22 -07:00
Ed Page
9b6321a1f0 chore: Release 2022-07-11 21:48:07 -05:00
Ed Page
074712a739 chore: Update release process 2022-07-11 21:47:35 -05:00
Ed Page
096db791bf docs: Update changelog 2022-07-11 21:46:05 -05:00
Ed Page
3802a35a43
Merge pull request #3909 from emersonford/fix-mut-subcommand-lifetime
fix: loosen lifetime constraint on mut_subcommand
2022-07-11 21:45:01 -05:00
Emerson Ford
8e1411b3b2 fix: Loosen lifetime constraint on mut_subcommand 2022-07-11 19:12:36 -07:00
Ed Page
5c7ad01587
Merge pull request #3908 from jturner314-nrl/derive-ref-quotes
docs(derive): Clarify `rename_all` takes a string literal
2022-07-11 19:12:03 -05:00
James D. Turner
f94eafbaf7 Clarify in docs that rename_all needs a string literal 2022-07-11 17:59:02 -04:00
James D. Turner
93565c226c Add "" around string literals in derive ref docs
When deriving `ValueEnum` (and possibly in other cases as well), the
attribute is silently ignored if the user leaves off these quotes.
2022-07-11 17:13:06 -04:00
Ed Page
7c0068e5b9
Merge pull request #3906 from epage/complete
docs(complete): Make example consistent
2022-07-11 15:36:39 -05:00
Ed Page
6286339f81 docs(complete): Make example consistent
Fixes #3883
2022-07-11 15:20:45 -05:00
Daniel Saxton
c4612e4c17
docs: Fix typo in derive API README (#3896)
Co-authored-by: Daniel Saxton <dsaxton@pm.me>
2022-07-05 09:49:55 -05:00
Ed Page
9c81b39533
Merge pull request #3893 from iwanders/add-comment-about-derive-feature
Add comment about requiring the derive feature.
2022-07-05 09:11:49 -05:00
Ivor Wanders
ee6dc53722 docs: Reorder dependency addition and example 2022-07-03 09:49:52 -04:00
Ed Page
4ecdd1afe8
Merge pull request #3890 from clap-rs/dependabot/github_actions/pre-commit/action-3.0.0
chore(deps): bump pre-commit/action from 2.0.3 to 3.0.0
2022-07-01 20:41:11 -05:00
Ed Page
f495827126 chore: Release 2022-07-01 19:48:03 -05:00
Ed Page
51ad0dd155 docs: Update changelog 2022-07-01 19:47:49 -05:00
Ed Page
2b417c8593
Merge pull request #3884 from grant0417/clap-complete-fig-use-actions
feat(clap_complete_fig): Switch to using `ArgAction`
2022-07-01 19:46:00 -05:00
grant0417
85b1b7711a fix: Add back depercated is_multiple_occurrences_set 2022-07-01 11:48:56 -07:00
dependabot[bot]
5ba845ab6f
chore(deps): bump pre-commit/action from 2.0.3 to 3.0.0
Bumps [pre-commit/action](https://github.com/pre-commit/action) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/pre-commit/action/releases)
- [Commits](https://github.com/pre-commit/action/compare/v2.0.3...v3.0.0)

---
updated-dependencies:
- dependency-name: pre-commit/action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-01 03:05:59 +00:00
Ed Page
64918b516f
Merge pull request #3886 from epage/docs
doc: Explain why examples are missing
2022-06-30 11:32:57 -05:00
Ed Page
7009ae63c8 doc: Explain why examples are missing
Fixes #3865
2022-06-30 08:29:16 -05:00
Ed Page
6614ffa6c8 chore: Release 2022-06-30 08:25:54 -05:00
Ed Page
a67746ecbe docs: Update changelog 2022-06-30 08:25:46 -05:00
Ed Page
5ca73f3299
Merge pull request #3882 from emersonford/mut_subcommands
feat: add `mut_subcommand` method to modify existing subcommands
2022-06-30 08:24:43 -05:00
Emerson Ford
619f209138 feat: Add mut_subcommand method to Command
this allows us modify existing subcommands on an existing/already built
Command struct
2022-06-29 20:42:58 -07:00
grant0417
4cf9f392ae fix: Run cargo fmt 2022-06-28 18:38:43 -07:00
grant0417
0025944d9e feat(clap_complete_fig): Switch to using ArgAction 2022-06-28 18:30:39 -07:00
Ed Page
b4a1362486 chore: Release 2022-06-28 08:04:18 -05:00
Ed Page
3e80393e43 docs: Update changelog 2022-06-28 08:03:17 -05:00
Ed Page
f406d99b95
Merge pull request #3879 from epage/env
fix(parser): Ensure globals override env vars
2022-06-28 08:01:21 -05:00
Ed Page
72d206e4d9 fix(parser): Ensure globals override env vars
This fixes a bug introduced in 4a694f3592
when we were trying to move away from presence checks via occurrences.
I switched it to the common type of presence check but really what we
want is a highest-precedence check.

Fixes #3872
2022-06-27 22:40:40 -05:00
Ed Page
f082eb6d4a test(parser): Verify global/default interaction 2022-06-27 22:32:13 -05:00
Ed Page
9962393c20
Merge pull request #3877 from epage/assert
test: Verify auto-traits for core types
2022-06-27 21:05:44 -05:00
Ed Page
3c4e684c8b test: Verify auto-traits for core types
By checking these types, we'll get some other types for free, like
`Command` verifying `Arg`.

This was inspired by #3876
2022-06-27 20:50:29 -05:00
Ed Page
a05f4d34a3
Merge pull request #3870 from stepancheg/macro-refs
Put once_cell reexport into __macro_refs
2022-06-27 20:44:01 -05:00
Ed Page
5ba41d775c docs(license): Update years/holders
Without copyright assignment, everyone owns their own copyright, so
tried to reflect that.

See #3875
2022-06-27 12:55:09 -05:00
Stiopa Koltsov
464ef3920b refactor: Put once_cell reexport into __macro_refs
When upgrading our company projects from clap 3.1 to clap 3.2 I had
to fix several references to `clap::lazy_init`. People are not
supposed to do that, but that's hard to enforce.

Hope placing `once_cell` reexport into `__macro_refs` prevent at
least some of the such issues in the future.
2022-06-26 04:13:03 +01:00
Ed Page
08d12b6db4
Merge pull request #3866 from hw-lunemann/derive-ref-spelling-fix
Fix spelling of 'APIs' in the derive docs
2022-06-25 19:16:33 -05:00
hw-lunemann
7e785ad9d6 Fix spelling of APIs 2022-06-25 00:55:48 +02:00
Ed Page
b2779f2249
Merge pull request #3862 from epage/deprecate
fix(docs): Update deprecations to latest target
2022-06-22 15:18:04 -05:00
Ed Page
f9e51952b8 fix(docs): Update deprecations to latest target
Before, I was mixed on doing this as ideally people would upgrade
through the minor releases, going through the release notes.  This also
saves us havin to audit deprecations to make sure they are all pointing
to the latest.

First, this isn't practical for users.  Its annoying to pin your version (at least
its easier now that we pin `clap_derive` for users) and a lot of work to
go through them one step at a time.

On top of that, we've changed our deprecation policy to put the timing
of responding to deprecations into the user's hands with, with us
putting them behind the `deprecated` feature flag.  This means someone
might respond to deprecations every once in a while or might not do it
until right before the 4.0 release.  Our deprecation messages should be
updated to respond to that.

This supersedes #3616
2022-06-22 14:31:15 -05:00