1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

add exit codes section

This commit is contained in:
Kelly Brazil
2021-05-11 10:59:26 -07:00
parent 48921d4584
commit 21a15225eb
2 changed files with 18 additions and 0 deletions

View File

@ -203,6 +203,15 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
- `-r` raw output. Provides a more literal JSON output, typically with string values and no additional semantic processing
- `-v` version information
### Exit Codes
Any fatal errors within `jc` will generate an exit code of `100`, otherwise the exit code will be `0`. When using the "magic" syntax (e.g. `jc ifconfig eth0`), `jc` will store the exit code of the program being parsed and add it to the `jc` exit code. This way it is easier to tell if an error was from the parsed program or `jc`.
Consider the following examples using `ifconfig`:
- `ifconfig` exit code = `0`, `jc` exit code = `0`, combined exit code = `0` (no errors)
- `ifconfig` exit code = `1`, `jc` exit code = `0`, combined exit code = `1` (error in `ifconfig`)
- `ifconfig` exit code = `0`, `jc` exit code = `100`, combined exit code = `100` (error in `jc`)
- `ifconfig` exit code = `1`, `jc` exit code = `100`, combined exit code = `101` (error in both `ifconfig` and `jc`)
### Setting Custom Colors via Environment Variable
You can specify custom colors via the `JC_COLORS` environment variable. The `JC_COLORS` environment variable takes four comma separated string values in the following format:
```bash

View File

@ -131,6 +131,15 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
- `-r` raw output. Provides a more literal JSON output, typically with string values and no additional semantic processing
- `-v` version information
### Exit Codes
Any fatal errors within `jc` will generate an exit code of `100`, otherwise the exit code will be `0`. When using the "magic" syntax (e.g. `jc ifconfig eth0`), `jc` will store the exit code of the program being parsed and add it to the `jc` exit code. This way it is easier to tell if an error was from the parsed program or `jc`.
Consider the following examples using `ifconfig`:
- `ifconfig` exit code = `0`, `jc` exit code = `0`, combined exit code = `0` (no errors)
- `ifconfig` exit code = `1`, `jc` exit code = `0`, combined exit code = `1` (error in `ifconfig`)
- `ifconfig` exit code = `0`, `jc` exit code = `100`, combined exit code = `100` (error in `jc`)
- `ifconfig` exit code = `1`, `jc` exit code = `100`, combined exit code = `101` (error in both `ifconfig` and `jc`)
### Setting Custom Colors via Environment Variable
You can specify custom colors via the `JC_COLORS` environment variable. The `JC_COLORS` environment variable takes four comma separated string values in the following format:
```bash