Commit graph

5284 commits

Author SHA1 Message Date
Ed Page
8f182067e3 feat(clap): Publicly expose Command::build
`Command::_build_all` started as an internal function for
`clap_complete` as a stopgap until #2911.  Overtime, we've been finding
more cases where this function needs to be called, so now we're going to
fully embrace it until #2911 so people aren't scrared off by the hidden
implementation from using it.

This was inspired by #3602

Comptibility: Though this adds a deprecation which we general reserve
for minor or major versions, this is enough of a corner case that I'm
fine doing this in a patch release.
2022-04-19 10:13:43 -05:00
Ed Page
eddc04cbcc chore: Release 2022-04-15 16:17:02 -05:00
Ed Page
84bcab77e5 docs: Update changelog 2022-04-15 16:16:56 -05:00
Ed Page
83f1b165ba perf(lex): Drop a dependency
With the size of our haystacks, it doesn't seem worth pulling in an
extra depedency.  Pretty torn on this because nearly anything else will
pull it in (regex, tokio, etc).
2022-04-15 16:15:36 -05:00
Ed Page
7598c000f9 chore: Release 2022-04-15 14:39:14 -05:00
Ed Page
d05c5dac41 docs: Update changelog 2022-04-15 14:38:58 -05:00
Ed Page
4abf9d7f2e
Merge pull request #3636 from epage/derive
fix(derive): Couple derive version to clap
2022-04-15 14:35:22 -05:00
Ed Page
027f2511c6
Merge pull request #3634 from turrisxyz/naveen/feat/set-perms-actions
Set permissions for GitHub actions
2022-04-15 14:28:33 -05:00
Ed Page
ed57342bdd fix(derive): Couple derive version to clap
While `clap` depends on `clap_derive`, `clap_derive` inherently has a
dependency on `clap` because it generates code assuming at least a
specific clap version.  If a new `clap_derive` is used with an old
`clap`, it'll generate code that won't compile.

We've kept things loose because of
- Bad experiences with overly constrained version reqs
- To not force new `clap` versions to release `clap_derive`.
- People should have a lock file anyways

The downsides:
- `cargo install` does not use `Cargo.lock` by default, required
  `--locked`
- If we want people to not skip non-patch releases when upgrading, we
  need it to not be a pain
2022-04-15 14:09:28 -05:00
Ed Page
297b9cf594 chore: Release 2022-04-15 14:05:51 -05:00
Ed Page
b3cbfd0ae0 docs(man): Update changelog 2022-04-15 14:05:29 -05:00
Ed Page
7849c35a3e
Merge pull request #3635 from epage/port
feat: Expose clap_lex
2022-04-15 14:00:28 -05:00
Ed Page
15d8b3b0cd style: Make clippy happy 2022-04-15 13:49:02 -05:00
Ed Page
2f0d91688a docs(lex): Fix links 2022-04-15 13:08:40 -05:00
Ed Page
530db327db docs(lex): Clarify context-sensitive lexing 2022-04-15 12:49:02 -05:00
Ed Page
687d361a97 docs(lex): Make a determination on to_long_stdio
This tempts me to drop our design philosophy but I want to give it more
time.
2022-04-15 12:46:09 -05:00
Ed Page
e46cf659d6 fix(lex): Provide all dat with ParsedArg::to_value 2022-04-15 12:40:05 -05:00
Ed Page
913ec6d6ec test(lex): Verify behavior directly
While figuring out the API, `clap_lex` was tested by clap's tests.  Now
we are focusing on its API directly.
2022-04-15 12:39:39 -05:00
Ed Page
c3445e05b5 docs(lex): Provide examples 2022-04-15 11:40:49 -05:00
Ed Page
96dc6daa9e feat(lex): Pull out clap_lex 2022-04-15 10:55:37 -05:00
Ed Page
6291289c0f fix(lex): Make long args more convinient 2022-04-15 10:55:34 -05:00
Ed Page
1247a955cf docs(lex): Specify how it all works 2022-04-15 10:55:28 -05:00
Ed Page
6148d681f4 refactor(lex): Clarify side effects 2022-04-15 10:55:25 -05:00
Ed Page
fd16ee9474 refactor(lex): Port to expanded lexer 2022-04-15 10:55:19 -05:00
Ed Page
6e05b8075b refactor(lex): Expand lexer design
In considering the design for this, we want:
- Ability to modify the argment list while maintaining the `Cursor` for
  replacements
- Allow picking up subcommand parsing in the middle of short flags
- Ability to peek at the next item to determine if we want to treat it
  as a flag or as a value
- Ability to detect started short and long arguments for completions

Longer term, we also want to consider:
- Allowing users to customize the lexer to support different syntaxes
2022-04-15 10:55:12 -05:00
Ed Page
c58928b6bd refactor(lex): Track replacements as str
The lexer will soon return `RawOsStr` and it'll cost to turn that into
an `OsStr`.  However, it caches a `str`, so let's just use that.
2022-04-15 10:55:08 -05:00
Ed Page
f66d8abebd refactor(lex): Experiment with an alt 'previous'
Since we'll need `skip`, it made me wonder how to name `skip` and
`previous` to fit together, so I decided to play with `seek`.  Its
probably over kill but wondering if its better.
2022-04-15 10:55:05 -05:00
Ed Page
3ebf61e28d refactor(lex): Narrow focus for lexer
Before, we had a generic `next` that provided the next item and peeked
at all remaining items.  This was to work around the borrow checker for
modifying the position while accessing args.

We've now split `Input` into `RawArgs` and `ArgsCursor` so we don't have
overlapping borrows.  This made it so we can split `next` into `next`,
`peek`, and `remaining`.
2022-04-15 10:55:00 -05:00
Ed Page
0000d506ed refactor(lex): Remove unused bound 2022-04-15 10:54:50 -05:00
Ed Page
65120784f5 refactor(lex): Split out input cursor 2022-04-15 10:54:43 -05:00
naveensrinivasan
45c8b67cdb
Set permissions for GitHub actions
- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

 Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
2022-04-15 14:51:52 +00:00
Ed Page
b1003a1c54
Merge pull request #3624 from Chloe-Woahie/master
Fixed documentation typos
2022-04-11 07:06:55 -05:00
Chloe-Woahie
87c87565af docs: Fixed documentation typos 2022-04-10 12:43:09 -04:00
Ed Page
b73b7efa5c
Merge pull request #3617 from rhysd/patch-2
docs: Remove unnecessary backtick in changelog
2022-04-08 07:07:11 -05:00
Linda_pp
4626523ca6
docs: Remove unnecessary backtick in changelog 2022-04-08 13:23:24 +09:00
Ed Page
858f184428
Merge pull request #3587 from ducaale/value-name-as-header-positional
Use `Arg::value_name()` as header for positionals in clap_mangen
2022-04-04 09:56:41 -05:00
Ed Page
871792ee3f
Merge pull request #3609 from epage/index
docs: Don't encourage index
2022-04-04 09:52:51 -05:00
Ed Page
a3b628998d docs: Don't encourage index
Its extra maintenance and more likely to cause annoyances.

Fixes #3608
2022-04-04 08:52:20 -05:00
ducaale
fbfeaabfd1 fix(clap_mangen): Use italic for replaceble args 2022-04-03 13:35:30 +01:00
Ed Page
e91d18ba0e
Merge pull request #3605 from ducaale/synopsis-hidden-flags
Don't include hidden flags in the synopsis section from clap_mangen
2022-04-02 19:59:50 -05:00
ducaale
ddc83bfdc8 test(clap_mangen): Hidden flags in synopsis 2022-04-03 00:28:31 +01:00
ducaale
b3b49855ab fix(clap_mangen): Hide hidden flags in synopsis 2022-04-03 00:11:45 +01:00
ducaale
99d6737521 fix(clap_mangen): Update snapshot tests 2022-04-03 00:03:02 +01:00
Ed Page
5be61a199c docs(examples); Call out optional subcommands 2022-04-01 09:27:29 -05:00
Ed Page
08f74046dc chore: Release 2022-04-01 09:15:32 -05:00
Ed Page
6aa40ad2cb docs: Update changelog 2022-04-01 09:15:18 -05:00
Ed Page
732830a98c
Merge pull request #3598 from dragonrider7225/bring-back-debug-impls
fix: Bring forward Debug impls from v2
2022-04-01 09:14:42 -05:00
Kevin Moonen
17fed36da3 fix: Bring forward Debug impls from v2 2022-03-31 22:45:37 -05:00
Ed Page
c75d2642ef chore: Release 2022-03-31 12:22:40 -05:00
Ed Page
b774370565 docs: Update changelog 2022-03-31 12:22:13 -05:00