2
go.mod
2
go.mod
@@ -23,6 +23,7 @@ require (
|
|||||||
github.com/jackc/pgx/v5 v5.8.0
|
github.com/jackc/pgx/v5 v5.8.0
|
||||||
github.com/jhillyerd/enmime v1.3.0
|
github.com/jhillyerd/enmime v1.3.0
|
||||||
github.com/modelcontextprotocol/go-sdk v1.4.0
|
github.com/modelcontextprotocol/go-sdk v1.4.0
|
||||||
|
github.com/muesli/termenv v0.16.0
|
||||||
github.com/openai/openai-go v1.12.0
|
github.com/openai/openai-go v1.12.0
|
||||||
github.com/pdfcpu/pdfcpu v0.11.1
|
github.com/pdfcpu/pdfcpu v0.11.1
|
||||||
github.com/pires/go-proxyproto v0.11.0
|
github.com/pires/go-proxyproto v0.11.0
|
||||||
@@ -64,7 +65,6 @@ require (
|
|||||||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||||
github.com/muesli/termenv v0.16.0 // indirect
|
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||||
golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c // indirect
|
golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c // indirect
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.probo.inc/probo/pkg/version"
|
"go.probo.inc/probo/pkg/version"
|
||||||
@@ -72,11 +73,12 @@ func (c *Client) Do(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(resp.Errors) > 0 {
|
if len(resp.Errors) > 0 {
|
||||||
msg := resp.Errors[0].Message
|
var msg strings.Builder
|
||||||
|
msg.WriteString(resp.Errors[0].Message)
|
||||||
for _, e := range resp.Errors[1:] {
|
for _, e := range resp.Errors[1:] {
|
||||||
msg += "; " + e.Message
|
msg.WriteString("; " + e.Message)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("GraphQL error: %s", msg)
|
return nil, fmt.Errorf("GraphQL error: %s", msg.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.Data, nil
|
return resp.Data, nil
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ package cmdutil
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -61,11 +62,9 @@ func ValidateOutputFlag(value *string) error {
|
|||||||
// ValidateEnum checks that value is one of the allowed values. It returns a
|
// ValidateEnum checks that value is one of the allowed values. It returns a
|
||||||
// user-friendly error mentioning the flag name and the valid choices.
|
// user-friendly error mentioning the flag name and the valid choices.
|
||||||
func ValidateEnum(flag string, value string, allowed []string) error {
|
func ValidateEnum(flag string, value string, allowed []string) error {
|
||||||
for _, v := range allowed {
|
if slices.Contains(allowed, value) {
|
||||||
if value == v {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"invalid --%s value %q: valid values are %s",
|
"invalid --%s value %q: valid values are %s",
|
||||||
flag,
|
flag,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package create
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -69,13 +70,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
for _, e := range flagEvents {
|
for _, e := range flagEvents {
|
||||||
valid := false
|
valid := slices.Contains(shared.ValidEvents, e)
|
||||||
for _, v := range shared.ValidEvents {
|
|
||||||
if e == v {
|
|
||||||
valid = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !valid {
|
if !valid {
|
||||||
return fmt.Errorf("invalid --event value %q: valid values are %s", e, strings.Join(shared.ValidEvents, ", "))
|
return fmt.Errorf("invalid --event value %q: valid values are %s", e, strings.Join(shared.ValidEvents, ", "))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package update
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -68,13 +69,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
|
|
||||||
if cmd.Flags().Changed("event") {
|
if cmd.Flags().Changed("event") {
|
||||||
for _, e := range flagEvents {
|
for _, e := range flagEvents {
|
||||||
valid := false
|
valid := slices.Contains(shared.ValidEvents, e)
|
||||||
for _, v := range shared.ValidEvents {
|
|
||||||
if e == v {
|
|
||||||
valid = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !valid {
|
if !valid {
|
||||||
return fmt.Errorf("invalid --event value %q: valid values are %s", e, strings.Join(shared.ValidEvents, ", "))
|
return fmt.Errorf("invalid --event value %q: valid values are %s", e, strings.Join(shared.ValidEvents, ", "))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user