Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "pipegpt", Short: "A simple CLI tools to question chatgpt", Long: `pipegpt is a simple CLI tools to question chatgpt. You can use it to question chatgpt with your pre-defined prompt or interactively (in cli manner). pipegpt always wait for your input from stdin and output the result to stdout. Provided prompt is used as the first input to chatgpt. Simple Example: # code review in staged changes git diff --staged | pipegpt -p "code review for this change" # commit with suggested commit message git diff --staged | pipegpt -p "suggest conventional commit messages for these changes" | git commit -F - -e # convert JSON to YAML cat sample.json | pipegpt -p "convert JSON to YAML" `, Run: func(cmd *cobra.Command, args []string) { prompt, err := cmd.Flags().GetString("prompt") if err != nil { fmt.Println(err) os.Exit(1) } role := viper.GetString("default.role") input := stdin.ConsumeStdin() client, err := createClient() if err != nil { fmt.Println(err) os.Exit(1) } result, err := generic.New(client).Run(role, prompt, input) if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println(result) }, }
Functions ¶
func CreateSubcommand ¶
CreateSubcommand creates a subcommand
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.