summaryrefslogtreecommitdiff
path: root/cmd/ask/main.go
blob: afab992ad558d4ec6910279d907a56bcb80d014f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"context"
	"fmt"
	"os"

	"codeberg.org/snonux/hexai/internal/askcli"
)

func main() {
	d := askcli.NewDispatcher(nil)
	code, err := d.Dispatch(context.Background(), os.Args[1:], os.Stdin, os.Stdout, os.Stderr)
	if err != nil {
		// Print the internal error so callers get a useful diagnostic message.
		fmt.Fprintln(os.Stderr, err)
		os.Exit(code)
	}
	if code != 0 {
		os.Exit(code)
	}
}