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

doc: corrected mistakes in README #20

Merged
merged 1 commit into from
May 7, 2024
Merged
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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ with `-` or `--`.
var cliargs = new CliArgs("path/to/app", args);
var result = cliargs.parse();

if (result.exception() != null) {
if (result.exception() == null) {
var cmd = result.cmd();
cmd.getName(); // "app"
cmd.getArgs(); // ["hoge", "fuga"]
Expand Down Expand Up @@ -133,6 +133,8 @@ option is not specified in command line arguments.
`postparser` field is a functional interface which processes option argument(s) after parsing if this field is specified.

```java
import com.github.sttk.cliargs.OptCfg.NamedParam.*;
...
var args = new String[]{"--foo-bar", "hoge", "--baz", "1", "-z=2", "-x", "fuga"};
var cliargs = new CliArgs("path/to/app", args);

Expand All @@ -158,7 +160,7 @@ option is not specified in command line arguments.
};

var result = cliargs.parseWith(optCfgs);
if (result.exception() != null) {
if (result.exception() == null) {
var cmd = result.cmd();
cmd.getName(); // "app"
cmd.getArgs(); // ["hoge", "fuga"]
Expand Down Expand Up @@ -227,8 +229,8 @@ And `arg` is what to specify a text for an option argument value in help text.
var options = new Options();

var result = cliargs.parseFor(options);
var cmd = result.cmd();
var optCfgs = result.optCfgs();
var cmd = result.cmdOrThrow();

cmd.getName(); // "app"
cmd.getArgs(); // ["hoge", "fuga"]
Expand Down Expand Up @@ -365,7 +367,7 @@ And the help text can be generated as follows:
This library supports native build with GraalVM.
However, since it utilizes reflection for the option store object passed to `CliArgs#parseFor`, the reflection configurations for the class of this object need to be specified in `reflect-config.json`. The configuration are as follows:

```
```json
[
{
"name":"pkg.path.to.OptionStore",
Expand Down