// Command yetano-solutions runs the Solutions Guide commands (CI of the // catalog, development). The guide is deliberately not part of yet, which // stays a general tool; the full program with TUI and GUI moves to its // own repository (docs/knowledge-solutions ADR-0006). // // yetano-solutions solution list --catalog assets/solutions package main import ( "context" "os" "os/signal" "syscall" "yetano.dev/yetano/core" "yetano.dev/yetano/core/paths" "yetano.dev/yetano/core/solutions/cli" ) var version = "dev" func main() { ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer stop() // instances, sessions and presets are user data: core/paths' data // directory (nothing is created until something is saved) storeDir := os.Getenv("YETANO_SOLUTIONS_HOME") if storeDir == "" { if r, err := paths.For(core.Application{Name: "yetano-solutions", Kind: core.CLI}); err == nil { if d, err := r.DataDir(); err == nil { storeDir = d } } } os.Exit(cli.Run(ctx, os.Args[1:], cli.Env{ Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr, Interactive: isTerminal(os.Stdin) && isTerminal(os.Stdout), Program: "yetano-solutions", StoreDir: storeDir, Version: version, })) } // isTerminal: a character device that is not the null device (/dev/null // is a character device too, and must never start an interactive wizard). func isTerminal(f *os.File) bool { st, err := f.Stat() if err != nil || st.Mode()&os.ModeCharDevice == 0 { return false } if null, err := os.Stat(os.DevNull); err == nil && os.SameFile(st, null) { return false } return true }