|
1 | 1 | package cmd |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "context" |
5 | 4 | "fmt" |
6 | 5 | "os" |
7 | | - "time" |
8 | 6 |
|
9 | 7 | "github.com/runware/runware-cli/internal/config" |
10 | 8 | "github.com/spf13/cobra" |
@@ -42,7 +40,6 @@ func init() { |
42 | 40 | rootCmd.PersistentFlags().StringVar(&flagFormat, "format", "", "Output format: table, json, yaml") |
43 | 41 | rootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "Show request/response details") |
44 | 42 | rootCmd.PersistentFlags().BoolVar(&flagDebug, "debug", false, "Show full debug output") |
45 | | - rootCmd.PersistentFlags().Int("request-timeout", defaultRequestTimeoutSeconds, "HTTP request timeout in seconds (0 = no timeout)") |
46 | 43 |
|
47 | 44 | rootCmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]cobra.Completion, cobra.ShellCompDirective) { //nolint:errcheck,gosec |
48 | 45 | return []cobra.Completion{"table", "json", "yaml"}, cobra.ShellCompDirectiveNoFileComp |
@@ -77,13 +74,3 @@ func getFormat() string { |
77 | 74 | } |
78 | 75 | return config.Get().Defaults.Format |
79 | 76 | } |
80 | | - |
81 | | -// contextWithTimeout builds a context from the cobra command's context, |
82 | | -// applying --request-timeout if set (0 = no timeout). |
83 | | -func contextWithTimeout(cmd *cobra.Command) (context.Context, context.CancelFunc) { |
84 | | - secs, _ := cmd.Flags().GetInt("request-timeout") |
85 | | - if secs <= 0 { |
86 | | - return context.WithCancel(cmd.Context()) |
87 | | - } |
88 | | - return context.WithTimeout(cmd.Context(), time.Duration(secs)*time.Second) |
89 | | -} |
0 commit comments