mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-18 00:45:47 +00:00
mlrrc in mlr --help and man mlr
This commit is contained in:
parent
9808dc9a70
commit
003455bc7c
6 changed files with 184 additions and 0 deletions
|
|
@ -136,6 +136,7 @@ static void main_usage_examples(FILE* o, char* argv0, char* leader);
|
|||
static void list_all_verbs_raw(FILE* o);
|
||||
static void list_all_verbs(FILE* o, char* leader);
|
||||
static void main_usage_help_options(FILE* o, char* argv0);
|
||||
static void main_usage_mlrrc(FILE* o, char* argv0);
|
||||
static void main_usage_functions(FILE* o, char* argv0, char* leader);
|
||||
static void main_usage_data_format_examples(FILE* o, char* argv0);
|
||||
static void main_usage_data_format_options(FILE* o, char* argv0);
|
||||
|
|
@ -517,6 +518,10 @@ static void main_usage_long(FILE* o, char* argv0) {
|
|||
main_usage_help_options(o, argv0);
|
||||
fprintf(o, "\n");
|
||||
|
||||
fprintf(o, "Customization via .mlrrc:\n");
|
||||
main_usage_mlrrc(o, argv0);
|
||||
fprintf(o, "\n");
|
||||
|
||||
fprintf(o, "Verbs:\n");
|
||||
list_all_verbs(o, " ");
|
||||
fprintf(o, "\n");
|
||||
|
|
@ -644,6 +649,40 @@ static void main_usage_help_options(FILE* o, char* argv0) {
|
|||
fprintf(o, " -K Show a bare listing of keywords by name.\n");
|
||||
}
|
||||
|
||||
static void main_usage_mlrrc(FILE* o, char* argv0) {
|
||||
fprintf(o, "You can set up personal defaults via a $HOME/.mlrrc and/or ./.mlrrc.\n");
|
||||
fprintf(o, "For example, if you usually process CSV, then you can put \"--csv\" in your .mlrrc file\n");
|
||||
fprintf(o, "and that will be the default input/output format unless otherwise specified on the command line.\n");
|
||||
fprintf(o, "\n");
|
||||
fprintf(o, "The .mlrrc file format is one \"--flag\" or \"--option value\" per line, with the leading \"--\" optional.\n");
|
||||
fprintf(o, "Hash-style comments and blank lines are ignored.\n");
|
||||
fprintf(o, "\n");
|
||||
fprintf(o, "Sample .mlrrc:\n");
|
||||
fprintf(o, "# Input and output formats are CSV by default (unless otherwise specified\n");
|
||||
fprintf(o, "# on the mlr command line):\n");
|
||||
fprintf(o, "csv\n");
|
||||
fprintf(o, "# These are no-ops for CSV, but when I do use JSON output, I want these\n");
|
||||
fprintf(o, "# pretty-printing options to be used:\n");
|
||||
fprintf(o, "jvstack\n");
|
||||
fprintf(o, "jlistwrap\n");
|
||||
fprintf(o, "\n");
|
||||
fprintf(o, "How to specify location of .mlrrc:\n");
|
||||
fprintf(o, "* If $MLRRC is set:\n");
|
||||
fprintf(o, " o If its value is \"__none__\" then no .mlrrc files are processed.\n");
|
||||
fprintf(o, " o Otherwise, its value (as a filename) is loaded and processed. If there are syntax\n");
|
||||
fprintf(o, " errors, they abort mlr with a usage message (as if you had mistyped something on the\n");
|
||||
fprintf(o, " command line). If the file can't be loaded at all, though, it is silently skipped.\n");
|
||||
fprintf(o, " o Any .mlrrc in your home directory or current directory is ignored whenever $MLRRC is\n");
|
||||
fprintf(o, " set in the environment.\n");
|
||||
fprintf(o, "* Otherwise:\n");
|
||||
fprintf(o, " o If $HOME/.mlrrc exists, it's then processed as above.\n");
|
||||
fprintf(o, " o If ./.mlrrc exists, it's then also processed as above.\n");
|
||||
fprintf(o, " (I.e. current-directory .mlrrc defaults are stacked over home-directory .mlrrc defaults.)\n");
|
||||
fprintf(o, "\n");
|
||||
fprintf(o, "See also:\n");
|
||||
fprintf(o, "https://johnkerl.org/miller/doc/customization.html\n");
|
||||
}
|
||||
|
||||
static void main_usage_functions(FILE* o, char* argv0, char* leader) {
|
||||
fmgr_t* pfmgr = fmgr_alloc();
|
||||
fmgr_list_functions(pfmgr, o, leader);
|
||||
|
|
@ -1532,6 +1571,9 @@ static int handle_terminal_usage(char** argv, int argc, int argi) {
|
|||
} else if (streq(argv[argi], "--usage-help-options")) {
|
||||
main_usage_help_options(stdout, MLR_GLOBALS.bargv0);
|
||||
return TRUE;
|
||||
} else if (streq(argv[argi], "--usage-mlrrc")) {
|
||||
main_usage_mlrrc(stdout, MLR_GLOBALS.bargv0);
|
||||
return TRUE;
|
||||
} else if (streq(argv[argi], "--usage-functions")) {
|
||||
main_usage_functions(stdout, MLR_GLOBALS.bargv0, "");
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -470,6 +470,39 @@ OPTIONS
|
|||
netbsd-strptime
|
||||
For more information, please invoke mlr {subcommand} --help
|
||||
|
||||
MLRRC
|
||||
You can set up personal defaults via a $HOME/.mlrrc and/or ./.mlrrc.
|
||||
For example, if you usually process CSV, then you can put "--csv" in your .mlrrc file
|
||||
and that will be the default input/output format unless otherwise specified on the command line.
|
||||
|
||||
The .mlrrc file format is one "--flag" or "--option value" per line, with the leading "--" optional.
|
||||
Hash-style comments and blank lines are ignored.
|
||||
|
||||
Sample .mlrrc:
|
||||
# Input and output formats are CSV by default (unless otherwise specified
|
||||
# on the mlr command line):
|
||||
csv
|
||||
# These are no-ops for CSV, but when I do use JSON output, I want these
|
||||
# pretty-printing options to be used:
|
||||
jvstack
|
||||
jlistwrap
|
||||
|
||||
How to specify location of .mlrrc:
|
||||
* If $MLRRC is set:
|
||||
o If its value is "__none__" then no .mlrrc files are processed.
|
||||
o Otherwise, its value (as a filename) is loaded and processed. If there are syntax
|
||||
errors, they abort mlr with a usage message (as if you had mistyped something on the
|
||||
command line). If the file can't be loaded at all, though, it is silently skipped.
|
||||
o Any .mlrrc in your home directory or current directory is ignored whenever $MLRRC is
|
||||
set in the environment.
|
||||
* Otherwise:
|
||||
o If $HOME/.mlrrc exists, it's then processed as above.
|
||||
o If ./.mlrrc exists, it's then also processed as above.
|
||||
(I.e. current-directory .mlrrc defaults are stacked over home-directory .mlrrc defaults.)
|
||||
|
||||
See also:
|
||||
https://johnkerl.org/miller/doc/customization.html
|
||||
|
||||
VERBS
|
||||
altkv
|
||||
Usage: mlr altkv [no options]
|
||||
|
|
|
|||
|
|
@ -396,6 +396,39 @@ OPTIONS
|
|||
netbsd-strptime
|
||||
For more information, please invoke mlr {subcommand} --help
|
||||
|
||||
MLRRC
|
||||
You can set up personal defaults via a $HOME/.mlrrc and/or ./.mlrrc.
|
||||
For example, if you usually process CSV, then you can put "--csv" in your .mlrrc file
|
||||
and that will be the default input/output format unless otherwise specified on the command line.
|
||||
|
||||
The .mlrrc file format is one "--flag" or "--option value" per line, with the leading "--" optional.
|
||||
Hash-style comments and blank lines are ignored.
|
||||
|
||||
Sample .mlrrc:
|
||||
# Input and output formats are CSV by default (unless otherwise specified
|
||||
# on the mlr command line):
|
||||
csv
|
||||
# These are no-ops for CSV, but when I do use JSON output, I want these
|
||||
# pretty-printing options to be used:
|
||||
jvstack
|
||||
jlistwrap
|
||||
|
||||
How to specify location of .mlrrc:
|
||||
* If $MLRRC is set:
|
||||
o If its value is "__none__" then no .mlrrc files are processed.
|
||||
o Otherwise, its value (as a filename) is loaded and processed. If there are syntax
|
||||
errors, they abort mlr with a usage message (as if you had mistyped something on the
|
||||
command line). If the file can't be loaded at all, though, it is silently skipped.
|
||||
o Any .mlrrc in your home directory or current directory is ignored whenever $MLRRC is
|
||||
set in the environment.
|
||||
* Otherwise:
|
||||
o If $HOME/.mlrrc exists, it's then processed as above.
|
||||
o If ./.mlrrc exists, it's then also processed as above.
|
||||
(I.e. current-directory .mlrrc defaults are stacked over home-directory .mlrrc defaults.)
|
||||
|
||||
See also:
|
||||
https://johnkerl.org/miller/doc/customization.html
|
||||
|
||||
VERBS
|
||||
altkv
|
||||
Usage: mlr altkv [no options]
|
||||
|
|
|
|||
|
|
@ -95,6 +95,10 @@ output separator to the given value."""
|
|||
print make_subsection('AUXILIARY COMMANDS', [])
|
||||
print make_code_block(`mlr --usage-auxents`)
|
||||
|
||||
print make_section('MLRRC', [])
|
||||
|
||||
print make_code_block(`mlr --usage-mlrrc`)
|
||||
|
||||
verbs = `mlr --list-all-verbs-raw`
|
||||
print make_section('VERBS', [
|
||||
""
|
||||
|
|
|
|||
39
doc/mlr.1
39
doc/mlr.1
|
|
@ -513,6 +513,45 @@ For more information, please invoke mlr {subcommand} --help
|
|||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SH "MLRRC"
|
||||
.if n \{\
|
||||
.RS 0
|
||||
.\}
|
||||
.nf
|
||||
You can set up personal defaults via a $HOME/.mlrrc and/or ./.mlrrc.
|
||||
For example, if you usually process CSV, then you can put "--csv" in your .mlrrc file
|
||||
and that will be the default input/output format unless otherwise specified on the command line.
|
||||
|
||||
The .mlrrc file format is one "--flag" or "--option value" per line, with the leading "--" optional.
|
||||
Hash-style comments and blank lines are ignored.
|
||||
|
||||
Sample .mlrrc:
|
||||
# Input and output formats are CSV by default (unless otherwise specified
|
||||
# on the mlr command line):
|
||||
csv
|
||||
# These are no-ops for CSV, but when I do use JSON output, I want these
|
||||
# pretty-printing options to be used:
|
||||
jvstack
|
||||
jlistwrap
|
||||
|
||||
How to specify location of .mlrrc:
|
||||
* If $MLRRC is set:
|
||||
o If its value is "__none__" then no .mlrrc files are processed.
|
||||
o Otherwise, its value (as a filename) is loaded and processed. If there are syntax
|
||||
errors, they abort mlr with a usage message (as if you had mistyped something on the
|
||||
command line). If the file can't be loaded at all, though, it is silently skipped.
|
||||
o Any .mlrrc in your home directory or current directory is ignored whenever $MLRRC is
|
||||
set in the environment.
|
||||
* Otherwise:
|
||||
o If $HOME/.mlrrc exists, it's then processed as above.
|
||||
o If ./.mlrrc exists, it's then also processed as above.
|
||||
(I.e. current-directory .mlrrc defaults are stacked over home-directory .mlrrc defaults.)
|
||||
|
||||
See also:
|
||||
https://johnkerl.org/miller/doc/customization.html
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.SH "VERBS"
|
||||
.sp
|
||||
|
||||
|
|
|
|||
|
|
@ -1323,6 +1323,39 @@ Help options:
|
|||
-k or --help-all-keywords Show help on all keywords.
|
||||
-K Show a bare listing of keywords by name.
|
||||
|
||||
Customization via .mlrrc:
|
||||
You can set up personal defaults via a $HOME/.mlrrc and/or ./.mlrrc.
|
||||
For example, if you usually process CSV, then you can put "--csv" in your .mlrrc file
|
||||
and that will be the default input/output format unless otherwise specified on the command line.
|
||||
|
||||
The .mlrrc file format is one "--flag" or "--option value" per line, with the leading "--" optional.
|
||||
Hash-style comments and blank lines are ignored.
|
||||
|
||||
Sample .mlrrc:
|
||||
# Input and output formats are CSV by default (unless otherwise specified
|
||||
# on the mlr command line):
|
||||
csv
|
||||
# These are no-ops for CSV, but when I do use JSON output, I want these
|
||||
# pretty-printing options to be used:
|
||||
jvstack
|
||||
jlistwrap
|
||||
|
||||
How to specify location of .mlrrc:
|
||||
* If $MLRRC is set:
|
||||
o If its value is "__none__" then no .mlrrc files are processed.
|
||||
o Otherwise, its value (as a filename) is loaded and processed. If there are syntax
|
||||
errors, they abort mlr with a usage message (as if you had mistyped something on the
|
||||
command line). If the file can't be loaded at all, though, it is silently skipped.
|
||||
o Any .mlrrc in your home directory or current directory is ignored whenever $MLRRC is
|
||||
set in the environment.
|
||||
* Otherwise:
|
||||
o If $HOME/.mlrrc exists, it's then processed as above.
|
||||
o If ./.mlrrc exists, it's then also processed as above.
|
||||
(I.e. current-directory .mlrrc defaults are stacked over home-directory .mlrrc defaults.)
|
||||
|
||||
See also:
|
||||
https://johnkerl.org/miller/doc/customization.html
|
||||
|
||||
Verbs:
|
||||
altkv bar bootstrap cat check clean-whitespace count count-distinct
|
||||
count-similar cut decimate fill-down filter format-values fraction grep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue