From 4befcff604bcf05bfd1df6a21c4024d55d9fc29f Mon Sep 17 00:00:00 2001 From: John Kerl Date: Sun, 24 Feb 2019 13:52:41 -0500 Subject: [PATCH] -N as keystroke-saver for --implicit-csv-header --headerless-csv-output --- c/cli/mlrcli.c | 5 +++++ c/reg_test/expected/out | 16 ++++++++++++++++ c/reg_test/run | 3 +++ configure | 20 ++++++++++---------- doc/manpage.html | 3 ++- doc/manpage.txt | 3 ++- doc/mlr.1 | 5 +++-- doc/reference.html | 1 + 8 files changed, 42 insertions(+), 14 deletions(-) diff --git a/c/cli/mlrcli.c b/c/cli/mlrcli.c index 4ae1e05dc..20f82601d 100644 --- a/c/cli/mlrcli.c +++ b/c/cli/mlrcli.c @@ -937,6 +937,7 @@ static void main_usage_csv_options(FILE* o, char* argv0) { fprintf(o, " of input files. Tip: combine with \"label\" to recreate\n"); fprintf(o, " missing headers.\n"); fprintf(o, " --headerless-csv-output Print only CSV data lines.\n"); + fprintf(o, " -N Keystroke-saver for --implicit-csv-header --headerless-csv-output.\n"); } static void main_usage_double_quoting(FILE* o, char* argv0) { @@ -2099,6 +2100,10 @@ int cli_handle_reader_writer_options(char** argv, int argc, int *pargi, pwriter_opts->ofile_fmt = "markdown"; argi += 1; + } else if (streq(argv[argi], "-N")) { + preader_opts->use_implicit_csv_header = TRUE; + pwriter_opts->headerless_csv_output = TRUE; + argi += 1; } *pargi = argi; return argi != oargi; diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index e3ba3a4c2..80359ed52 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -44935,6 +44935,22 @@ zee 2 0.923068348748175560 0.009737410587136359 zee 3 0.000047786161325772 0.803142013402256216 zee 4 0.676537984365847889 0.573903236805416328 +mlr --csv -N reorder -f 1,3,2,5,4 ./reg_test/input/multi-sep.csv-crlf +a/,i/,b/,y/,x/ +wye/,0/,eks/,0.262688053894177098,0.641593543645736508/ +eks/,1/,zee/,0.715431942006308552,0.827614412562742041/ +zee/,2/,zee/,0.009737410587136359,0.923068348748175560/ +zee/,3/,pan/,0.803142013402256216,0.000047786161325772/ +zee/,4/,hat/,0.573903236805416328,0.676537984365847889/ + +mlr --csv -N reorder -f 5,4,3,2,1 ./reg_test/input/multi-sep.csv-crlf +y/,x/,i/,b/,a/ +0.262688053894177098,0.641593543645736508/,0/,eks/,wye/ +0.715431942006308552,0.827614412562742041/,1/,zee/,eks/ +0.009737410587136359,0.923068348748175560/,2/,zee/,zee/ +0.803142013402256216,0.000047786161325772/,3/,pan/,zee/ +0.573903236805416328,0.676537984365847889/,4/,hat/,zee/ + ================================================================ HET-CSV INPUT diff --git a/c/reg_test/run b/c/reg_test/run index eed19a865..8d735debf 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -5164,6 +5164,9 @@ run_mlr --implicit-csv-header --icsv --ifs , --opprint cut -x -f 2 $indir/mult run_mlr --icsv --ifs /, --opprint cut -x -f b $indir/multi-sep.csv-crlf run_mlr --implicit-csv-header --icsv --ifs /, --opprint cut -x -f 2 $indir/multi-sep.csv-crlf +run_mlr --csv -N reorder -f 1,3,2,5,4 $indir/multi-sep.csv-crlf +run_mlr --csv -N reorder -f 5,4,3,2,1 $indir/multi-sep.csv-crlf + # ---------------------------------------------------------------- announce HET-CSV INPUT diff --git a/configure b/configure index 2bfde5478..70e373b80 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for mlr 5.3.0. +# Generated by GNU Autoconf 2.69 for mlr 5.4.0-dev. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mlr' PACKAGE_TARNAME='mlr' -PACKAGE_VERSION='5.3.0' -PACKAGE_STRING='mlr 5.3.0' +PACKAGE_VERSION='5.4.0-dev' +PACKAGE_STRING='mlr 5.4.0-dev' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1310,7 +1310,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mlr 5.3.0 to adapt to many kinds of systems. +\`configure' configures mlr 5.4.0-dev to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1380,7 +1380,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mlr 5.3.0:";; + short | recursive ) echo "Configuration of mlr 5.4.0-dev:";; esac cat <<\_ACEOF @@ -1485,7 +1485,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mlr configure 5.3.0 +mlr configure 5.4.0-dev generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1763,7 +1763,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mlr $as_me 5.3.0, which was +It was created by mlr $as_me 5.4.0-dev, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2630,7 +2630,7 @@ fi # Define the identity of the package. PACKAGE='mlr' - VERSION='5.3.0' + VERSION='5.4.0-dev' cat >>confdefs.h <<_ACEOF @@ -12111,7 +12111,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mlr $as_me 5.3.0, which was +This file was extended by mlr $as_me 5.4.0-dev, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12181,7 +12181,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -mlr config.status 5.3.0 +mlr config.status 5.4.0-dev configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/doc/manpage.html b/doc/manpage.html index 524caab91..8964ae57a 100644 --- a/doc/manpage.html +++ b/doc/manpage.html @@ -527,6 +527,7 @@ OPTIONS of input files. Tip: combine with "label" to recreate missing headers. --headerless-csv-output Print only CSV data lines. + -N Keystroke-saver for --implicit-csv-header --headerless-csv-output. DOUBLE-QUOTING FOR CSV/CSVLITE OUTPUT --quote-all Wrap all fields in double quotes @@ -2440,7 +2441,7 @@ SEE ALSO - 2019-02-03 MILLER(1) + 2019-02-24 MILLER(1)

diff --git a/doc/manpage.txt b/doc/manpage.txt index 38a6d2aee..249095104 100644 --- a/doc/manpage.txt +++ b/doc/manpage.txt @@ -333,6 +333,7 @@ OPTIONS of input files. Tip: combine with "label" to recreate missing headers. --headerless-csv-output Print only CSV data lines. + -N Keystroke-saver for --implicit-csv-header --headerless-csv-output. DOUBLE-QUOTING FOR CSV/CSVLITE OUTPUT --quote-all Wrap all fields in double quotes @@ -2246,4 +2247,4 @@ SEE ALSO - 2019-02-03 MILLER(1) + 2019-02-24 MILLER(1) diff --git a/doc/mlr.1 b/doc/mlr.1 index 073a55b85..739e41ee1 100644 --- a/doc/mlr.1 +++ b/doc/mlr.1 @@ -2,12 +2,12 @@ .\" Title: mlr .\" Author: [see the "AUTHOR" section] .\" Generator: ./mkman.rb -.\" Date: 2019-02-03 +.\" Date: 2019-02-24 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MILLER" "1" "2019-02-03" "\ \&" "\ \&" +.TH "MILLER" "1" "2019-02-24" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Portability definitions .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -418,6 +418,7 @@ output only. of input files. Tip: combine with "label" to recreate missing headers. --headerless-csv-output Print only CSV data lines. + -N Keystroke-saver for --implicit-csv-header --headerless-csv-output. .fi .if n \{\ .RE diff --git a/doc/reference.html b/doc/reference.html index 421eca966..4368e0e62 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -1658,6 +1658,7 @@ Relevant to CSV/CSV-lite input only: of input files. Tip: combine with "label" to recreate missing headers. --headerless-csv-output Print only CSV data lines. + -N Keystroke-saver for --implicit-csv-header --headerless-csv-output. Double-quoting for CSV output: --quote-all Wrap all fields in double quotes