summaryrefslogtreecommitdiff
path: root/cmd/hocrtotxt
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-02-27 17:45:16 +0000
committerNick White <git@njw.name>2020-02-27 17:45:16 +0000
commit3880414bbf2d6f2cd05e208abf919ae5ceabeddc (patch)
treedee30a151048de65a3e42cfdae7739c4502e148f /cmd/hocrtotxt
parentcda45588cfb796fdd2af27b1851685270df2c02b (diff)
Reorganise all commands to be behind cmd/
Diffstat (limited to 'cmd/hocrtotxt')
-rw-r--r--cmd/hocrtotxt/main.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/cmd/hocrtotxt/main.go b/cmd/hocrtotxt/main.go
new file mode 100644
index 0000000..6716a9e
--- /dev/null
+++ b/cmd/hocrtotxt/main.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "os"
+
+ "rescribe.xyz/utils/pkg/hocr"
+)
+
+func main() {
+ flag.Usage = func() {
+ fmt.Fprintf(os.Stderr, "Usage: hocrtotxt hocrfile\n")
+ fmt.Fprintf(os.Stderr, "Prints the text from a hocr file.\n")
+ flag.PrintDefaults()
+ }
+ flag.Parse()
+ if flag.NArg() != 1 {
+ flag.Usage()
+ os.Exit(1)
+ }
+
+ text, err := hocr.GetText(flag.Arg(0))
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Printf("%s\n", text)
+}