Add JSON input support (#74)

* added basic json input support
* add coverage to make test
* enhanced unit tests, switch to testify/assert
* reduce ci runs
This commit is contained in:
T.v.Dein
2025-10-01 20:48:49 +02:00
committed by GitHub
parent 5f3f7c417c
commit 06a5d74fb6
18 changed files with 328 additions and 113 deletions

View File

@@ -131,9 +131,11 @@ func Execute() {
rootCmd.PersistentFlags().StringVarP(&conf.TransposeColumns, "transpose-columns", "T", "",
"Transpose the speficied columns (separated by ,)")
rootCmd.PersistentFlags().BoolVarP(&conf.Interactive, "interactive", "I", false,
"interactive mode (experimental)")
"interactive mode")
rootCmd.PersistentFlags().StringVarP(&conf.OFS, "ofs", "", "",
"Output field separator (' ' for ascii table, ',' for CSV)")
rootCmd.PersistentFlags().BoolVarP(&conf.InputJSON, "json", "j", false,
"JSON input mode")
// sort options
rootCmd.PersistentFlags().StringVarP(&conf.SortByColumn, "sort-by", "k", "",

View File

@@ -20,6 +20,7 @@ SYNOPSIS
-F, --filter <field[!]=reg> Filter given field with regex, can be used multiple times
-T, --transpose-columns string Transpose the speficied columns (separated by ,)
-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
Output Flags (mutually exclusive):
@@ -463,6 +464,7 @@ Operational Flags:
-F, --filter <field[!]=reg> Filter given field with regex, can be used multiple times
-T, --transpose-columns string Transpose the speficied columns (separated by ,)
-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
Output Flags (mutually exclusive):