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

Improve CLI docs #219

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ lazy val docs =
.enablePlugins(MdocPlugin, DocusaurusPlugin)
.jvmPlatform(List(Scala213))
.dependsOn(
`codegen-cli`,
http4s,
`http4s-swagger`,
`aws-http4s` % "compile -> compile,test"
Expand Down
34 changes: 30 additions & 4 deletions modules/docs/src/01-overview/04-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,42 @@ Beside the provided sbt plugin, smithy4s can be used as a CLI. It allows generat

We recommend using [coursier](https://get-coursier.io/docs/cli-launch) to install/run it.

#### Installation
### Installation

```bash
cs install --channel https://disneystreaming.github.io/coursier.json smithy4s
```

#### Usage
### Usage

```bash 
bash> smithy4s generate ./foo.smithy ./bar.smithy
```scala mdoc:invisible
import com.monovore.decline._
import smithy4s.codegen.cli._
```

The CLI comes with a number of options to customize output directories, skip openapi generation (or scala generation), provide a filter of allowed namespaces, etc. Use the `--help` command to get an exhaustive listing.

```scala mdoc:passthrough
println("```bash")
println("bash> smithy4s --help")
println(Main.commands.showHelp)
println("```")
```

#### Codegen

```scala mdoc:passthrough
println("```bash")
println("bash> smithy4s generate --help")
println(Help.fromCommand(CodegenCommand.command))
println("```")
```

#### Dump model

```scala mdoc:passthrough
println("```bash")
println("bash> smithy4s dump-model --help")
println(Help.fromCommand(DumpModelCommand.command))
println("```")
```