tabview as alternative
This commit is contained in:
@@ -8,6 +8,8 @@ echo 'Sqlite3NCSV: view sqlite3 DB with ncsv.
|
|||||||
TABLE: If not given, first in schema used.
|
TABLE: If not given, first in schema used.
|
||||||
QUERY: If the second argument contains spaces, it is assumed to be a query.
|
QUERY: If the second argument contains spaces, it is assumed to be a query.
|
||||||
-l: List table names
|
-l: List table names
|
||||||
|
|
||||||
|
note: will try for tabview if ncsv not installed
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
[[ "$1" == "-h" ]] && {
|
[[ "$1" == "-h" ]] && {
|
||||||
@@ -33,6 +35,11 @@ sqlfile="$1"
|
|||||||
} || {
|
} || {
|
||||||
query="$table"
|
query="$table"
|
||||||
}
|
}
|
||||||
|
VIEWER=ncsv
|
||||||
|
which ncsv > /dev/null || {
|
||||||
|
VIEWER="tabview -"
|
||||||
|
which tabview > /dev/null || VIEWER="cat -"
|
||||||
|
}
|
||||||
|
|
||||||
sqlite3 -header -separator ' ' -nullvalue NA "$sqlfile" "$query" | ncsv
|
sqlite3 -header -separator ' ' -nullvalue NA "$sqlfile" "$query" | $VIEWER
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user