Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Config.namedArgChar to Config.namedArgPrefix #102

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

andrey-zherikov
Copy link
Owner

No description provided.

@andrey-zherikov andrey-zherikov changed the base branch from master to 2.x August 23, 2023 02:01
@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #102 (27d46ac) into 2.x (254ac8a) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##              2.x     #102   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          24       24           
  Lines        1440     1440           
=======================================
  Hits         1407     1407           
  Misses         33       33           
Files Changed Coverage Δ
source/argparse/config.d 100.00% <ø> (ø)
source/argparse/internal/arguments.d 100.00% <ø> (ø)
source/argparse/internal/command.d 97.29% <ø> (ø)
source/argparse/internal/argumentuda.d 97.01% <100.00%> (ø)
source/argparse/internal/parsehelpers.d 97.72% <100.00%> (ø)
source/argparse/internal/parser.d 96.62% <100.00%> (ø)

@andrey-zherikov andrey-zherikov merged commit 6c7083a into 2.x Aug 23, 2023
14 checks passed
@andrey-zherikov andrey-zherikov deleted the arg-name-prefix branch August 23, 2023 11:33
andrey-zherikov added a commit that referenced this pull request Dec 11, 2023
* Refactor (#96)

* Move onError tp api/cli.d

* Improve ANSI styling handling and making AnsiStylingArgument boolean-like

* Make Parser private

* Remove hooks

* Remove subcommands

* Remove argumentparser

* Update readme

* Add unit tests

* Rename Config.helpStyle to Config.styling (#97)

* Add unit test (#98)

* Refactor (#99)

* Small cleanup

* Make Config a template parameter

* Add unit test

* Styling in error messages (#100)

* Add errorMessagePrefix to Style

* Rename Style.namedArgumentName => Style.argumentName

* Styling in error messages

* Add check for argument name (#101)

* Rename Config.namedArgChar to namedArgPrefix (#102)

* Add checks for positional arguments (#103)

* Refactor (#105)

* Add ArgumentInfo.memberSymbol

* Small refactoring

* Move Restriction and RestrictionGroup to internal.restriction

* Remove symbol parameter

* remove partial apply

* Small refactoring

* Small refactoring

* Add unit test

* Pin LDC to 1.34.0 (#108)

* Add '--verbose' to builds

* Refactoring (#127)

* Required positional arguments must come before optional ones

* Optional positional arguments are not allowed with default subcommand

* Rewrite parser (#128)

* Refactor

* Split ArgumentInfo.names to shortNames and longNames

* Add namedArguments and positionalArguments to Arguments

* Rename Arguments.arguments to info

* Refactor Arguments API

* Remove ArgumentInfo.ignoreInDefaultCommand

* Rewrite parser

* unit tests

* Update readme (#121)

* Update readme

* Update the examples as well

* Apply suggested changes to readme

* Declare `Style.Default` with an alternative syntax (#130)

* Turn `main` and `mainComplete` into regular templates (#132)

They don't need advanced features that template mixins provide. (Regular
templates are mixable, too.)
https://dlang.org/spec/template-mixin.html

* Make Styling API `nothrow pure @safe` (#133)

* Reduce allocations in Styling API (#134)

* Reduce allocations in Styling API

* Remove the overload of `TextStyle.opCall` that takes a sink

We should make `StyledText` a range instead.

* Do not depend on `std.regex` (#131)

* Do not depend on `std.regex`

This saves 1.5 MB in the binary, which is desirable since not every
program that uses `argparse` may want to use regexes - or that
particular implementation of regexes.

`argparse.ansi.getUnstyledText` became eager, but the library wasn't
exploiting its laziness anyway.

* Make `getUnstyledText` lazy and `@nogc`

* Use constants instead of hardcoded characters

* Rework the auxiliary function

Co-Authored-By: Andrey Zherikov <andrey-zherikov@users.noreply.github.com>

* Remove one mutable variable

* Add a small comment

---------

Co-authored-by: Andrey Zherikov <andrey-zherikov@users.noreply.github.com>
Co-authored-by: Andrey Zherikov <andrey.zherikov@gmail.com>

* Improve compilation time and memory (#124)

* Use regular parameters instead of template parameters where possible

This helps in reducing both compilation time and (build-time) memory
requirement.

* Deduplicate `HelpArgumentUDA.parse`

2.3 GB -> 1.7 GB.

* Deduplicate `Complete.CompleteCmd`

1.7 GB -> 1.6 GB.

* Compile the completer on demand

1.6 GB -> 0.8 GB.

* Simplify `CLI!(...).complete`

* Deduplicate `CounterParsingFunction`

* Make some of the config's fields statically known by the parser

So that the compiler can prune dead branches of code.

* Remove `assignChar` from parser's template parameters

* Try to simplify min-max-handling logic in `getMemberArgumentUDA`

* Add a unit test for `getMemberArgumentUDA`

* Move `getArgumentUDA` to `argparse.internal.arguments`

Renamed into `finalize` in the process. It only fills `ArgumentInfo`
so it doesn't have to know about UDAs at all.

* Import non-std modules once per file

---------

Co-authored-by: Nickolay Bukreyev <SirNickolas@users.noreply.github.com>
Co-authored-by: Andrey Zherikov <andrey-zherikov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant