aboutsummaryrefslogtreecommitdiffstats
path: root/skate/cmd/skate-map
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-04 23:18:28 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-04 23:18:28 +0200
commit6462e64ce8e61f54e1c3b1247c2039a2eddd5875 (patch)
tree9a25cff1bdc62d9eb4ef11d85dc488fed6ee6889 /skate/cmd/skate-map
parent3a43e67238f5acc96a36265f78b70425d078d579 (diff)
downloadrefcat-6462e64ce8e61f54e1c3b1247c2039a2eddd5875.tar.gz
refcat-6462e64ce8e61f54e1c3b1247c2039a2eddd5875.zip
skate-map: a bit more help output
Diffstat (limited to 'skate/cmd/skate-map')
-rw-r--r--skate/cmd/skate-map/main.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/skate/cmd/skate-map/main.go b/skate/cmd/skate-map/main.go
index d5f22fd..227acf2 100644
--- a/skate/cmd/skate-map/main.go
+++ b/skate/cmd/skate-map/main.go
@@ -54,16 +54,18 @@ var (
extraValue = flag.String("x", "", "extra value to pass to configurable mappers")
bestEffort = flag.Bool("B", false, "best effort")
logFile = flag.String("log", "", "log filename")
- skipOnEmpty = flag.Int("skip-on-empty", -1, "omit docs with empty value in given field, zero indexed")
+ skipOnEmpty = flag.Int("skip-on-empty", -1, "omit docs with empty value in given column (zero indexed)")
+
+ help = `skate-map available mappers
+
+ $ skate-map -m ts < file.ndj > file.tsv
+ `
)
func main() {
flag.Parse()
- // TODO
- // [ ] add prefixes and a way to derive multiple keys in one go
- // [ ] how to store multiple keys, sorted?
- // [ ] maybe wrap jq and parallel for arbitrary nested keys
availableMappers := map[string]skate.Mapper{
+ // Add new mapper functions here.
"id": skate.Identity,
"ff": skate.CreateFixedMapper(*extraValue),
"ti": skate.MapperTitle,
@@ -102,8 +104,7 @@ func main() {
}
}
default:
- fmt.Println("skate-map available mappers")
- fmt.Println()
+ fmt.Println(help)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0)
for k, v := range availableMappers {
fmt.Fprintf(w, "%s\t%s\n", k, skate.NameOf(v))