File size: 717 Bytes
98f8e86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package cmd

import (
	"fmt"
	"os"

	"github.com/spf13/cobra"
)

var (
	server string
	user   string
)

func NewRootCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "llmcli",
		Short: "CLI client for the LLM backend",
	}

	cmd.PersistentFlags().StringVarP(&server, "server", "s", "http://localhost:8000", "API server URL")
	cmd.PersistentFlags().StringVarP(&user, "user", "u", "default", "User name")

	cmd.AddCommand(newChatCmd())
	cmd.AddCommand(newUploadCmd())
	cmd.AddCommand(newLsCmd())
	cmd.AddCommand(newCatCmd())
	cmd.AddCommand(newWriteCmd())
	cmd.AddCommand(newRmCmd())

	return cmd
}

func Execute() {
	if err := NewRootCmd().Execute(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}