Commit Graph
6 Commits
Author SHA1 Message Date
Rauhul Varma f4353dbe3a Simplify synopsis string generation (#316)
- Removes unused codepaths.
- Simplifies synopsis string codepaths by removing optionality. This
  complexity is moved to the caller who is now responsible for filtering
  out hidden arguments and options. This change is desirable as it
  allows the caller to determine if the argument should be hidden. For
  example, while it makes sense to hide arguments in help text, it may
  not make sense to hide them when dumping the arguments for another
  tool to consume.
2021-05-22 10:59:37 -05:00
Nate Cook 2a4664a40b Add support for joined short options (#240)
This supports joined arguments, like '-Ddebug' or '-v4'. Joined arguments
need to be explicitly declared as `.customShort("D", allowingJoined: true)`.
2021-01-16 00:18:23 -06:00
Nate Cook 344537137b Flatten the ArgumentSet storage into a single array (#235)
This removes the nesting inside the ArgumentSet data structure, which
had semantic meaning in an earlier version. This flattening, plus a
switch to using dictionary lookup instead of linear scanning, provides
another performance boost.
2020-09-01 21:07:35 -05:00
ibrahim oktay 59f39ec127 Use the first long name in usage (#179)
* Use the first long name in usage (#167)

Sorting names for option has been changed.
* Usage will choose the first long name, if available, or otherwise the first short name
* Help screen will show short names, then long names, in the order of their declaration.

Solves (#167)

* Fix adding same name more than once.

Checkin long names in sort caused single dash long names to be treated as a short name.
Fixed sort to check “short” instead of “long”

Update current test to cover more cases.

* Add isShort control to Name

*Replace sortedNames with partitionedNames

*Extract uniquifying logic into SequenceExtensions.swift

* Refactor short test with computed property

* Use pattern-matching instead of equality comparison
2020-06-09 17:14:06 -05:00
Šimon Javora 4d2be90027 Remove code the compiler can generate on its own. Removed public annotations nested inside internal types. (#22) 2020-03-02 11:25:07 -06:00
Nate Cook f6ac7b8118 Initial import of ArgumentParser 2020-02-27 15:45:22 -06:00