mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-22 11:22:49 -05:00
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
41 lines
958 B
Go
41 lines
958 B
Go
// Package cmd implements Cobra CLI commands for the Onyx CLI.
|
|
package cmd
|
|
|
|
import "github.com/spf13/cobra"
|
|
|
|
// Version and Commit are set via ldflags at build time.
|
|
var (
|
|
Version string
|
|
Commit string
|
|
)
|
|
|
|
func fullVersion() string {
|
|
if Commit != "" && Commit != "none" && len(Commit) > 7 {
|
|
return Version + " (" + Commit[:7] + ")"
|
|
}
|
|
return Version
|
|
}
|
|
|
|
// Execute creates and runs the root command.
|
|
func Execute() error {
|
|
rootCmd := &cobra.Command{
|
|
Use: "onyx-cli",
|
|
Short: "Terminal UI for chatting with Onyx",
|
|
Long: "Onyx CLI — a terminal interface for chatting with your Onyx agent.",
|
|
Version: fullVersion(),
|
|
}
|
|
|
|
// Register subcommands
|
|
chatCmd := newChatCmd()
|
|
rootCmd.AddCommand(chatCmd)
|
|
rootCmd.AddCommand(newAskCmd())
|
|
rootCmd.AddCommand(newAgentsCmd())
|
|
rootCmd.AddCommand(newConfigureCmd())
|
|
rootCmd.AddCommand(newValidateConfigCmd())
|
|
|
|
// Default command is chat
|
|
rootCmd.RunE = chatCmd.RunE
|
|
|
|
return rootCmd.Execute()
|
|
}
|