cmd

package
v0.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GITHUB = "github"
	DRONE  = "drone"
)

Variables

View Source
var (
	Version string = ""
	Commit  string = ""
)
View Source
var CompletionCmd = &cobra.Command{
	Use:   "completion [bash|zsh|fish|powershell]",
	Short: "Generate completion script",
	Long: `Generate shell completion scripts for CodeGPT CLI.
	
To load completions:

Bash:
	$ source <(codegpt completion bash)
	# Or save it to a file and source it:
	$ codegpt completion bash > ~/.codegpt-completion.bash
	$ echo 'source ~/.codegpt-completion.bash' >> ~/.bashrc

Zsh:
	$ source <(codegpt completion zsh)
	# Or save it to a file in your $fpath:
	$ codegpt completion zsh > "${fpath[1]}/_codegpt"

Fish:
	$ codegpt completion fish > ~/.config/fish/completions/codegpt.fish

PowerShell:
	PS> codegpt completion powershell > codegpt.ps1
	PS> . ./codegpt.ps1`,
	DisableFlagsInUseLine: true,
	ValidArgs:             []string{"bash", "zsh", "fish", "powershell"},
	Args:                  cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
	Run: func(cmd *cobra.Command, args []string) {
		switch args[0] {
		case "bash":
			_ = cmd.Root().GenBashCompletion(os.Stdout)
		case "zsh":
			_ = cmd.Root().GenZshCompletion(os.Stdout)
		case "fish":
			_ = cmd.Root().GenFishCompletion(os.Stdout, true)
		case "powershell":
			_ = cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
		}
	},
}

Functions

func Execute

func Execute(ctx context.Context)

func GetClient added in v0.13.0

func GetClient(ctx context.Context, p core.Platform) (core.Generative, error)

GetClient returns the generative client based on the platform

func NewAnthropic added in v0.15.0

func NewAnthropic(ctx context.Context) (*anthropic.Client, error)

NewAnthropic creates a new instance of the anthropic.Client using configuration values retrieved from Viper. The configuration values include the API key, model, maximum tokens, temperature, and top_p.

Parameters:

  • ctx: The context for the client.

Returns:

  • A pointer to an anthropic.Client instance.
  • An error if the client could not be created.

func NewGemini added in v0.13.0

func NewGemini(ctx context.Context) (*gemini.Client, error)

NewGemini returns a new Gemini client

func NewOpenAI added in v0.12.1

func NewOpenAI() (*openai.Client, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL