Skip to content

Commit

Permalink
Add overwrite command (#247)
Browse files Browse the repository at this point in the history
* overwrite command initial commit
* TO DO:
  - fix usage msg errors in A1 notation examples
  - add list --A1 option
  - store timestamps as unix timestamps
  - add --no-timestamp option to `add`
  - update test with timestamp to not intermittently fail due to timing window
  - add tests with larger datasets
  • Loading branch information
CobbCoding1 authored Nov 5, 2024
1 parent b9fb7be commit b3f8016
Show file tree
Hide file tree
Showing 12 changed files with 512 additions and 20 deletions.
6 changes: 3 additions & 3 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ endif

ZSV=$(BINDIR)/zsv${EXE}

SOURCES=echo paste count count-pull select select-pull 2tsv 2json serialize flatten pretty stack desc sql 2db compare prop rm mv jq
CLI_SOURCES=echo select desc count paste 2tsv pretty sql flatten 2json serialize stack 2db compare prop rm mv jq
SOURCES=echo paste count count-pull select select-pull 2tsv 2json serialize flatten pretty stack desc sql 2db compare prop rm mv jq overwrite
CLI_SOURCES=echo select desc count paste 2tsv pretty sql flatten 2json serialize stack 2db compare prop rm mv jq overwrite

ifeq ($(ZSVSHEET_BUILD),1)
SOURCES+=sheet
Expand Down Expand Up @@ -290,7 +290,7 @@ help:
@echo "which will build and test all apps, or to build/test a single app:"
@echo " ${MAKE} test-xx"
@echo "where xx is any of:"
@echo " echo count count-pull paste select select-pull 2tsv 2json serialize flatten pretty stack desc sql 2db prop rm mv"
@echo " echo count count-pull paste select select-pull 2tsv 2json serialize flatten pretty stack desc sql 2db prop rm mv overwrite"
@echo ""

install: ${ZSV}
Expand Down
1 change: 1 addition & 0 deletions app/builtin/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static int main_help(int argc, const char *argv[]) {
"Commands that parse CSV or other tabular data:",
" select : extract rows/columns by name or position and perform other basic and 'cleanup' operations",
" echo : write tabular input to stdout with optional cell overwrites",
" overwrite: save, modify or apply overwrites",
" sql : run ad-hoc SQL",
" count : print the number of rows",
" desc : describe each column",
Expand Down
2 changes: 2 additions & 0 deletions app/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ZSV_MAIN_DECL(compare);
ZSV_MAIN_DECL(sheet);
#endif
ZSV_MAIN_DECL(echo);
ZSV_MAIN_DECL(overwrite);
ZSV_MAIN_NO_OPTIONS_DECL(prop);
ZSV_MAIN_NO_OPTIONS_DECL(rm);
ZSV_MAIN_NO_OPTIONS_DECL(mv);
Expand Down Expand Up @@ -128,6 +129,7 @@ struct builtin_cmd builtin_cmds[] = {
CLI_BUILTIN_COMMANDEXT(sheet),
#endif
CLI_BUILTIN_COMMAND(echo),
CLI_BUILTIN_COMMAND(overwrite),
CLI_BUILTIN_NO_OPTIONS_COMMAND(prop),
CLI_BUILTIN_NO_OPTIONS_COMMAND(rm),
CLI_BUILTIN_NO_OPTIONS_COMMAND(mv),
Expand Down
2 changes: 2 additions & 0 deletions app/ext_example/test/expected/zsvext-test-3.out
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Options common to all commands except `prop`, `rm` and `jq`:
Commands that parse CSV or other tabular data:
select : extract rows/columns by name or position and perform other basic and 'cleanup' operations
echo : write tabular input to stdout with optional cell overwrites
overwrite: save, modify or apply overwrites
sql : run ad-hoc SQL
count : print the number of rows
desc : describe each column
Expand Down Expand Up @@ -95,6 +96,7 @@ Options common to all commands except `prop`, `rm` and `jq`:
Commands that parse CSV or other tabular data:
select : extract rows/columns by name or position and perform other basic and 'cleanup' operations
echo : write tabular input to stdout with optional cell overwrites
overwrite: save, modify or apply overwrites
sql : run ad-hoc SQL
count : print the number of rows
desc : describe each column
Expand Down
Loading

0 comments on commit b3f8016

Please sign in to comment.