Commit graph

13 commits

Author SHA1 Message Date
Ed Page
55923ca947 docs(cookbook): Correct a typo 2023-07-21 10:54:08 -05:00
Martin
704d0e7a4f chore: Make format!() calls more readable 2023-01-29 19:14:47 +00:00
Ed Page
e467cc70ae docs(cookbook): PossibleValues with custom types
This used to be more magical in clap 3 and people are having a hard time
discovering how to get this in clap 4, so let's add examples:
- discrete numbers
- foreign enums
2022-10-05 19:12:05 -05:00
Ed Page
0e915e0d3a docs(derive): Update for new attributes 2022-09-02 15:39:13 -05:00
Ed Page
6ecb7310a8 fix(derive)!: Remove value_parser/action defaulted attributes 2022-07-22 20:07:47 -05:00
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
14a62e11fd fix(parser): Deprecate multiple_occurrences
Fixes #3772
2022-06-08 09:54:23 -05:00
Ed Page
e23800e10e doc(derive): Update for value_parser 2022-05-20 20:02:23 -05:00
Ed Page
bdd5cf17f8 docs(examples): Show IP Address 2022-03-14 09:53:31 -05:00
Ed Page
4842f07045 docs(examples): Show duration parsing 2022-03-14 09:49:46 -05:00
Ed Page
c230c72120 docs(examples): Allow any path 2022-03-14 09:46:33 -05:00
Ed Page
ce9e2cba8f docs(examples): Show implicit parser 2022-03-14 09:43:17 -05:00
Ed Page
a8ffebbab9 docs(examples): Generalize key-value example 2022-03-14 09:38:04 -05:00
Renamed from examples/keyvalue-derive.rs (Browse further)