You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ADVANCED_USAGE.md
+16-30
Original file line number
Diff line number
Diff line change
@@ -9,24 +9,25 @@ The file must be named `.jelloconf.py` and must be located in the proper directo
9
9
- Windows: `%appdata%/`
10
10
11
11
##### Setting Options
12
-
To set `jello` options in the `.jelloconf.py` file, add any of the following and set to `True` or `False`:
12
+
To set `jello` options in the `.jelloconf.py` file, import the `jello.lib.opts` class, add any of the following and set to `True` or `False`:
13
13
```
14
-
mono = True # -m option
15
-
compact = True # -c option
16
-
lines = True # -l option
17
-
raw = True # -r option
18
-
nulls = True # -n option
19
-
schema = True # -s option
14
+
from jello.lib import opts
15
+
opts.mono = True # -m option
16
+
opts.compact = True # -c option
17
+
opts.lines = True # -l option
18
+
opts.raw = True # -r option
19
+
opts.nulls = True # -n option
20
+
opts.schema = True # -s option
21
+
opts.types = True # -t option
20
22
```
21
23
##### Setting Colors
22
-
You can customize the colors by setting the following variables to one of the following string values: `'black'`, `'red'`, `'green'`, `'yellow'`, `'blue'`, `'magenta'`, `'cyan'`, `'gray'`, `'brightblack'`, `'brightred'`, `'brightgreen'`, `'brightyellow'`, `'brightblue'`, `'brightmagenta'`, `'brightcyan'`, or `'white'`.
24
+
You can customize the colors by importing the `jello.lib.opts` class and setting the following variables to one of the following string values: `'black'`, `'red'`, `'green'`, `'yellow'`, `'blue'`, `'magenta'`, `'cyan'`, `'gray'`, `'brightblack'`, `'brightred'`, `'brightgreen'`, `'brightyellow'`, `'brightblue'`, `'brightmagenta'`, `'brightcyan'`, or `'white'`.
23
25
```
24
-
keyname_color = 'blue' # Key names
25
-
keyword_color = 'brightblack' # true, false, null
26
-
number_color = 'magenta' # integers, floats
27
-
string_color = 'green' # strings
28
-
arrayid_color = 'red' # array IDs in Schema view
29
-
arraybracket_color = 'magenta' # array brackets in Schema view
> Note: Any colors set via the `JELLO_COLORS` environment variable will take precedence over any color values set in the `.jelloconf.py` configuration file
32
33
@@ -61,20 +62,5 @@ jc -a | jello -i 'g("parsers.6.compatible")'
61
62
"freebsd"
62
63
]
63
64
```
64
-
## Setting Custom Colors via Environment Variable
65
-
In addition to setting custom colors in the `.jelloconf.py` intialization file, you can also set them via the `JELLO_COLORS` environment variable. Any colors set in the environment variable will take precedence over any colors set in the initialization file.
66
65
67
-
The `JELLO_COLORS` environment variable takes six comma separated string values in the following format:
> Tip: Add a line to print a message to STDERR in your `.jelloconf.py` file to show when the initialization file is being used: `print('Running initialization file', file=sys.stderr)`
Use the `-l` option to print JSON array output in a manner suitable to be assigned to a bash array. The `-r` option can be used to remove quotation marks around strings. If you want `null` values to be printed as `null`, use the `-n` option, otherwise they are blank lines.
113
+
Use the `-l` option to print JSON array output in a manner suitable to be assigned to a bash array. The `-r` option can be used to remove quotation marks around strings. If you want `null` values to be printed as `null`, use the `-n` option, otherwise they are printed as blank lines.
113
114
114
115
Bash variable:
115
116
```
@@ -124,30 +125,75 @@ while read -r value; do
124
125
done < <(cat data.json | jello -rl _.foo)
125
126
```
126
127
127
-
Here is more [advanced usage](https://github.com/kellyjonbrazil/jello/blob/master/ADVANCED_USAGE.md) information.
128
+
### Setting Custom Colors via Environment Variable
129
+
Custom colors can be set via the `JELLO_COLORS` environment variable. Any colors set in the environment variable will take precedence over any colors set in the initialization file. (see [Advanced Usage](https://github.com/kellyjonbrazil/jello/blob/master/ADVANCED_USAGE.md))
130
+
131
+
The `JELLO_COLORS` environment variable takes four comma separated string values in the following format:
0 commit comments