Skip to content

Commit

Permalink
Update CLI (#107)
Browse files Browse the repository at this point in the history
* update zetasqlite-cli

* add build task
  • Loading branch information
goccy committed May 7, 2023
1 parent 19f0ca9 commit a3da2d0
Show file tree
Hide file tree
Showing 6 changed files with 344 additions and 598 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ env:
CC: clang
CXX: clang++
jobs:
build:
name: build
strategy:
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
go-version: [ "1.18" ]
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: build
run: |
make build
test:
name: test
strategy:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ COVERPKG_OPT := $(subst $(SPACE),$(COMMA),$(COVER_PKGS))
$(GOBIN):
@mkdir -p $(GOBIN)

.PHONY: build
build:
cd ./cmd/zetasqlite-cli && go build .

.PHONY: cover
cover:
go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./...
Expand Down
8 changes: 8 additions & 0 deletions cmd/zetasqlite-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ Application Options:
--history= specify the history file for used queries (default: .zetasqlite_history)
--autoindex specify the auto index mode. automatically create an index when creating a table
--explain specify the explain mode. show results using sqlite3's explain query plan instead of executing the query
--no-color specify the not color mode

Help Options:
-h, --help Show this help message
```

If you specify the name of a database file after the command, it will execute the query against that file.

## Commands

- `.quit` : quit CLI
Expand All @@ -32,3 +35,8 @@ Help Options:
- `.functions` : show all functions
- `.autoindex` : automatically create an index when creating a table
- `.explain` : show results using sqlite3's explain query plan instead of executing the query

## Print Mode

Usually table view mode.
Group view is also available by adding `\G` suffix at the end of the query.
59 changes: 40 additions & 19 deletions cmd/zetasqlite-cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,65 @@ go 1.18

require (
github.com/chzyer/readline v1.5.1
github.com/fatih/color v1.15.0
github.com/goccy/go-zetasql v0.5.1
github.com/goccy/go-zetasqlite v0.4.0
github.com/jessevdk/go-flags v1.5.0
github.com/olekukonko/tablewriter v0.0.5
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
)

require (
cloud.google.com/go v0.102.1 // indirect
cloud.google.com/go/bigquery v1.42.0 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/bigquery v1.51.0 // indirect
cloud.google.com/go/compute v1.19.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.13.0 // indirect
github.com/DataDog/go-hll v1.0.2 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/apache/arrow/go/v11 v11.0.0 // indirect
github.com/apache/thrift v0.16.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dop251/goja v0.0.0-20221118162653-d4bf6fde1b86 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/goccy/go-zetasql v0.5.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.5.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
github.com/klauspost/asmfmt v1.3.2 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-sqlite3 v1.14.16 // indirect
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pkg/errors v0.8.0 // indirect
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/api v0.95.0 // indirect
google.golang.org/api v0.114.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
)

replace github.com/goccy/go-zetasqlite => ../../

0 comments on commit a3da2d0

Please sign in to comment.