58 lines
1.1 KiB
Go
58 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"strings"
|
|
"syscall"
|
|
|
|
"gogs.inhome.blapointe.com/ana-ledger/cmd/cli"
|
|
"gogs.inhome.blapointe.com/ana-ledger/cmd/http"
|
|
"gogs.inhome.blapointe.com/ana-ledger/src/bank/teller"
|
|
)
|
|
|
|
func main() {
|
|
switch os.Args[1] {
|
|
case "tel":
|
|
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
|
|
defer can()
|
|
|
|
if c, err := teller.New(); err != nil {
|
|
} else if _, err := c.Accounts(ctx); err != nil {
|
|
} else {
|
|
log.Println("teller already init")
|
|
}
|
|
|
|
if err := teller.Init(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
case "http":
|
|
os.Args = append([]string{os.Args[0]}, os.Args[2:]...)
|
|
http.Main()
|
|
case "cli":
|
|
os.Args = append([]string{os.Args[0]}, os.Args[2:]...)
|
|
cli.Main()
|
|
case "shared":
|
|
files := os.Args[2:]
|
|
os.Args = []string{os.Args[0], "cli"}
|
|
for _, f := range files {
|
|
if strings.HasPrefix(f, "-") {
|
|
os.Args = append(os.Args, f)
|
|
} else {
|
|
os.Args = append(os.Args, "-f", f)
|
|
}
|
|
}
|
|
os.Args = append(os.Args,
|
|
"-w=^Housey",
|
|
"--depth=1",
|
|
"--usd",
|
|
"-n",
|
|
"--no-percent",
|
|
"bal", "^Bel", "^Zach",
|
|
)
|
|
main()
|
|
}
|
|
}
|