mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-28 10:13:59 +00:00
neaten
This commit is contained in:
parent
8d3c067eda
commit
0aeec783d1
4 changed files with 39 additions and 24 deletions
|
|
@ -5,9 +5,10 @@
|
|||
// ================================================================
|
||||
#define AP_INT_VALUE_FLAG 0xf6
|
||||
#define AP_INT_FLAG 0xe7
|
||||
#define AP_DOUBLE_FLAG 0xd8
|
||||
#define AP_STRING_FLAG 0xc9
|
||||
#define AP_STRING_LIST_FLAG 0xba
|
||||
#define AP_CHAR_FLAG 0xd8
|
||||
#define AP_DOUBLE_FLAG 0xc9
|
||||
#define AP_STRING_FLAG 0xba
|
||||
#define AP_STRING_LIST_FLAG 0xab
|
||||
|
||||
typedef struct _ap_flag_def_t {
|
||||
char* flag_name;
|
||||
|
|
|
|||
|
|
@ -223,25 +223,6 @@ static void mapper_join_usage(char* argv0, char* verb) {
|
|||
fprintf(stdout, "-e EMPTY\n");
|
||||
}
|
||||
|
||||
// --irs x
|
||||
// --ifs x
|
||||
// --ips x
|
||||
// --idkvp
|
||||
// --inidx
|
||||
// --icsv
|
||||
// --ipprint
|
||||
// --ixtab
|
||||
// --use-mmap
|
||||
// --no-mmap
|
||||
|
||||
// char irs;
|
||||
// char ifs;
|
||||
// char ips;
|
||||
// int allow_repeat_ifs;
|
||||
// int allow_repeat_ips;
|
||||
// char* ifmt;
|
||||
// int use_mmap_for_read;
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
static mapper_t* mapper_join_parse_cli(int* pargi, int argc, char** argv) {
|
||||
mapper_join_opts_t* popts = mlr_malloc_or_die(sizeof(mapper_join_opts_t));
|
||||
|
|
@ -254,6 +235,14 @@ static mapper_t* mapper_join_parse_cli(int* pargi, int argc, char** argv) {
|
|||
popts->emit_left_unpairables = FALSE;
|
||||
popts->emit_right_unpairables = FALSE;
|
||||
|
||||
popts->irs = OPTION_UNSPECIFIED;
|
||||
popts->ifs = OPTION_UNSPECIFIED;
|
||||
popts->ips = OPTION_UNSPECIFIED;
|
||||
popts->allow_repeat_ifs = OPTION_UNSPECIFIED;
|
||||
popts->allow_repeat_ips = OPTION_UNSPECIFIED;
|
||||
popts->use_mmap_for_read = OPTION_UNSPECIFIED;
|
||||
// xxx ifmt ...
|
||||
|
||||
char* verb = argv[(*pargi)++];
|
||||
|
||||
ap_state_t* pstate = ap_alloc();
|
||||
|
|
@ -266,6 +255,31 @@ static mapper_t* mapper_join_parse_cli(int* pargi, int argc, char** argv) {
|
|||
ap_define_true_flag(pstate, "--ur", &popts->emit_right_unpairables);
|
||||
ap_define_true_flag(pstate, "-u", &popts->allow_unsorted_input);
|
||||
|
||||
// xxx to do:
|
||||
// char flags:
|
||||
// --irs x
|
||||
// --ifs x
|
||||
// --ips x
|
||||
|
||||
// xxx to impl
|
||||
// ap_define_char_flag(pstate, "--irs", &popts->irs);
|
||||
// ap_define_char_flag(pstate, "--ifs", &popts->ifs);
|
||||
// ap_define_char_flag(pstate, "--ips", &popts->ips);
|
||||
ap_define_true_flag(pstate, "--repifs", &popts->allow_repeat_ifs);
|
||||
ap_define_true_flag(pstate, "--repips", &popts->allow_repeat_ips);
|
||||
ap_define_true_flag(pstate, "--use-mmap", &popts->use_mmap_for_read);
|
||||
ap_define_false_flag(pstate, "--no-mmap", &popts->use_mmap_for_read);
|
||||
|
||||
// string flags:
|
||||
// char* ifmt;
|
||||
// --idkvp
|
||||
// --inidx
|
||||
// --icsv
|
||||
// --ipprint
|
||||
// --ixtab
|
||||
// --use-mmap
|
||||
// --no-mmap
|
||||
|
||||
if (!ap_parse(pstate, verb, pargi, argc, argv)) {
|
||||
mapper_join_usage(argv[0], verb);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
% mlr --csv cut -f hostname,uptime mydata.csv
|
||||
% mlr --csv sort hostname,uptime mydata.csv
|
||||
% mlr --csv sort -f hostname,uptime mydata.csv
|
||||
% mlr --csv put '$z = $x + 2.7*$y' mydata.csv
|
||||
% mlr --csv filter '$status != "down"' mydata.csv
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ positional indices. For example:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
% mlr --csv cut -f hostname,uptime mydata.csv
|
||||
% mlr --csv sort hostname,uptime mydata.csv
|
||||
% mlr --csv sort -f hostname,uptime mydata.csv
|
||||
% mlr --csv put '$z = $x + 2.7*$y' mydata.csv
|
||||
% mlr --csv filter '$status != "down"' mydata.csv
|
||||
</pre>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue