mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-19 01:15:21 +00:00
mlr iterate feature
This commit is contained in:
parent
23a6db59e4
commit
37c2d4bbd9
4 changed files with 19 additions and 5 deletions
|
|
@ -6,6 +6,7 @@
|
|||
typedef enum _ap_flag_t {
|
||||
AP_INT_VALUE_FLAG,
|
||||
AP_INT_FLAG,
|
||||
AP_LONG_LONG_FLAG,
|
||||
AP_DOUBLE_FLAG,
|
||||
AP_STRING_FLAG,
|
||||
AP_STRING_LIST_FLAG,
|
||||
|
|
@ -86,6 +87,9 @@ void ap_define_int_value_flag(ap_state_t* pstate, char* flag_name, int intval, i
|
|||
void ap_define_int_flag(ap_state_t* pstate, char* flag_name, int* pintval) {
|
||||
sllv_append(pstate->pflag_defs, ap_flag_def_alloc(flag_name, AP_INT_FLAG, 0, pintval, 2));
|
||||
}
|
||||
void ap_define_long_long_flag(ap_state_t* pstate, char* flag_name, long long* pintval) {
|
||||
sllv_append(pstate->pflag_defs, ap_flag_def_alloc(flag_name, AP_LONG_LONG_FLAG, 0, pintval, 2));
|
||||
}
|
||||
|
||||
void ap_define_float_flag(ap_state_t* pstate, char* flag_name, double* pdoubleval) {
|
||||
sllv_append(pstate->pflag_defs, ap_flag_def_alloc(flag_name, AP_DOUBLE_FLAG, 0, pdoubleval, 2));
|
||||
|
|
@ -148,6 +152,13 @@ int ap_parse_aux(ap_state_t* pstate, char* verb, int* pargi, int argc, char** ar
|
|||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
} else if (pdef->type == AP_LONG_LONG_FLAG) {
|
||||
if (sscanf(argv[argi+1], "%lld", (long long *)pdef->pval) != 1) {
|
||||
fprintf(stderr, "%s %s: couldn't parse \"%s\" after \"%s\" as integer.\n",
|
||||
argv[0], verb, argv[argi+1], argv[argi]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
} else if (pdef->type == AP_DOUBLE_FLAG) {
|
||||
if (!mlr_try_float_from_string(argv[argi+1], (double *)pdef->pval)) {
|
||||
fprintf(stderr, "%s %s: couldn't parse \"%s\" after \"%s\" as double.\n",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ void ap_define_true_flag(ap_state_t* pstate, char* flag_name, int* pintv
|
|||
void ap_define_false_flag(ap_state_t* pstate, char* flag_name, int* pintval);
|
||||
void ap_define_int_value_flag(ap_state_t* pstate, char* flag_name, int value, int* pintval);
|
||||
void ap_define_int_flag(ap_state_t* pstate, char* flag_name, int* pintval);
|
||||
void ap_define_long_long_flag(ap_state_t* pstate, char* flag_name, long long* pintval);
|
||||
void ap_define_float_flag(ap_state_t* pstate, char* flag_name, double* pdoubleval);
|
||||
void ap_define_string_flag(ap_state_t* pstate, char* flag_name, char** pstring);
|
||||
void ap_define_string_list_flag(ap_state_t* pstate, char* flag_name, slls_t** pplist);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ BUGFIXES
|
|||
================================================================
|
||||
TOP-OF-LIST SUMMARY
|
||||
|
||||
! feature: record-repeater w/ key field(s). UT & mld.
|
||||
! feature: stats1 weighted by count (or other) field?
|
||||
|
||||
? make a 3.5.0 with nest, shuffle, put/filter -f, cat -n bugfix, etc.? after valgrinds ...
|
||||
* rh/fedora/centos mlr-3.4.0
|
||||
|
||||
|
|
@ -37,9 +40,6 @@ TOP-OF-LIST SUMMARY
|
|||
* dsls deps still not quite right?
|
||||
* faqent re nidx output: '$9 = ...' doesn't make it the 9th output field.
|
||||
|
||||
! feature: stats1 weighted by count (or other) field?
|
||||
! feature: record-repeater w/ key field(s)?
|
||||
|
||||
================================================================
|
||||
* relcut material since 3.4.0:
|
||||
BIG:
|
||||
|
|
|
|||
|
|
@ -854,8 +854,10 @@ mlr reorder -e -f a,b sends input record "d=4,b=2,a=1,c=3" to "d=4,c=3,a=1,b=2".
|
|||
.\}
|
||||
.nf
|
||||
Usage: mlr repeat [options]
|
||||
-f {field name} xxx put my description here please
|
||||
xxx describe me please.
|
||||
Copies input records to output records multiple times.
|
||||
-n {repeat count} Repeat each input record this many times.
|
||||
-f {field name} Same, but take the repeat count from the specified field name
|
||||
of each input record.
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue