char/main.go

30 lines
626 B
Go
Raw Normal View History

2022-11-01 14:26:54 +01:00
package main
import (
2022-11-02 22:10:15 +01:00
"context"
"errors"
2022-11-01 14:26:54 +01:00
"log"
"git.front.kjuulh.io/kjuulh/char/cmd/char"
2022-11-02 22:10:15 +01:00
"git.front.kjuulh.io/kjuulh/char/pkg/charcontext"
2022-11-01 14:26:54 +01:00
)
func main() {
2022-11-02 22:10:15 +01:00
charctx, err := charcontext.NewCharContext(context.Background())
if err != nil {
if errors.Is(err, charcontext.ErrNoContextFound) {
log.Print("you are not in a char context, as such you will be presented with limited options")
if err := char.NewLimitedCharCmd().Execute(); err != nil {
log.Fatal(err)
}
} else {
log.Fatal(err)
}
}
defer charctx.Close()
if err := char.NewCharCmd(charctx).Execute(); err != nil {
2022-11-01 14:26:54 +01:00
log.Fatal(err)
}
}