Commit Graph
8 Commits
Author SHA1 Message Date
Rauhul Varma b1b0595a96 Fix missing option value names in manuals (#473)
- Fixes a manual generation bug where options in the synopsis were not
  given a value name and flags were.
2022-08-26 00:08:04 -07:00
Rauhul Varma e978a3831f Default to single page manuals (#472)
- Changes the generate-manual --single-page argument to --multi-page, so
  generate-manual with create a single manual page with all subcommand
  information by default instead of many distinct files.
2022-08-26 00:03:35 -07:00
Rauhul Varma 4b93f3ecb3 Fix generate-manual plugin authors argument (#471)
- Fixes an issue where the --author option was passed without its value
  by the generate-manual plugin to the generate-manual tool resulting in
  plugin invocation failures or incorrect author information.
2022-08-25 09:47:57 -07:00
Rauhul Varma 48a799e04a Add experimental manual page generation (#332)
- Adds a swift package manager command plugin called
  GenerateManualPlugin. The plugin can be invoked from the command line
  using `swift package experimental-generate-manual`. The plugin is
  prefixed for now with "experimental-" to indicate it is not mature and
  may see breaking changes to its CLI and output in the future. The
  plugin can be can be used to generate a manual in MDoc syntax for any
  swift-argument-parser tool that can be executed via
  `tool --experimental-dump-info`.
- The plugin works by converting the `ToolInfoV0` structure from the
  `ArgumentParserToolInfo` library into MDoc AST nodes using a custom
  (SwiftUI-esk) result builder DSL. The MDoc AST is then lowered to a
  string and written to disk.
- The MDoc AST included is not general purpose and doesn't represent the
  true language exactly, so it is private to the underlying
  `generate-manual` tool. In the future it would be interesting to
  finish fleshing out this MDoc library and spin it out, however this is
  not a priority.
- Next steps include:
  - Improving the command line interface for the plugin.
  - Adding support for "extended discussions" to Commands and exposing
    this information in manuals.
  - Further improve the escaping logic to properly escape MDoc macros
    that might happen to appear in user's help strings.
  - Ingesting external content a-la swift-docc so the entire tool
    documentation does not need to be included in the binary itself.
  - Bug fixes and addressing developer/user feedback.

Built with love,
@rauhul
2022-06-06 11:09:34 -05:00
Nate Cook 1141ed1e1b Support an async entry point for commands (#404)
Adds a new `AsyncParsableCommand` protocol, which provides a
`static func main() async` entry point and can call through to the root
command's or a subcommand's asynchronous `run()` method. For this
asynchronous execution, the root command must conform to `AsyncParsableCommand`,
but its subcommands can be a mix of asynchronous and synchronous commands.

Due to an issue in Swift 5.5, you can only use `@main` on an
`AsyncParsableCommand` root command starting in Swift 5.6.
This change also includes a workaround for clients that are using Swift 5.5.
Declare a separate type that conforms to `AsyncMainProtocol` and add the `@main`
attribute to that type.

```
@main enum Main: AsyncMain {
    typealias Command = <#command#>
}
```
2022-03-14 18:14:09 -05:00
Nate Cook fe71d4007d Allow changelog authors tool to work with other repos (#311) 2021-05-17 15:32:17 -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 5f49a17c6a Add a tool for getting the authors within a range of commits from GitHub (#146)
* Add a tool for getting the authors within a range of commits from GitHub

* Switch to 5.1 syntax
2020-05-15 15:01:12 -05:00