()
| 60 | output.WithSummary(fmt.Sprintf("Set %s = %s", key, value)), |
| 61 | ) |
| 62 | }, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func newConfigTrustLocalCommand() *cobra.Command { |
| 67 | return &cobra.Command{ |
| 68 | Use: "trust-local", |
| 69 | Short: "Trust this repository's local HEY settings", |
| 70 | Args: cobra.NoArgs, |
| 71 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 72 | local := cfg.LocalConfig() |
| 73 | if local == nil { |
| 74 | return output.ErrUsage("no local .hey/config.json with a server or account setting was found") |
| 75 | } |
| 76 | if err := cfg.TrustLocalConfig(); err != nil { |
| 77 | return err |
| 78 | } |
| 79 | if writer.IsStyled() { |
| 80 | fmt.Fprintf(cmd.OutOrStdout(), "Trusted local HEY configuration: %s\n", terminalSafeText(local.Path)) |
| 81 | return nil |
| 82 | } |
| 83 | return writeOK(cfg.LocalConfig(), output.WithSummary("Trusted local HEY configuration")) |
| 84 | }, |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | func newConfigUntrustLocalCommand() *cobra.Command { |
| 89 | return &cobra.Command{ |
| 90 | Use: "untrust-local", |
| 91 | Short: "Remove trust for this repository's local HEY settings", |
| 92 | Args: cobra.NoArgs, |
| 93 | RunE: func(cmd *cobra.Command, _ []string) error { |
no test coverage detected