Commit graph

3055 commits

Author SHA1 Message Date
Ed Page
31f9234cc7 feat(parser): Add From<str> and From<String> 2022-09-26 09:51:44 -05:00
Ed Page
931b6338f1 refactor(parser): Clarify FromStr from future FromStr 2022-09-26 09:51:03 -05:00
Ed Page
76ec238b45 docs: Clarify value_parser implementation 2022-09-26 09:50:51 -05:00
Ed Page
9f49c0c630 feat(parser): Support From<OsString> for value_parser 2022-09-26 09:50:49 -05:00
Ed Page
e64ed91a4e feat(parser): Support From<&OsStr> types for value_parser!
Last time I tried this, I wasn't able to resolve the lifetime issues.  I
seemed to have gotten it working this time.

This came up in #4254.
2022-09-26 09:50:12 -05:00
Ed Page
037b07577c feat: Expose ANSI styling to the user
This gives users the control over where clap outputs while still getting
colors.  For users who want to support old windows versions, check out
`fwdansi` crate.
2022-09-22 09:59:42 -05:00
Ed Page
a2272a2c50 feat(error): Add a 'render' method 2022-09-22 09:55:11 -05:00
Ed Page
4280fdfcbd fix(help): Replace help writers with renderers
The writer is less convenient and isn't offering any performance
benefits of avoidign the extra allocations, so let's render instead.

This supersedes #3874

Fixes #3873
2022-09-22 09:54:19 -05:00
Ed Page
652e71d616 fix(help)!: Provide styled usage to user
This will open us up to providing the user with access to the styled
version in the future.
2022-09-22 09:54:19 -05:00
Ed Page
a76f622d17 docs: Clarify when quoting is required for arg 2022-09-21 11:49:18 -05:00
Ed Page
2bbb81f311 docs: Clarify value parser
Things that tripped up a user
- Derive reference was misunderstood to say that the only alternative to
  the built-in value parser behavior was to implement
  `ValueParserFactory`
  - We now delegate to `value_parser!`s docs any talk of integrating
    into it (it should have been a subbullet of "not present" anyways)
- `value_parser!` relies too much on the example to demonstrate behavior
  when the user will likely make the determination of whether its
  relevant before then
  - We are now more upfront what type mappings are supported
- Too many steps to find all information
  - For example, a user needs to look at `TypedValueParser`
    implementations, `ValueParserFactory` implementations, and `From<T>
    for ValueParser` implementations to understand what all can be used
  - We are now more upfront with a lot of this information at the entry
    points the user is most likely to look at

In addition, I did an audit of the docs to make sure they were updated
for us only supporting the new behavior and all of the new APIs.

See https://www.reddit.com/r/rust/comments/xjlie4/preannouncing_clap_40_a_rust_cli_argument_parser/ip9kzf1/
2022-09-21 11:11:21 -05:00
Ed Page
99dfe7404a docs(ref): Remove dead example
This was missed in the migration to the reference being on docs.rs.  Not
feeling its worth finding a way to integrate it into the new structure.
2022-09-21 11:02:08 -05:00
Ed Page
4674e43493 fix(error): Remove RawFormatter
The likelihood of using this is a lot lower now with `KindFormatter` and
`error-context` feature flag.

People can implement it themselves.
2022-09-20 13:40:18 -05:00
Ed Page
90bcb7f75e fix(error): Use a non-generic Error alias
`clap::Error::raw` was producing ambiguity errors with a default generic
parameter on `clap::error::Error` (which `clap::Error` is a re-export
of).

I tried making `clap::Error` a type alias with a default generic
parameter but that ran into an ambiguity error with `map_err`.

So I'm going ahead and hard coding `clap::Error`.  We don't expect
people to change this all that often.
2022-09-20 13:37:02 -05:00
Ed Page
745fa9927a perf(help): Remove more from usage feature
Quality of error-context goes down with this.
2022-09-19 14:03:55 -05:00
Ed Page
bfa365a2cc feat(help): 'usage' feature flag for auto-genned usage 2022-09-19 13:15:47 -05:00
Ed Page
80f616a4b3 refactor(parser): Clarify argument 2022-09-19 13:02:26 -05:00
Ed Page
553a93efc8 refactor(help): Make usage optional 2022-09-19 12:15:52 -05:00
Ed Page
7a5dad89ff feat(help): Break out help feature flag
This removes auto-generated help, saving about 50 KiB.
2022-09-19 11:54:10 -05:00
Ed Page
6ea5d46300 refactor(help): Move near use 2022-09-19 11:26:06 -05:00
Ed Page
9036d3fd3c refactor(help): Split out help templates 2022-09-19 11:20:18 -05:00
Ed Page
e75da2f868 perf(help): Reduce colorless code size
This takes off another 14 KiB when color us not used.  My hope is that
we'll be able to switch away from `termcolor` to a term styling crate
that will make this work in the color case as well.
2022-09-19 10:36:43 -05:00
Ed Page
2d83a7b12e feat(error): Break out error-context feature flag
This is a cheap pass at creating this to allow cutting out the cost of
rich error information / programmatic error information.

This cuts about 20 KiB off of the binary.

There is more we could cut out, like collecting of used arguments for
the usage, but I want to keep the conditionals simple.
2022-09-19 10:23:55 -05:00
Ed Page
b4788d51f1 fix(error): Provide a no-context alternative to RichFormatter 2022-09-19 09:48:54 -05:00
Ed Page
ba9e6d052a feat(error): Provide abstraction for default formatter 2022-09-19 09:38:16 -05:00
Ed Page
e9f1287b63 fix(help): Separate command flags like options
Fixes #4232
2022-09-19 09:07:43 -05:00
Ed Page
ad05d1624b fix(help: Be more precise on literal vs not 2022-09-19 09:05:44 -05:00
Ed Page
c165b601ac perf: Switch to &'static str by default
Originally, clap carried a lifetime parameter.  When moving away from
that, we took the approach that dynamically generated strings are always
supported and `&'static str` was just an optimization.

The problem is the code size increase from this is dramatic.  So we're
taking the opposite approach and making dynamic formatting opt-in under
the `string` feature flag.  When deciding on an implementation, I
favored the faster one rather than the one with smaller code size since
small code size can be gotten through other means.

Before: 567.2 KiB, 15.975 µs
After: 541.1 KiB, 9.7855 µs
With `string`: 576.6 KiB, 13.016 µs
2022-09-16 16:44:39 -05:00
Ed Page
fe43f0c945 Revert "fix: Remove once_cell dependency from derive"
This reverts commit 429143af42.
2022-09-16 16:19:03 -05:00
Ed Page
bbbaca2ffe perf: Hint to the compiler when once_cell isn't needed 2022-09-16 16:14:32 -05:00
Ed Page
10854cd262 Revert "refactor: Remove once_cell dependency"
This reverts commit c9d883a8c6.
2022-09-16 16:14:32 -05:00
Ed Page
7ccaebb65d refactor(parser): Switch from Box<str> to String
This is a more familiar type for people and it didn't cost us anything
(in fact it undid the code size change in the last commit).
2022-09-16 16:14:32 -05:00
Ed Page
1e13109a26 refactor(parser): Track subcommands with Box<str>
The overall hope is to allow a `&'static str`-only version of clap, so
we need to move off of `Str` where dynamic strings are required.  We
need it here for subcommands due to external subcommands.

This had minimal impact on code size (567.2 to 567.5 KiB)
2022-09-16 16:14:32 -05:00
Ed Page
86b2fe5a2d refactor(parser): Reduce work when validating args 2022-09-16 16:14:16 -05:00
Ed Page
af9e1b9763 refactor(parser): Don't throwaway work 2022-09-16 16:14:16 -05:00
Ed Page
4869c43612 refactor: Simplify help subtree creation 2022-09-16 16:14:16 -05:00
Ed Page
acb0fb7809 fix: Generalize mut_arg, like mut_subcommand
This makes us accept `str` and not do any allocations at the cost of
panicing if unsupported which I think fits our overall story in trying
to catch development-time errors.
2022-09-16 15:31:49 -05:00
Ed Page
dbf2c86995 perf: Misc simplifications for code size
This dropped a fraction of a KiB but it will at least not cause people
to ask if it'd help to simplify in the future.
2022-09-16 15:31:49 -05:00
Ed Page
0184cf008a fix(parser): Quote the suggested help
We do it elsewhere but here it is only distinguished coloring.

Inspired by #4218
2022-09-15 16:24:59 -05:00
Ed Page
b7d13dfb88 fix(parser): Prefer invalid subcommands over invalid args
Just having `--help` or `--version` can make us get invalid args instead
of invalid subcommands.   It doesn't make sense to do this unless
positionals are used.  Even then it might not make sense but this is at
least a step in the right direction.

Unsure how I feel about this being backported to clap 3.  It most likely
would be fine?

This was noticed while looking into #4218
2022-09-15 10:30:03 -05:00
Ed Page
23ce67e323 feat: Allow resetting builder methods
Fixes #4178
2022-09-13 15:16:57 -05:00
Ed Page
f68500d9fd fix: Replace Arg::env with Arg::env_os
With `Into<OsStr>`, the separate function isn't needed.
2022-09-13 14:55:12 -05:00
Ed Page
da9691d369 docs: Clarify role of max_term_width 2022-09-13 11:40:06 -05:00
Ed Page
01c0975678 feat(derive): Reserve 'group_id' trait method 2022-09-13 07:06:12 -05:00
Ed Page
0eb95022a5 fix(help): Respect LINES and COLUMNS
Fixes #4186
2022-09-12 20:17:20 -05:00
Ed Page
0760498200 refactor(help): Allow looking up dimensions independently 2022-09-12 19:55:13 -05:00
Ed Page
c9eef44213 fix: Make arg!(--flag <value>) optional by default
This was ported over from the usage parser which modeled after docopt.
We just never got around to implementing the rest of the syntax.

However, when considering this as a standalone feature, an
`arg!(--flag <value>)`, outside of other context, should be optional.
This is how the help would display it.

Fixes #4206
2022-09-12 17:10:01 -05:00
Ed Page
430a384984
Merge pull request #4196 from epage/link
docs(parser): Clarify needs for negative numbers
2022-09-07 20:00:49 -05:00
Ed Page
fa7a1fca58 docs(parser): Clarify needs for negative numbers 2022-09-07 19:48:10 -05:00
Ed Page
afeed4043c perf(assert): Don't make release pay the cost 2022-09-07 19:43:26 -05:00
Ed Page
985a1b9b4a docs(derive): Collect tips at end 2022-09-07 18:56:05 -05:00
Ed Page
c90a4eabae fix(help): Make output more dense
In looking at other help output, I noticed that they use two spaces, in
place of clap's 4, and it doesn't suffer from legibility.  If it
doesn't make the output worse, let's go ahead and make it as dense so we
fit more content on the screen.

This is a part of #4132
2022-09-07 17:13:55 -05:00
Ed Page
ed6475e9de fix(help): Clarify what is tab dependent and what isn't 2022-09-07 16:39:14 -05:00
Ed Page
56fe50eab8 fix(help): I think this fixes a bug?
The existing behavior is hard to explain, so this is the best I've
figured is going on.
2022-09-07 16:38:33 -05:00
Ed Page
876da97d1c fix(help): Make next-line help less sensitive to tab changes 2022-09-07 15:52:26 -05:00
Ed Page
d3fc37b678 fix(help): Long-only indentation is independent of TAB 2022-09-07 15:07:47 -05:00
Ed Page
bbb6c38bad fix(help):Be dense on short next line help
If short help is too long for the terminal, clap will automatically
switch to next line help.  As part of next line help for longs, we add a
blank line between args.  This helps make the args clearer when dealing
with multiple paragraphs.  However, its not as much needed for short and
subcommands (always short), so now short matches subcommands.

This was inspired by #3300 and a part of #4132
2022-09-07 14:05:17 -05:00
Ed Page
61f8a9375a docs: Show how last can be used
We can't quite get git's behavior because it has `last` as both before
and after `--`
2022-09-07 11:27:39 -05:00
Ed Page
9a645d2d19 fix(help): Collapse usage to one line
After looking at more examples, I've become more attached to this
briefer format.

Part of #4132
2022-09-07 11:03:57 -05:00
Ed Page
1258f3e5f6 fix: Deprecate Command::allow_negative_numbers
Better to set on individual args
2022-09-07 07:24:42 -05:00
Ed Page
8ad29ef337 feat: Allow specifying negative nums on Arg, like hyphens 2022-09-07 07:18:19 -05:00
Ed Page
16d5a2a19a perf: Shrink the code 2022-09-07 07:00:58 -05:00
Ed Page
2ebe5ae795 docs: Cross-link allow_hyphe_values with trailing_var_arg 2022-09-06 21:24:06 -05:00
Ed Page
d45e4be14b fix(derive): Deprecate Command::allow_hyphen_values
Fixes #3450
2022-09-06 20:50:09 -05:00
Ed Page
7a2bbca62b fix(derive): Make Command::allow_hyphen_values forward to Arg 2022-09-06 19:41:17 -05:00
Emerson Ford
fd9a5a1d50 fix(parser): Arg::allow_hyphen_values correctly handles long args in first pos
This makes it match up with `Command::allow_hyphen_values` which was the
guiding factor for what the behavior should be.

This supersedes #4039

Fixes #3880
Fixes #1538
2022-09-06 19:41:17 -05:00
Ed Page
94a5e7fa1a refactor(parser): Highlight short/long parallels 2022-09-06 19:41:17 -05:00
Ed Page
bc5c5e4a9f fix(parser): Make Command/Arg behave same for shorts with allow_hyphen_values 2022-09-06 19:41:17 -05:00
Ed Page
bffce7f57a fix: Deprecate Command::trailing_var_arg
Now that we have it on `Arg`, we don't need it on `Command`
2022-09-06 19:41:17 -05:00
Ed Page
b07d02ef46 feat: Allow specifying trailing_var_arg on Arg, like last
This has been a bit out of place being on the command.  Now its clearer
what the user intends to be the trailing var arg and it is more likely
to be discovered.
2022-09-06 19:41:14 -05:00
Ed Page
9a4c2bc990 docs: Improve description around trailing_var_arg 2022-09-06 14:34:47 -05:00
Ed Page
1dd9245fff refactor: Use parameters over settings 2022-09-06 14:43:02 -05:00
Ed Page
0e915e0d3a docs(derive): Update for new attributes 2022-09-02 15:39:13 -05:00
Ed Page
5112372c77 feat(parser): Provide convenience for SetTrue
I wanted to make `bool` a defaulted type parameter but
https://github.com/rust-lang/rust/issues/36887
2022-09-01 19:40:56 -05:00
Ed Page
80ec011b6e feat(parser): Provide convenience accessor for Counts 2022-09-01 19:19:55 -05:00
Ed Page
cdcbf1300d fix(usage): Have spillover use TAB
This was missed in #4161
2022-08-31 16:20:56 -05:00
Ed Page
671914b590 fix(error): Make whitespace consistent with self/help
Sometimes errors would use a tab, sometimes four spaces.  This makes it
always four spaces and shares a definition with help.
2022-08-31 16:02:14 -05:00
Ed Page
439c9e7a91 feat(help): Expose clap's indentation to help_template
This will make it easier for help templates to be consistent with clap
2022-08-31 15:42:59 -05:00
Ed Page
803d87b193 refactor(help): Reduce magic numbers 2022-08-31 15:39:15 -05:00
Ed Page
65b5b5f7bf fix(help): Remove name/version/author from help
This is to help shorten it and polish it by removing redundant
information.

This is a part of #4132
2022-08-31 15:06:15 -05:00
Ed Page
c1c269b427 fix(help): Clarify short vs long help
In reviewing CLIs for #4132, I found some were providing helps on `-h`
vs `--help` and figured that could be built directly into clap.  I had
considered not making this hint automatic but I figured the overhead of
checking if long exists wouldn't be too bad.  The code exists (no binary
size increase) and just a simple iteration is probably not too slow
compared to everything else.

Fixes #1015
2022-08-31 14:25:46 -05:00
Ed Page
cdfd455ee6 fix(help): Always trim output
This ensures we don't end up with accidental leading or trailing
newlines due to help template variables not being used when a section is
empty.

This is prep for removing name/version from the default template and is
part of #4132
2022-08-31 09:35:33 -05:00
Ed Page
42c943844c fix(help): Use Command in place of Subcommand
In switching to title case for help headings (#4123), it caused me to
look at "subcommand" in a fresh light.  I can't quite put my finger on
it but "Subcommand" looks a bit sloppy.  I also have recently been
surveying other CLIs and they just use "command" as well.

All of them are commands anyways, just some are children of others
(subcommands) while others are not (root or top-level commands, or just
command).  Context is good enough for clarifying subcommands from root
commands.

This is part of #4132
2022-08-31 08:53:10 -05:00
Ed Page
c4dd6aeb42 docs: Update example help 2022-08-30 19:57:26 -05:00
Ed Page
44d3614add revert: Add some deprecated placeholders 2022-08-30 16:47:39 -05:00
Ed Page
02d27b5ce3 fix(usage): Make dont_collapse_args_in_usage the default
The setting was added to resolve #769.  The reason it was optional is out
of concern for applications with a lot of positional arguments.  I think
those cases are rare enough that we should just push people to override
the usage.  Positional arguments are generally important enough, even if
optional, to show.

As a side effect, this fixed some bugs with
`dont_collapse_args_in_usage` where it would repeat an argument in a
smart usage.

As a side effect, smart usage now shows `--` when it should
2022-08-30 16:12:49 -05:00
Ed Page
c22b78ba61 fix(usage): Don't put in [--] for multiple values
This was added in #165 but the relative value of this doesn't seem worth
the complexity at the moment.
2022-08-30 16:01:22 -05:00
Ed Page
a00cbab1dc fix(usage): Don't list -- as optional for last
`last` must always follow a `--`, so it isn't optional.
2022-08-30 15:41:35 -05:00
Ed Page
d791a93ec7 refacor(usage): Remove use of sort 2022-08-30 11:27:14 -05:00
Ed Page
1dde9268d5 fix(usage): Don't include irrelevant parent args
This was identified in https://github.com/clap-rs/clap/discussions/4134
2022-08-30 13:43:31 -05:00
Ed Page
8da1f085dd fix(parser): Require earlier, not-present positionals 2022-08-30 09:31:46 -05:00
Ed Page
2388ace47b refactor(parser): Hoist check into iteration 2022-08-30 08:47:03 -05:00
Ed Page
619b1fb187 perF(usage): Defer de-duplicating to later
This should drop code size
2022-08-30 07:15:50 -05:00
Ed Page
66957f8398 refactor(usage): Make last check clearer 2022-08-29 21:26:39 -05:00
Ed Page
09031fb4ab refactor(usage): Consolidate required bookkeeping 2022-08-29 21:26:35 -05:00
Ed Page
85569514db refactor(usage): Make duplicate check more resilient 2022-08-29 21:26:32 -05:00
Ed Page
3b17f7fdc9 refactor(usage): Pull out duplicate check 2022-08-29 21:26:28 -05:00
Ed Page
ecb632f487 refactor(usage): Split out group processing 2022-08-29 21:26:24 -05:00
Ed Page
26ea3e32d0 refactor(parser): Consolidate the loops 2022-08-29 19:42:21 -05:00
Ed Page
0c9b9d7ec8 fix(parser): Show all required errors at once
This also has the side effect of always using the "smart usage" which is
why the tests changed.
2022-08-29 19:40:35 -05:00
Ed Page
14d910dee1 refactor(parser): Prefer explicit for loops 2022-08-29 17:04:17 -05:00
Ed Page
3c466c63f7 refactor(parser): Flatten required_unless logic 2022-08-29 17:02:05 -05:00
Ed Page
dacc8ff43a refactor(parser): Consolidate presence check 2022-08-29 16:59:58 -05:00
Ed Page
76dd3a18e2 fix(help): Ensure consistency in usage 2022-08-29 15:50:39 -05:00
Ed Page
02db3043e2 fix(help): Consistently use [] for positionals
In the usaeg we use `[]` but in the arg list we use `<>`.
2022-08-29 15:34:30 -05:00
Ed Page
5ef803f01a refactor(help): Move close to use 2022-08-29 15:18:46 -05:00
Ed Page
91332267cf refactor(help): Positive logic can clarify intent 2022-08-29 14:29:32 -05:00
Ed Page
87e2d0c2e0 refactor(help): Clarify intent of fn 2022-08-29 14:07:10 -05:00
Ed Page
2b4541fab2 refactor(help): Clean up code 2022-08-29 14:04:27 -05:00
Ed Page
36460aed08 fix: Deprecate _os variants
PR #4096 made them redundant
2022-08-29 12:42:30 -05:00
Ed Page
4eeee9b110 fix(help): Command::print_help should respect disable_colored_help 2022-08-29 10:47:08 -05:00
Andrew Shu
eec047a6f6 fix(help): Do not propagate global args to help
This prevents global args from showing in help completions,
since help completions should only suggest subcommands.
Adds tests to ensure the args still show in the generated
help messages of subcommands.
2022-08-26 17:48:58 -07:00
Ed Page
294868f5d8
Merge pull request #4115 from talklittle/completion-help-parser-flag
feat(complete): Add completion for help subcommands
2022-08-26 15:28:21 -05:00
Andrew Shu
0d0be51606 fix(complete): Fix help completion issues
* Copy hide flag

* Revert global args special handling. Another commit will
address the issue of whether global args should be included in
help subtrees.
2022-08-26 12:57:12 -07:00
Ed Page
e02648e66b fix(help): Don't dim placeholders
This came from feedback: https://rust-lang.zulipchat.com/#narrow/stream/220302-wg-cli/topic/Help.20changes.20in.20clap.20v4
2022-08-26 11:46:44 -05:00
Ed Page
83d6add9aa fix(help): Shift focus to subcommands, when present
In surveying various tools and CLI parsers, I noticed they list the
subcommands first.  This puts an emphasis on them which makes sense
because that is most likely what an end user is supposed to pass in
next.

Listing them last aligns with the usage order but it probably doesn't
outweigh the value of getting a user moving forward.
2022-08-26 10:59:40 -05:00
Ed Page
9b23a09f7a fix(help): Don't rely on ALL CAPS for headers
I see them fulfilling two roles
- A form of bolding
- As a callback to their placeholder in usage

However, it is a bit of an unpolished look and no other CLI seems to do
it.  This looks a bit more proefessional.  We have colored help for
formatting and I think the sections relation to usage will be clear
enough.
2022-08-26 10:21:18 -05:00
Ed Page
8315ba3dd6 fix(error): Don't underline indentation 2022-08-26 07:15:57 -05:00
Ed Page
6079a871a0 fix(help): Use a more neutral palette
Fixes #2963
2022-08-25 19:23:52 -05:00
Andrew Shu
729406661c refactor(complete): Clean up help completion
* Manual subtree copy to ensure correct behavior and settings
* Always set ExpandHelpSubcommandTrees in Command::build
* Remove redundant logic
2022-08-25 15:43:27 -07:00
Ed Page
d6d838ebe2 feat: Allow stylized usage 2022-08-25 17:07:06 -05:00
Andrew Shu
fdcee9313f feat(complete): Add completion for help subcommands
Adds parser flags to toggle whether to run the
expensive clone logic for completions case.

Help completion will only suggest subcommands, not args.

clap_complete generator sets the flag.
2022-08-25 13:58:08 -07:00
Ed Page
8382675985 style: Fix a typo 2022-08-25 13:45:36 -05:00
Ed Page
81f29d29ad refactor(help): Top-down sort functions 2022-08-25 13:39:21 -05:00
Ed Page
0c2f20d660 refactor(help): Drop the parser macro 2022-08-25 13:32:08 -05:00
Ed Page
207bb00453 refactor(help): Simplify several parts 2022-08-25 13:26:21 -05:00
Ed Page
d652f0348d refactor(help): Reduce a fn's visibility 2022-08-25 13:15:20 -05:00
Ed Page
df7616b820 fix(help): Match v3 usage for optional positionals 2022-08-25 13:13:09 -05:00
Ed Page
0e0c5eb218 refactor(help): Consolidate value printing 2022-08-25 13:07:32 -05:00
Ed Page
e00abc6905 refactor(help): Consolidate arg suffix rendering
This ended up favoring the help implementation
2022-08-25 13:01:27 -05:00
Ed Page
8607695ed9 refactor(help): Simplify the code
While this doesn't reduce size, it cleans things up to make it easier
2022-08-25 12:47:52 -05:00
Ed Page
64753bbc7d refactor(help): Make spec value implementations more flexible 2022-08-25 11:54:34 -05:00
Ed Page
06c40b636e refactor(help): Clarify arg separator 2022-08-25 11:33:21 -05:00
Ed Page
2dd493a295 perf(help): Reduce code size for arg generation 2022-08-25 11:29:23 -05:00
Ed Page
0a15d9ad0c refactor(help): Clarify intent 2022-08-25 11:01:03 -05:00
Ed Page
2d5b3263c5 feat: Allow styling of rest of StyledStr help 2022-08-25 10:39:39 -05:00
Ed Page
764ec6903b feat: Allow stylized arg helps
This adds about 5 KiB to `.text`
2022-08-25 10:18:41 -05:00
Ed Page
c228c88309 perf(help): Prefer small binary to speed 2022-08-25 09:54:58 -05:00
Ed Page
5e1d2d349b fix(debug): Reduce noise 2022-08-25 09:54:11 -05:00
Ed Page
c2e80beed2 fix(help): Allow stylized help template 2022-08-25 09:53:24 -05:00
Ed Page
1bd9365bdf perf(help): Reduce binary size
This dropped us about 1.8 KiB
2022-08-25 09:51:41 -05:00
Ed Page
37f2efb0bd perf: Vendor textwrap parts we need
The immediate benefit is binary size but this also makes us more
flexible on the implementation, like allowing wrapping of `StyledStr`.

This removed 12 KiB from `.text`

This helps towards #1365 and probably #2037
2022-08-25 09:50:54 -05:00
Ed Page
735d6fd1e3 refactor: Extract our own display width
This added about 4 KiB to `.text` which makes sense since we duplicated
logic.
2022-08-24 18:19:03 -05:00
Ed Page
c6155f62d5 feat: Open the door for user styling in the future
This added about 10 KiB to the `.text` which I cannot explain why
2022-08-24 18:17:42 -05:00
Ed Page
2e2b63fa5c
Merge pull request #4106 from jpgrayson/doc-override-usage
docs: overriding multi-line usage
2022-08-25 06:19:54 -05:00
Ed Page
ef5f9f956a perf(error): Allow custmizing formatting
For now, there isn't much a custom implementation can do.

Going from `Rich` to `Null` drops about 6 KiB from the binary

This is a part of #1365 and #1384
2022-08-24 12:40:21 -05:00
Ed Page
d16a531e54 feat(error): Expose context lookup 2022-08-24 11:12:13 -05:00
Ed Page
ba5a4bc6d4 refactor(error): Switch Vec to FlatMap
Looks like this dropped 2 KiB
2022-08-24 11:10:41 -05:00
Ed Page
3672663319 refactor(error): Delay colorizing until the end
This is prep for creating a formatter trait to select alternative
implementations for errors.
2022-08-24 11:00:20 -05:00
Ed Page
956789c39f
Merge pull request #4110 from epage/styled
refactor(help): Prepare for user-visible styled string
2022-08-24 11:02:25 -05:00