add import+export, json output, humanize wide output, fixes

This commit is contained in:
2024-12-18 14:06:21 +01:00
parent 9e6bbd5419
commit 332eed679e
11 changed files with 570 additions and 122 deletions

25
main.go
View File

@@ -1,9 +1,34 @@
package main
import (
"bufio"
"fmt"
"os"
"runtime"
"github.com/inconshreveable/mousetrap"
"github.com/tlinden/anydb/cmd"
)
func main() {
cmd.Execute()
}
func init() {
// if we're running on Windows AND if the user double clicked the
// exe file from explorer, we tell them and then wait until any
// key has been hit, which will make the cmd window disappear and
// thus give the user time to read it.
if runtime.GOOS == "windows" {
if mousetrap.StartedByExplorer() {
fmt.Println("Please do no double click anydb.exe!")
fmt.Println("Please open a command shell and run it from there.")
fmt.Println()
fmt.Print("Press any key to quit: ")
_, err := bufio.NewReader(os.Stdin).ReadString('\n')
if err != nil {
panic(err)
}
}
}
}