-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to new record builder syntax (#2)
* Update to new record builder syntax * Fix documentation
- Loading branch information
Showing
12 changed files
with
633 additions
and
673 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
app [main] { | ||
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", | ||
weaver: "../package/main.roc", | ||
} | ||
|
||
import pf.Stdout | ||
import pf.Arg | ||
import pf.Task exposing [Task] | ||
import weaver.Opt | ||
import weaver.Cli | ||
import weaver.Param | ||
|
||
main = | ||
args = Arg.list! | ||
|
||
when Cli.parseOrDisplayMessage cliParser args is | ||
Ok data -> | ||
Stdout.line! "Successfully parsed! Here's what I got:" | ||
Stdout.line! "" | ||
Stdout.line! (Inspect.toStr data) | ||
|
||
Err message -> | ||
Stdout.line! message | ||
|
||
Task.err (Exit 1 "") | ||
|
||
cliParser = | ||
{ Cli.weave <- | ||
alpha: Opt.maybeU64 { short: "a", long: "alpha", help: "Set the alpha level. [default: 123]" } | ||
|> Cli.map \a -> Result.withDefault a 123,, | ||
file: Param.maybeStr { name: "file", help: "The file to process. [default: NONE]" } | ||
|> Cli.map \f -> Result.withDefault f "NONE", | ||
} | ||
|> Cli.finish { | ||
name: "default-values", | ||
version: "v0.0.1", | ||
} | ||
|> Cli.assertValid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
app [main] { | ||
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", | ||
weaver: "../package/main.roc", | ||
} | ||
|
||
import pf.Stdout | ||
import pf.Arg | ||
import pf.Task exposing [Task] | ||
import weaver.Opt | ||
import weaver.Cli | ||
|
||
main = | ||
args = Arg.list! | ||
|
||
when Cli.parseOrDisplayMessage cliParser args is | ||
Ok data -> | ||
Stdout.line! "Successfully parsed! Here's what I got:" | ||
Stdout.line! "" | ||
Stdout.line! (Inspect.toStr data) | ||
|
||
Err message -> | ||
Stdout.line! message | ||
|
||
Task.err (Exit 1 "") | ||
|
||
cliParser = | ||
Opt.u64 { short: "a", long: "alpha", help: "Set the alpha level." } | ||
|> Cli.map Alpha | ||
|> Cli.finish { | ||
name: "single-arg", | ||
version: "v0.0.1", | ||
} | ||
|> Cli.assertValid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.