Skip to content

Commit

Permalink
feat: Added sql2csv command line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Jan 5, 2023
1 parent 018bfe7 commit 621fa3b
Show file tree
Hide file tree
Showing 19 changed files with 646 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ bin/*
*.snap

# Project ignores
_codemeta.json
*.json
testout
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ maintainers:
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/datatools"
version: 1.1.5
version: 1.2.0
license-url: "https://data.caltech.edu/license"
keywords: [ "csv", "json", "xlsx", "golang", "bash" ]
date-released: 2022-06-30
keywords: [ "csv", "excel", "sql", "json", "xlsx", "golang", "bash" ]
date-released: 2022-01-05
34 changes: 25 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#
PROJECT = datatools

PROGRAMS = $(shell ls -1 cmd/)
PROGRAMS = codemeta2cff csv2json csv2mdtable csv2tab csv2xlsx csvcleaner csvcols csvfind csvjoin csvrows finddir findfile json2toml json2yaml jsoncols jsonjoin jsonmunge jsonrange mergepath range reldate reltime sql2csv string tab2csv timefmt toml2json urlparse xlsx2csv xlsx2json yaml2json

MAN_PAGES = codemeta2cff.1 sql2csv.1

PACKAGE = $(shell ls -1 *.go)

Expand Down Expand Up @@ -54,6 +56,12 @@ test: $(PACKAGE)
# cd timefmt && go test
cd codemeta && go test
bash test_cmd.bash

$(MAN_PAGES): .FORCE
mkdir -p man/man1
pandoc $@.md --from markdown --to man -s >man/man1/$@

man: $(MAN_PAGES)

website:
bash gen-nav.bash
Expand All @@ -79,58 +87,65 @@ clean:
@if [ -f version.go ]; then rm version.go; fi
@if [ -d bin ]; then rm -fR bin; fi
@if [ -d dist ]; then rm -fR dist; fi
@if [ -d man ]; then rm -fR man; fi
#@if [ -d man ]; then rm -fR man; fi

# NOTE: macOS causes problems if you copy a binary versus move it.
install: build
@echo "Installing programs in $(PREFIX)/bin"
@for FNAME in $(PROGRAMS); do if [ -f ./bin/$$FNAME ]; then mv -v ./bin/$$FNAME $(PREFIX)/bin/$$FNAME; fi; done
@echo ""
@echo "Make sure $(PREFIX)/bin is in your PATH"
@echo "Installing man pages in $(PREFIX)/man/man1"
@mkdir -p $(PREFIX)/man/man1
@for FNAME in $(MAN_PAGES); do cp -v man/man1/$$FNAME $(PREFIX)/man/man1/; done
@echo "Make sure $(PREFIX)/man is in your MANPATH"

uninstall: .FORCE
@echo "Removing programs in $(PREFIX)/bin"
@for FNAME in $(PROGRAMS); do if [ -f $(PREFIX)/bin/$$FNAME ]; then rm -v $(PREFIX)/bin/$$FNAME; fi; done
@echo "Removing man pages in $(PREFIX)/man"
@for FNAME in $(MAN_PAGES); do if [ -f $(PREFIX)/man/man1/$$FNAME ]; then rm -v $(PREFIX)/man/man1/$$FNAME; fi; done



dist/linux-amd64: $(PROGRAMS)
@mkdir -p dist/bin
@for FNAME in $(PROGRAMS); do env GOOS=linux GOARCH=amd64 go build -o dist/bin/$$FNAME cmd/$$FNAME/*.go; done
@cd dist && zip -r $(PROJECT)-v$(VERSION)-linux-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* demos/*
@cd dist && zip -r $(PROJECT)-v$(VERSION)-linux-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* man/*
@rm -fR dist/bin


dist/macos-amd64: $(PROGRAMS)
@mkdir -p dist/bin
@for FNAME in $(PROGRAMS); do env GOOS=darwin GOARCH=amd64 go build -o dist/bin/$$FNAME cmd/$$FNAME/*.go; done
@cd dist && zip -r $(PROJECT)-v$(VERSION)-macos-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* demos/*
@cd dist && zip -r $(PROJECT)-v$(VERSION)-macos-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* man/*
@rm -fR dist/bin


dist/macos-arm64: $(PROGRAMS)
@mkdir -p dist/bin
@for FNAME in $(PROGRAMS); do env GOOS=darwin GOARCH=arm64 go build -o dist/bin/$$FNAME cmd/$$FNAME/*.go; done
@cd dist && zip -r $(PROJECT)-v$(VERSION)-macos-arm64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* demos/*
@cd dist && zip -r $(PROJECT)-v$(VERSION)-macos-arm64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* man/*
@rm -fR dist/bin


dist/windows-amd64: $(PROGRAMS)
@mkdir -p dist/bin
@for FNAME in $(PROGRAMS); do env GOOS=windows GOARCH=amd64 go build -o dist/bin/$$FNAME.exe cmd/$$FNAME/*.go; done
@cd dist && zip -r $(PROJECT)-v$(VERSION)-windows-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* demos/*
@cd dist && zip -r $(PROJECT)-v$(VERSION)-windows-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* man/*
@rm -fR dist/bin

dist/windows-arm64: $(PROGRAMS)
@mkdir -p dist/bin
@for FNAME in $(PROGRAMS); do env GOOS=windows GOARCH=arm64 go build -o dist/bin/$$FNAME.exe cmd/$$FNAME/*.go; done
@cd dist && zip -r $(PROJECT)-v$(VERSION)-windows-arm64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* demos/*
@cd dist && zip -r $(PROJECT)-v$(VERSION)-windows-arm64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* man/*
@rm -fR dist/bin


dist/raspbian-arm7: $(PROGRAMS)
@mkdir -p dist/bin
@for FNAME in $(PROGRAMS); do env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/$$FNAME cmd/$$FNAME/*.go; done
@cd dist && zip -r $(PROJECT)-v$(VERSION)-raspberry_pi_os-arm7.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* demos/*
@cd dist && zip -r $(PROJECT)-v$(VERSION)-raspberry_pi_os-arm7.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/* how-to/* man/*
@rm -fR dist/bin

#dist/datatools_$(VERSION)_amd64.snap:
Expand All @@ -148,6 +163,7 @@ distribute_docs:
@cp -v INSTALL.md dist/
@cp -vR docs dist/
@cp -vR how-to dist/
@cp -vR man dist/

gen_batfiles: .FORCE
@echo '@echo off' >make.bat
Expand All @@ -172,7 +188,7 @@ gen_batfiles: .FORCE

snap: dist/datatools_$(VERSION)_amd64.snap

release: clean build gen_batfiles distribute_docs dist/linux-amd64 dist/macos-amd64 dist/macos-arm64 dist/windows-amd64 dist/windows-arm64 dist/raspbian-arm7
release: clean build man gen_batfiles distribute_docs dist/linux-amd64 dist/macos-amd64 dist/macos-arm64 dist/windows-amd64 dist/windows-arm64 dist/raspbian-arm7


.FORCE:
13 changes: 13 additions & 0 deletions TODO.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ <h2 id="next">
</h2>
<ul class="task-list">
<li>
<input type="checkbox" disabled="" />ioutil is depreciated, need to
update the code that uses it.
</li>
<li>
<input type="checkbox" disabled="" />Update how docs are generated, see
about dropped cli package, there are better simpler ways to move forward
</li>
<li>
<input type="checkbox" disabled="" />Review <a
href="https://go-app.dev">Go-app.dev</a> and see if I can make a useful
format converted GUI based on the code for all the cli in the project.
</li>
<li>
<input type="checkbox" disabled="" />Create man pages for all cli, adopt
man page structure for usage.
</li>
Expand Down
18 changes: 13 additions & 5 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<h1 id="about-this-software">
About this software
</h1>
<h2 id="datatools-1.1.4">
datatools 1.1.4
<h2 id="datatools-1.2.0">
datatools 1.2.0
</h2>
<h3 id="authors">
Authors
Expand All @@ -54,6 +54,14 @@ <h3 id="authors">
R. S. Doiel
</li>
</ul>
<h3 id="maintainers">
Maintainers
</h3>
<ul>
<li>
R. S. Doiel
</li>
</ul>
<p>
A set of command line tools for working with CSV, Excel Workbooks, JSON
and structured text documents.
Expand All @@ -74,7 +82,7 @@ <h3 id="programming-languages">
</h3>
<ul>
<li>
Go 1.19.2
Go 1.19.4
</li>
</ul>
<h3 id="operating-systems">
Expand All @@ -96,10 +104,10 @@ <h3 id="software-requiremets">
</h3>
<ul>
<li>
Golang 1.19.2 or better
Golang 1.19 or better
</li>
<li>
Pandoc 2.19.2 or better
Pandoc 2.19 or better
</li>
</ul>
</section>
Expand Down
8 changes: 4 additions & 4 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ authors:
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/datatools"
version: 1.1.5
version: 1.2.0
license-url: "https://data.caltech.edu/license"
keywords: [ "csv", "json", "xlsx", "golang", "bash" ]
date-released: 2022-06-30
keywords: [ "csv", "excel", "sql", "json", "xlsx", "golang", "bash" ]
date-released: 2022-01-05
---

About this software
===================

## datatools 1.1.5
## datatools 1.2.0

### Authors

Expand Down
Loading

0 comments on commit 621fa3b

Please sign in to comment.