feat: add PR diff, PR review, and structured error handling commands

This commit is contained in:
sid 2026-03-21 21:50:24 -06:00
parent 3db03ed5e2
commit 50191cc542
10 changed files with 1008 additions and 13 deletions

View file

@ -11,13 +11,20 @@ import (
)
var cfgFile string
var jsonErrors bool
var rootCmd = &cobra.Command{
Use: "fgj",
Short: "Forgejo CLI tool - work seamlessly with Forgejo from the command line",
Long: `fgj is a command line tool for Forgejo instances (including Codeberg).
It brings pull requests, issues, and other Forgejo concepts to the terminal.`,
Version: "0.2.0",
Version: "0.2.0",
SilenceErrors: true,
}
// JSONErrors reports whether the --json-errors flag is set.
func JSONErrors() bool {
return jsonErrors
}
func Execute() error {
@ -28,6 +35,7 @@ func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.config/fgj/config.yaml)")
rootCmd.PersistentFlags().BoolVar(&jsonErrors, "json-errors", false, "output errors as structured JSON to stderr")
rootCmd.PersistentFlags().String("hostname", "", "Forgejo instance hostname")
_ = viper.BindPFlag("hostname", rootCmd.PersistentFlags().Lookup("hostname"))
}