mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 04:30:56 +01:00
add json output mode (-J) (#87)
This commit is contained in:
@@ -135,13 +135,13 @@ func Execute() {
|
||||
"Transpose the speficied columns (separated by ,)")
|
||||
rootCmd.PersistentFlags().BoolVarP(&conf.Interactive, "interactive", "I", false,
|
||||
"interactive mode")
|
||||
rootCmd.PersistentFlags().StringVarP(&conf.OFS, "ofs", "", "",
|
||||
rootCmd.PersistentFlags().StringVarP(&conf.OFS, "ofs", "o", "",
|
||||
"Output field separator (' ' for ascii table, ',' for CSV)")
|
||||
rootCmd.PersistentFlags().BoolVarP(&conf.InputJSON, "json", "j", false,
|
||||
"JSON input mode")
|
||||
rootCmd.PersistentFlags().BoolVarP(&conf.AutoHeaders, "auto-headers", "", false,
|
||||
rootCmd.PersistentFlags().BoolVarP(&conf.AutoHeaders, "auto-headers", "g", false,
|
||||
"Generate headers automatically")
|
||||
rootCmd.PersistentFlags().StringVarP(&headers, "custom-headers", "", "",
|
||||
rootCmd.PersistentFlags().StringVarP(&headers, "custom-headers", "x", "",
|
||||
"Custom headers")
|
||||
|
||||
// sort options
|
||||
@@ -171,6 +171,8 @@ func Execute() {
|
||||
"Enable shell mode output")
|
||||
rootCmd.PersistentFlags().BoolVarP(&modeflag.Y, "yaml", "Y", false,
|
||||
"Enable yaml output")
|
||||
rootCmd.PersistentFlags().BoolVarP(&modeflag.J, "jsonout", "J", false,
|
||||
"Enable json output")
|
||||
rootCmd.PersistentFlags().BoolVarP(&modeflag.C, "csv", "C", false,
|
||||
"Enable CSV output")
|
||||
rootCmd.PersistentFlags().BoolVarP(&modeflag.A, "ascii", "A", false,
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package cmd
|
||||
|
||||
const shortusage = `tablizer [regex,...] [-r file] [flags]
|
||||
-c col,... show specified columns -L highlight matching lines
|
||||
-k col,... sort by specified columns -j read JSON input
|
||||
-F col=reg filter field with regexp -v invert match
|
||||
-T col,... transpose specified columns -n numberize columns
|
||||
-R /from/to/ apply replacement to columns in -T -N do not use colors
|
||||
-y col,... yank columns to clipboard -H do not show headers
|
||||
--ofs char output field separator -s specify field separator
|
||||
-r file read input from file -z use fuzzy search
|
||||
-f file read config from file -I interactive filter mode
|
||||
-d debug
|
||||
-O org -C CSV -M md -X ext -S shell -Y yaml -D sort descending order
|
||||
-m show manual --help show detailed help -v show version
|
||||
-a sort by age -i sort numerically -t sort by time`
|
||||
-c col,... show specified columns -L highlight matching lines
|
||||
-k col,... sort by specified columns -j read JSON input
|
||||
-F col=reg filter field with regexp -v invert match
|
||||
-T col,... transpose specified columns -n numberize columns
|
||||
-R /from/to/ apply replacement to columns in -T -N do not use colors
|
||||
-y col,... yank columns to clipboard -H do not show headers
|
||||
--ofs char output field separator -s specify field separator
|
||||
-r file read input from file -z use fuzzy search
|
||||
-f file read config from file -I interactive filter mode
|
||||
-x col,... use custom headers -d debug
|
||||
-o char use char as output separator -g auto generate headers
|
||||
|
||||
-O org -C CSV -M md -X ext -S shell -Y yaml -J json -D sort descending order
|
||||
-m show manual --help show detailed help -v show version
|
||||
-a sort by age -i sort numerically -t sort by time`
|
||||
|
||||
@@ -22,8 +22,8 @@ SYNOPSIS
|
||||
-R, --regex-transposer </from/to/> Apply /search/replace/ regexp to fields given in -T
|
||||
-j, --json Read JSON input (must be array of hashes)
|
||||
-I, --interactive Interactively filter and select rows
|
||||
--auto-headers Generate headers if there are none present in input
|
||||
--custom-headers a,b,... Use custom headers, separated by comma
|
||||
-g, --auto-headers Generate headers if there are none present in input
|
||||
-x, --custom-headers a,b,... Use custom headers, separated by comma
|
||||
|
||||
Output Flags (mutually exclusive):
|
||||
-X, --extended Enable extended output
|
||||
@@ -31,12 +31,13 @@ SYNOPSIS
|
||||
-O, --orgtbl Enable org-mode table output
|
||||
-S, --shell Enable shell evaluable output
|
||||
-Y, --yaml Enable yaml output
|
||||
-J, --jsonout Enable JSON output
|
||||
-C, --csv Enable CSV output
|
||||
-A, --ascii Default output mode, ascii tabular
|
||||
-L, --hightlight-lines Use alternating background colors for tables
|
||||
-o, --ofs <char> Output field separator, used by -A and -C.
|
||||
-y, --yank-columns Yank specified columns (separated by ,) to clipboard,
|
||||
space separated
|
||||
--ofs <char> Output field separator, used by -A and -C.
|
||||
|
||||
Sort Mode Flags (mutually exclusive):
|
||||
-a, --sort-age sort according to age (duration) string
|
||||
@@ -519,8 +520,8 @@ Operational Flags:
|
||||
-R, --regex-transposer </from/to/> Apply /search/replace/ regexp to fields given in -T
|
||||
-j, --json Read JSON input (must be array of hashes)
|
||||
-I, --interactive Interactively filter and select rows
|
||||
--auto-headers Generate headers if there are none present in input
|
||||
--custom-headers a,b,... Use custom headers, separated by comma
|
||||
-g, --auto-headers Generate headers if there are none present in input
|
||||
-x, --custom-headers a,b,... Use custom headers, separated by comma
|
||||
|
||||
Output Flags (mutually exclusive):
|
||||
-X, --extended Enable extended output
|
||||
@@ -528,12 +529,13 @@ Output Flags (mutually exclusive):
|
||||
-O, --orgtbl Enable org-mode table output
|
||||
-S, --shell Enable shell evaluable output
|
||||
-Y, --yaml Enable yaml output
|
||||
-J, --jsonout Enable JSON output
|
||||
-C, --csv Enable CSV output
|
||||
-A, --ascii Default output mode, ascii tabular
|
||||
-L, --hightlight-lines Use alternating background colors for tables
|
||||
-o, --ofs <char> Output field separator, used by -A and -C.
|
||||
-y, --yank-columns Yank specified columns (separated by ,) to clipboard,
|
||||
space separated
|
||||
--ofs <char> Output field separator, used by -A and -C.
|
||||
|
||||
Sort Mode Flags (mutually exclusive):
|
||||
-a, --sort-age sort according to age (duration) string
|
||||
|
||||
Reference in New Issue
Block a user