Add --library-path long option for -L

-L is the only option without a long form.
This commit is contained in:
Thalia Archibald authored and Emanuele Torre committed 2024-11-08 19:07:55 +01:00
1 parent ff4acba769
commit 0558e77e8c
3 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -226,7 +226,7 @@ sections:
Read filter from the file rather than from a command line, like Read filter from the file rather than from a command line, like
awk's -f option. awk's -f option.
* `-L directory`: * `-L directory` / `--library-path directory`:
Prepend `directory` to the search list for modules. If this Prepend `directory` to the search list for modules. If this
option is used then no builtin search list is used. See the option is used then no builtin search list is used. See the
Generated
+2 -2
View File
@@ -1,5 +1,5 @@
. .
.TH "JQ" "1" "September 2024" "" "" .TH "JQ" "1" "October 2024" "" ""
. .
.SH "NAME" .SH "NAME"
\fBjq\fR \- Command\-line JSON processor \fBjq\fR \- Command\-line JSON processor
@@ -169,7 +169,7 @@ Use the \fBapplication/json\-seq\fR MIME type scheme for separating JSON texts i
Read filter from the file rather than from a command line, like awk\'s \-f option\. Read filter from the file rather than from a command line, like awk\'s \-f option\.
. .
.TP .TP
\fB\-L directory\fR: \fB\-L directory\fR / \fB\-\-library\-path directory\fR:
. .
.IP .IP
Prepend \fBdirectory\fR to the search list for modules\. If this option is used then no builtin search list is used\. See the section on modules below\. Prepend \fBdirectory\fR to the search list for modules\. If this option is used then no builtin search list is used\. See the section on modules below\.
+3 -3
View File
@@ -95,7 +95,7 @@ static void usage(int code, int keep_it_short) {
" an array;\n" " an array;\n"
" --seq parse input/output as application/json-seq;\n" " --seq parse input/output as application/json-seq;\n"
" -f, --from-file file load filter from the file;\n" " -f, --from-file file load filter from the file;\n"
" -L directory search modules from the directory;\n" " -L, --library-path dir search modules from the directory;\n"
" --arg name value set $name to the string value;\n" " --arg name value set $name to the string value;\n"
" --argjson name value set $name to the JSON value;\n" " --argjson name value set $name to the JSON value;\n"
" --slurpfile name file set $name to an array of JSON values read\n" " --slurpfile name file set $name to an array of JSON values read\n"
@@ -137,7 +137,7 @@ static int isoption(const char** text, char shortopt, const char* longopt, int i
return 1; return 1;
} }
} else { } else {
if (longopt != NULL && !strcmp(*text, longopt)) { if (!strcmp(*text, longopt)) {
*text = NULL; *text = NULL;
return 1; return 1;
} }
@@ -403,7 +403,7 @@ int main(int argc, char* argv[]) {
options |= PROVIDE_NULL; options |= PROVIDE_NULL;
} else if (isoption(&text, 'f', "from-file", is_short)) { } else if (isoption(&text, 'f', "from-file", is_short)) {
options |= FROM_FILE; options |= FROM_FILE;
} else if (isoption(&text, 'L', NULL, is_short)) { } else if (isoption(&text, 'L', "library-path", is_short)) {
if (jv_get_kind(lib_search_paths) == JV_KIND_NULL) if (jv_get_kind(lib_search_paths) == JV_KIND_NULL)
lib_search_paths = jv_array(); lib_search_paths = jv_array();
if (text != NULL) { // -Lname if (text != NULL) { // -Lname