Commit Graph
12 Commits
Author SHA1 Message Date
Rauhul Varma e7765e1f39 Replace createHelp and includeHidden (#405)
- Replaces `ArgumentSet.init(_:creatingHelp:includeHidden:)` with
  `ArgumentSet.init(_:visibility:)`. `visibility` intentionally does not
  have a default value to ensure that callers only have the correct
  arguments. As part of this change `includeHidden` has been replaced
  throughout the codebase with `visibility`. This change also fixes a
  bug where arguments with hidden `visibility` were being displayed in the
  generated command usage string.
2022-02-14 23:54:57 -06:00
Rauhul Varma 185b45fa06 Combine HelpCommand and HelpHiddenCommand (#408) 2022-02-12 16:35:31 -06:00
Rauhul Varma 00a86771ca Clean up help generation (#385)
- Adds check to ensure that `wrapped(to:wrappingIndent:)` doesn't
  attempt to retrieve a negative prefix.
- The Usage struct was composed of an array of strings which always
  contained exact one string at runtime. This struct has been removed
  and replaced with a single usage string.
- Removes HelpGenerator._screenWidthOverride in favor of explicitly
  setting the screen width in generateHelp calls.
2022-01-10 16:02:50 -06:00
Nate Cook 167704f261 Ignore extra help flags when given with the 'help' subcommand (#309) 2021-05-14 17:28:32 -05:00
Nate Cook 280700d361 Add completion script generation (#123)
Support for generating shell completion scripts for `ParsableCommand`
types, with customization points for `ExpressibleByArgument` types and
individual arguments and options. Zsh and Bash are supported in this
initial release.
2020-07-29 17:58:44 -05:00
Adam Sharp a4e4ae4e12 Update documentation and examples to use natural property wrapper syntax (#210)
Since https://github.com/apple/swift-argument-parser/pull/207, property
wrapper usage with no arguments can now use the more natural syntax
without the `()`. Updates documentation and example code accordingly.
2020-07-28 11:34:12 -05:00
Nate Cook 35ceb59427 Nate/continue default initialization (#193)
* Use type inference for flags / options

* Use default value syntax for arg/option arrays

* Allow a default for flag arrays

* Fix some whitespace

* Allow arguments validations to warn instead of fail

* Move nonsense flag warning to argument validation

* Update guides/readme with default literal syntax
2020-06-23 10:43:50 -05:00
Nate CookandErik Little aad1ac085b Make ParsableCommand.run() a mutating method (#163)
Co-authored-by: Erik Little <nuclear.ace@gmail.com>
2020-06-02 14:07:16 -05:00
Nate Cook 44fb59ef87 Add APIs for generating the help screen (#142)
* Add public API for generating help text

* Add tests for `helpMessage()`

* Update documentation

* Use new rendered method instead of property
2020-05-14 12:43:21 -05:00
Nate Cook 31799bc1b4 Add built-in support for --version flag (#102)
* Add built-in support for --version flag

* Test that command-defined --version overrides the built-in.

* Document the `version:` parameter in CommandConfiguration

* Include --version in the generated help.
2020-03-30 12:36:21 -05:00
Miguel Ángel Díaz 9af92b684e remove side-effects from run() in help command (#73) 2020-03-13 13:53:08 -05:00
Nate Cook f6ac7b8118 Initial import of ArgumentParser 2020-02-27 15:45:22 -06:00