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

Implement @CommandDefault #27

Merged
merged 6 commits into from
Nov 10, 2020
Merged

Implement @CommandDefault #27

merged 6 commits into from
Nov 10, 2020

Conversation

BradleyChatha
Copy link
Owner

TLDR; @Command(null, "desc") -> @CommandDefault("desc")

Old syntax now fails an assert with a user-friendly message:

Null command names are deprecated, please use @CommandDefault instead.

Closes #6

@BradleyChatha BradleyChatha added the enhancement New feature or request label Nov 6, 2020
@BradleyChatha
Copy link
Owner Author

Don't think there's much holding this back, just wanted to open a PR just in case.

@andrey-zherikov
Copy link
Contributor

Is it checked somewhere that @CommandDefault is used not more than once?

@BradleyChatha
Copy link
Owner Author

It's done as a runtime check

enforce(
mostly because it was just easy to slap it there. For such a minor, (hopefully) uncommon error that's easy to fix and will be flagged up immediately via an exception, it might be a waste of time to move it into a compile-time check.

@BradleyChatha
Copy link
Owner Author

I realised just as I pushed that I forgot to switch branches for github action change. Meh.

@andrey-zherikov andrey-zherikov mentioned this pull request Nov 9, 2020
BradleyChatha and others added 3 commits November 10, 2020 01:00
* Small refactoring

* Nullable _defaultCommand

* [Super pedantic] Keeping the code style similar

Don't worry too much about following my archaic style, it was just so it wasn't bothering me that parts of the function used "this." and some parts didn't.

* [Ultra pedantic] I missed one.

* Implement @ArgValidator (#29)

* Implement @ArgValidator

* Fix example

* Help text tweaks (#26)

* Closes #7 and closes #11

* Make error messages a bit more standard looking

* Fix crash when there's positional args but no names for them

* Closes #8

* Give positional args a default name if one isn't provided

* misc fix

* Make the "missing arg" error look better

* Add the app name into the Usage: line

* Remove some unused imports

* HelpTextBuilderSimple now supports arg groups

* Allow arg groups to have descriptions

* Add a new line between arg content

* Closes #20

* Add some docs

* Forgive this sin, but it's in the interest of correctly ordered help text

* Accidentally reverted #8

* Unbreak things (I hope)

* Small refactoring

* Nullable _defaultCommand

* Add getSymbolsByUDAInModules

* Proper validation of at most one @ComandDefault

Co-authored-by: Bradley Chatha <bradley@chatha.dev>
@BradleyChatha BradleyChatha merged commit 951d37e into master Nov 10, 2020
@BradleyChatha BradleyChatha deleted the default-command branch November 10, 2020 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add @DefaultCommand(string description)
2 participants