Skip to content

Commit

Permalink
change --overwrite-auto to --apply-overwrites (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidaty authored Nov 13, 2024
1 parent d418994 commit dd4a72c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/overwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/test/overwrite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions app/utils/arg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <header> : 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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion include/zsv/utils/overwrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit dd4a72c

Please sign in to comment.