Fix cmd version bug on windows (#275)

This commit is contained in:
Neil O'Toole 2023-06-22 11:34:35 -06:00 committed by GitHub
parent 23df036067
commit 9ebd1c4b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 22 deletions

View File

@ -60,16 +60,16 @@ jobs:
run: |- run: |-
set pipefail set pipefail
set +e set +e
# Some images don't have curl installed # Some images don't have curl installed
if ! command -v curl &> /dev/null ; then if ! command -v curl &> /dev/null ; then
if command -v apt &> /dev/null; then if command -v apt &> /dev/null; then
apt update && apt install -y curl apt update && apt install -y curl
fi fi
fi fi
set -e set -e
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)" /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ $(sq version | awk '{print $2}') != "${{github.ref_name}}" ]; then if [ $(sq version | awk '{print $2}') != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)" echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
@ -113,10 +113,10 @@ jobs:
- name: Test install (pacman) - name: Test install (pacman)
run: |- run: |-
set -e pipefail set -e pipefail
# Run as non-root user # Run as non-root user
# sudo -u moi # sudo -u moi
# Should be installed via pacman # Should be installed via pacman
sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)" sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ $(sq version | awk '{print $2}') != "${{github.ref_name}}" ]; then if [ $(sq version | awk '{print $2}') != "${{github.ref_name}}" ]; then
@ -156,7 +156,7 @@ jobs:
- name: Test install (yay) - name: Test install (yay)
run: |- run: |-
set -e pipefail set -e pipefail
# Should be installed via yay # Should be installed via yay
sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)" sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ $(sq version | awk '{print $2}') != "${{github.ref_name}}" ]; then if [ $(sq version | awk '{print $2}') != "${{github.ref_name}}" ]; then
@ -193,10 +193,12 @@ jobs:
scoop bucket add sq https://github.com/neilotoole/sq scoop bucket add sq https://github.com/neilotoole/sq
scoop install sq scoop install sq
$gotVersion = sq version $gotVersion = sq version
echo "-------- sq version --------"
echo $gotVersion echo $gotVersion
echo "----------------------------"
if ($gotVersion -ne "sq ${{github.ref_name}}") { if ($gotVersion -ne "sq ${{github.ref_name}}") {
echo "Wanted: sq ${{github.ref_name}}" echo "Wanted: sq ${{github.ref_name}}"
echo "Actual: $gotVersion" echo "Actual: $gotVersion"

View File

@ -54,7 +54,7 @@ release:
brews: brews:
- -
homepage: "https://github.com/neilotoole/sq" homepage: "https://github.com/neilotoole/sq"
description: "sq: swiss-army knife for data" description: "sq data wrangler"
license: MIT license: MIT
tap: tap:
owner: neilotoole owner: neilotoole
@ -78,7 +78,7 @@ scoop:
owner: neilotoole owner: neilotoole
name: sq name: sq
homepage: "https://sq.io" homepage: "https://sq.io"
description: "sq: swiss-army knife for data" description: "sq data wrangler"
license: MIT license: MIT
commit_author: commit_author:
name: neilotoole name: neilotoole
@ -95,7 +95,7 @@ nfpms:
vendor: "neilotoole" vendor: "neilotoole"
maintainer: "neilotoole <neilotoole@apache.org>" maintainer: "neilotoole <neilotoole@apache.org>"
homepage: "https://sq.io" homepage: "https://sq.io"
description: "sq: swiss-army knife for data" description: "sq data wrangler"
license: "MIT" license: "MIT"
contents: contents:
- src: ./completions/sq.bash - src: ./completions/sq.bash
@ -137,7 +137,7 @@ aurs:
# Template of your app's description. # Template of your app's description.
# Default is empty. # Default is empty.
description: "sq: swiss-army knife for data" description: "sq data wrangler"
# The maintainers of the package. # The maintainers of the package.
# Defaults to empty. # Defaults to empty.
@ -231,7 +231,7 @@ aurs:
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/" mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/" mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/" mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/sq.bash" "${pkgdir}/usr/share/bash-completion/completions/sq" install -Dm644 "./completions/sq.bash" "${pkgdir}/usr/share/bash-completion/completions/sq"
install -Dm644 "./completions/sq.zsh" "${pkgdir}/usr/share/zsh/site-functions/_sq" install -Dm644 "./completions/sq.zsh" "${pkgdir}/usr/share/zsh/site-functions/_sq"
install -Dm644 "./completions/sq.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/sq.fish" install -Dm644 "./completions/sq.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/sq.fish"

View File

@ -21,7 +21,7 @@ including [JSON](https://sq.io/docs/output#json),
[HTML](https://sq.io/docs/output#html), [Markdown](https://sq.io/docs/output#markdown) [HTML](https://sq.io/docs/output#html), [Markdown](https://sq.io/docs/output#markdown)
and [XML](https://sq.io/docs/output#xml), and can [insert](https://sq.io/docs/output#insert) query and [XML](https://sq.io/docs/output#xml), and can [insert](https://sq.io/docs/output#insert) query
results directly to a SQL database. results directly to a SQL database.
`sq` can also [inspect](https://sq.io/docs/cmd/inspect) sources to view metadata about the source structure (tables, `sq` can also [inspect](https://sq.io/docs/inspect) sources to view metadata about the source structure (tables,
columns, size) and has commands for common database operations to columns, size) and has commands for common database operations to
[copy](https://sq.io/docs/cmd/tbl-copy), [truncate](https://sq.io/docs/cmd/tbl-truncate), [copy](https://sq.io/docs/cmd/tbl-copy), [truncate](https://sq.io/docs/cmd/tbl-truncate),
and [drop](https://sq.io/docs/cmd/tbl-drop) tables. and [drop](https://sq.io/docs/cmd/tbl-drop) tables.
@ -192,9 +192,12 @@ category.csv customer.csv film_actor.csv film_text.csv payment.csv sale
Note that you can also inspect an individual table: Note that you can also inspect an individual table:
```shell ```shell
$ sq inspect @sakila.actor $ sq inspect @sakila.actor -v
TABLE ROWS TYPE SIZE NUM COLS COL NAMES NAME TYPE ROWS COLS NAME TYPE PK
actor 200 table - 4 actor_id, first_name, last_name, last_update actor table 200 4 actor_id int4 pk
first_name varchar
last_name varchar
last_update timestamp
``` ```
### Diff ### Diff

View File

@ -14,7 +14,7 @@ import (
"github.com/neilotoole/sq/cli/buildinfo" "github.com/neilotoole/sq/cli/buildinfo"
"github.com/neilotoole/sq/cli/testrun" "github.com/neilotoole/sq/cli/testrun"
"github.com/ecnepsnai/osquery" "github.com/neilotoole/osquery"
"golang.org/x/mod/semver" "golang.org/x/mod/semver"

View File

@ -1,4 +1,4 @@
// Package sysinfo provides high-level details about the runtime OS. // Package hostinfo provides high-level details about the runtime OS.
package hostinfo package hostinfo
import ( import (
@ -7,7 +7,7 @@ import (
"golang.org/x/exp/slog" "golang.org/x/exp/slog"
"github.com/ecnepsnai/osquery" "github.com/neilotoole/osquery"
) )
// Info encapsulates OS info. // Info encapsulates OS info.

2
go.mod
View File

@ -32,7 +32,6 @@ require (
) )
require ( require (
github.com/ecnepsnai/osquery v1.0.0
github.com/goccy/go-yaml v1.11.0 github.com/goccy/go-yaml v1.11.0
github.com/jackc/pgx/v5 v5.4.1 github.com/jackc/pgx/v5 v5.4.1
github.com/mitchellh/go-wordwrap v1.0.1 github.com/mitchellh/go-wordwrap v1.0.1
@ -54,6 +53,7 @@ require (
github.com/jackc/puddle/v2 v2.2.0 // indirect github.com/jackc/puddle/v2 v2.2.0 // indirect
github.com/muesli/mango v0.1.0 // indirect github.com/muesli/mango v0.1.0 // indirect
github.com/muesli/mango-pflag v0.1.0 // indirect github.com/muesli/mango-pflag v0.1.0 // indirect
github.com/neilotoole/osquery v0.1.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect
golang.org/x/crypto v0.10.0 // indirect golang.org/x/crypto v0.10.0 // indirect

2
go.sum
View File

@ -104,6 +104,8 @@ github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig= github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/neilotoole/osquery v0.1.0 h1:6c69cve8Z6th6kpt7Bgy91X734Y9VsjpudaweJCDohg=
github.com/neilotoole/osquery v0.1.0/go.mod h1:cQ43YIfb3rjpCzsgKfTxomiGnVOz91dN4Sh6MuTyoVU=
github.com/neilotoole/shelleditor v0.3.2 h1:6qkZK5i2vq4DW6tEidfCVNxejtYtX53tYWK/dhyKB1M= github.com/neilotoole/shelleditor v0.3.2 h1:6qkZK5i2vq4DW6tEidfCVNxejtYtX53tYWK/dhyKB1M=
github.com/neilotoole/shelleditor v0.3.2/go.mod h1:x65ZIBL2U9aCsTuRv4iD5ArhH+n5goHtA5rZiPfdfLE= github.com/neilotoole/shelleditor v0.3.2/go.mod h1:x65ZIBL2U9aCsTuRv4iD5ArhH+n5goHtA5rZiPfdfLE=
github.com/neilotoole/slogt v1.0.0 h1:gf8//fSbbUuwj7UGakTSNv8V07BIVBbPJcTxueaEmSg= github.com/neilotoole/slogt v1.0.0 h1:gf8//fSbbUuwj7UGakTSNv8V07BIVBbPJcTxueaEmSg=