Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change --overwrite-auto to --apply-overwrites #284

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}/[email protected]
@${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${TEST_PASS} || ${TEST_FAIL}
@${PREFIX} $< ${TEST_DATA_DIR}/loans_2.csv --overwrite-auto ${REDIRECT} ${TMP_DIR}/[email protected]
@${PREFIX} $< ${TEST_DATA_DIR}/loans_2.csv --apply-overwrites ${REDIRECT} ${TMP_DIR}/[email protected]
@${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${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}/[email protected]
@${PREFIX} ${ECHO_EXE} --apply-overwrites dummy2.csv > ${TMP_DIR}/[email protected]
@${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${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}/[email protected]
@${ECHO_EXE} --apply-overwrites dummy.csv > ${TMP_DIR}/[email protected]
@${CMP} ${TMP_DIR}/[email protected] expected/[email protected] && ${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