From dd4a72cd58ecf7edfe3e4d32b79bae04d42312f4 Mon Sep 17 00:00:00 2001 From: liquidaty Date: Tue, 12 Nov 2024 19:51:46 -0800 Subject: [PATCH] change --overwrite-auto to --apply-overwrites (#284) --- app/overwrite.c | 4 ++++ app/test/Makefile | 2 +- app/test/overwrite/Makefile | 4 ++-- app/utils/arg.c | 4 ++-- include/zsv/utils/overwrite.h | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/overwrite.c b/app/overwrite.c index cac2e943..c2bfd303 100644 --- a/app/overwrite.c +++ b/app/overwrite.c @@ -360,6 +360,10 @@ int ZSV_MAIN_FUNC(ZSV_COMMAND)(int argc, const char *argv[], struct zsv_opts *op return err; } + (void)(opts); + (void)(custom_prop_handler); + (void)(opts_used); + struct zsv_overwrite_ctx ctx = {0}; struct zsv_overwrite_args args = {0}; // By default, save timestamps diff --git a/app/test/Makefile b/app/test/Makefile index 94348d06..8aa7d31f 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -180,7 +180,7 @@ test-echo-overwrite-auto: ${BUILD_DIR}/bin/zsv_echo${EXE} @sqlite3 ${TEST_DATA_DIR}/.zsv/data/loans_2.csv/overwrite.sqlite3 < ${TEST_DATA_DIR}/loans_2_overwrite.sql @${PREFIX} $< ${TEST_DATA_DIR}/loans_2.csv ${REDIRECT} ${TMP_DIR}/$@-after-ignored.out @${CMP} ${TMP_DIR}/$@-after-ignored.out expected/$@-after-ignored.out && ${TEST_PASS} || ${TEST_FAIL} - @${PREFIX} $< ${TEST_DATA_DIR}/loans_2.csv --overwrite-auto ${REDIRECT} ${TMP_DIR}/$@-after-applied.out + @${PREFIX} $< ${TEST_DATA_DIR}/loans_2.csv --apply-overwrites ${REDIRECT} ${TMP_DIR}/$@-after-applied.out @${CMP} ${TMP_DIR}/$@-after-applied.out expected/$@-after-applied.out && ${TEST_PASS} || ${TEST_FAIL} test-echo-overwrite-csv: ${BUILD_DIR}/bin/zsv_echo${EXE} ${TEST_DATA_DIR}/loans_1-overwrite.csv diff --git a/app/test/overwrite/Makefile b/app/test/overwrite/Makefile index 0fb21708..cd16fabd 100644 --- a/app/test/overwrite/Makefile +++ b/app/test/overwrite/Makefile @@ -71,7 +71,7 @@ test-add: @${PREFIX} ${EXE} dummy2.csv add 2-4 VAL4 --no-timestamp @${CHECK} [ "`${EXE} dummy2.csv list`" = "`printf \"$(HEADER)\n1,2,VAL1,,\n2,2,VAL2,,\n2,3,VAL3,,\n2,4,VAL4,,\n\"`" ] \ && ${TEST_PASS} || ${TEST_FAIL} - @${PREFIX} ${ECHO_EXE} --overwrite-auto dummy2.csv > ${TMP_DIR}/$@.out + @${PREFIX} ${ECHO_EXE} --apply-overwrites dummy2.csv > ${TMP_DIR}/$@.out @${CMP} ${TMP_DIR}/$@.out expected/$@.out && ${TEST_PASS} || ${TEST_FAIL} STAT_MOD_TS=$(shell if stat -c %Y Makefile >/dev/null 2>/dev/null; then echo 'stat -c %Y' ; else echo 'stat -f %m' ; fi) @@ -94,7 +94,7 @@ test-echo-overwrite-auto: @${PREFIX} ${EXE} dummy.csv clear @${PREFIX} ${EXE} dummy.csv add 1-0 ABC @${PREFIX} ${EXE} dummy.csv add 2-2 123 - @${ECHO_EXE} --overwrite-auto dummy.csv > ${TMP_DIR}/$@.out + @${ECHO_EXE} --apply-overwrites dummy.csv > ${TMP_DIR}/$@.out @${CMP} ${TMP_DIR}/$@.out expected/$@.out && ${TEST_PASS} || ${TEST_FAIL} clean: diff --git a/app/utils/arg.c b/app/utils/arg.c index 37047c30..58480f40 100644 --- a/app/utils/arg.c +++ b/app/utils/arg.c @@ -124,7 +124,7 @@ void zsv_set_default_completed_callback(zsv_completed_callback cb, void *ctx) { * input (default for "desc" command is '?') -S,--keep-blank-headers : disable default behavior of ignoring leading * blank rows -0,--header-row
: insert the provided CSV as the first row (in position 0) e.g. --header-row * 'col1,col2,\"my col 3\"'", -v,--verbose - * -1,--overwrite-auto: automatically apply cached overwrites + * -1,--apply-overwrites: automatically apply cached overwrites * * @param argc count of args to process * @param argv args to process @@ -163,7 +163,7 @@ enum zsv_status zsv_args_to_opts(int argc, const char *argv[], int *argc_out, co "malformed-utf8-replacement", "header-row", #ifdef ZSV_EXTRAS - "overwrite-auto", + "apply-overwrites", "limit-rows", #endif NULL, diff --git a/include/zsv/utils/overwrite.h b/include/zsv/utils/overwrite.h index 02e6b667..4f48fa2e 100644 --- a/include/zsv/utils/overwrite.h +++ b/include/zsv/utils/overwrite.h @@ -30,7 +30,7 @@ struct zsv_overwrite_ctx { * - zsv_status_no_more_input if no overwrite file was found * - a different status code on error * - * This function is used in app/cli.c via the --overwrite-auto option + * This function is used in app/cli.c via the --apply-overwrites option */ enum zsv_status zsv_overwrite_auto(struct zsv_opts *opts, const char *csv_filename);