|
@@ -98,7 +98,7 @@ saturnin__conf() {
|
98
|
98
|
*.*:*) ig_mode=-e; ig_query=$1; shift 1; break ;;
|
99
|
99
|
*) warn "bad syntax: $*"; return 2 ;;
|
100
|
100
|
esac done
|
101
|
|
- test -n "$ig_mode" || { warn "could not determine inigrep mode"; return 2; }
|
|
101
|
+ test -n "$ig_mode" || { warn "could not determine inigrep mode"; _saturnin__conf_usage; }
|
102
|
102
|
debug -v ig_limit ig_query ig_mode Strategy
|
103
|
103
|
if test -n "$*";
|
104
|
104
|
then
|
|
@@ -108,7 +108,7 @@ saturnin__conf() {
|
108
|
108
|
files=("${ig_query%%.*}$SATURNIN_CONF_SUFFIX")
|
109
|
109
|
else
|
110
|
110
|
warn "dunno what to load"
|
111
|
|
- return 2
|
|
111
|
+ _saturnin__conf_usage
|
112
|
112
|
fi
|
113
|
113
|
debug -v files
|
114
|
114
|
#shellcheck disable=SC2086
|
|
@@ -355,6 +355,33 @@ _saturnin__conf__load() {
|
355
|
355
|
true
|
356
|
356
|
}
|
357
|
357
|
|
|
358
|
+_saturnin__conf_usage() {
|
|
359
|
+ #
|
|
360
|
+ #
|
|
361
|
+ #
|
|
362
|
+ mkusage "[options] [-e] SECTION.KEY [FILE...]" \
|
|
363
|
+ "[options] -r SECTION.KEY [FILE...]" \
|
|
364
|
+ "[options] -K SECTION [FILE...]" \
|
|
365
|
+ "[options] -P [FILE...]" \
|
|
366
|
+ "[options] -S [FILE...]" \
|
|
367
|
+ -o \
|
|
368
|
+ "-j join all files before applying query" \
|
|
369
|
+ "-1 ensure single line is returned" \
|
|
370
|
+ -c \
|
|
371
|
+ "-e use normal mode (default)" \
|
|
372
|
+ "-r use raw mode (preserves RHS whitespace and some comments)" \
|
|
373
|
+ "-K list available keys in SECTION" \
|
|
374
|
+ "-S list available sections" \
|
|
375
|
+ "-P list available keypaths (SECTION.KEY)" \
|
|
376
|
+ -- \
|
|
377
|
+ "Uses inigrep to query config files. SECTION is section name (may"\
|
|
378
|
+ "contain dots itself, KEY is key name. Unless FILE is provided," \
|
|
379
|
+ "filename is inferred from SECTION (eg. 'foo.ini' if 'foo.bar' was"\
|
|
380
|
+ "sectionname) and searched in folders given in SATURNIN_CONF_PATH."\
|
|
381
|
+ "If FILE contains slash, no search is done and just single FILE is"\
|
|
382
|
+ "used instead."
|
|
383
|
+}
|
|
384
|
+
|
358
|
385
|
_saturnin__nl2colon() {
|
359
|
386
|
#
|
360
|
387
|
# Convert newline-based list of paths to colon:based:list
|