Skip to content

Commit

Permalink
fix: Collision with --global flags
Browse files Browse the repository at this point in the history
Meroxa CLI used it before to specify the path of a configuration file, while connectors still use it the same as well.
  • Loading branch information
raulb committed Sep 29, 2021
1 parent ac1587b commit 9387bdb
Show file tree
Hide file tree
Showing 135 changed files with 681 additions and 650 deletions.
4 changes: 2 additions & 2 deletions cmd/meroxa/global/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func getEnvVal(keys []string, defaultVal string) string {
func readConfig() (*viper.Viper, error) {
cfg := viper.New()

if flagConfig != "" {
if flagMeroxaConfig != "" {
// Use config file from the flag.
cfg.SetConfigFile(flagConfig)
cfg.SetConfigFile(flagMeroxaConfig)
} else {
// Find home directory.
configDir, err := os.UserConfigDir()
Expand Down
16 changes: 10 additions & 6 deletions cmd/meroxa/global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ var (
)

var (
flagConfig string
flagAPIURL string
flagDebug bool
flagTimeout time.Duration
flagJSON bool
flagMeroxaConfig string
flagAPIURL string
flagDebug bool
flagTimeout time.Duration
flagJSON bool
)

func DeprecateV1Commands() bool {
Expand All @@ -44,7 +44,11 @@ func DeprecateV1Commands() bool {

func RegisterGlobalFlags(cmd *cobra.Command) {
cmd.PersistentFlags().BoolVar(&flagJSON, "json", false, "output json")
cmd.PersistentFlags().StringVar(&flagConfig, "config", "", "config file")

// It stays around until we update our acceptance tests
cmd.PersistentFlags().StringVar(&flagMeroxaConfig, "config", "", "meroxa configuration file")

cmd.PersistentFlags().StringVar(&flagMeroxaConfig, "meroxa-config", "", "meroxa configuration file")
cmd.PersistentFlags().StringVar(&flagAPIURL, "api-url", "", "API url")
cmd.PersistentFlags().BoolVar(&flagDebug, "debug", false, "display any debugging information")
cmd.PersistentFlags().DurationVar(&flagTimeout, "timeout", time.Second*10, "set the duration of the client timeout in seconds (default 10s)") // nolint:gomnd,lll
Expand Down
10 changes: 5 additions & 5 deletions docs/cmd/md/meroxa.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ meroxa resources list --types
### Options

```
--config string config file
--debug display any debugging information
-h, --help help for meroxa
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
-h, --help help for meroxa
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ meroxa api POST /v1/endpoints '{"protocol": "HTTP", "stream": "resource-2-499379
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Authentication commands for Meroxa
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_auth_login.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa auth login [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_auth_logout.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa auth logout [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_auth_whoami.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ meroxa whoami
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa billing [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ meroxa completion [bash|zsh|fish|powershell]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa config [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_config_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ refresh_token: c337a0d...c0f928b
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
9 changes: 5 additions & 4 deletions docs/cmd/md/meroxa_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ meroxa connect --from RESOURCE-NAME --to RESOURCE-NAME [flags]
### Options

```
-c, --config string connector configuration
--from string source resource name
-h, --help help for connect
--input string command delimited list of input streams
Expand All @@ -35,10 +36,10 @@ meroxa connect --from RESOURCE-NAME --to RESOURCE-NAME [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_connectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Manage connectors on Meroxa
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
9 changes: 5 additions & 4 deletions docs/cmd/md/meroxa_connectors_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ meroxa connectors create [NAME] --to pg2redshift --input orders --pipeline my-pi
### Options

```
-c, --config string connector configuration
--from string resource name to use as source
-h, --help help for create
--input string command delimited list of input streams
Expand All @@ -33,10 +34,10 @@ meroxa connectors create [NAME] --to pg2redshift --input orders --pipeline my-pi
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_connectors_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa connectors describe [NAME] [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_connectors_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ meroxa connectors list [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_connectors_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa connectors logs NAME [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_connectors_remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ meroxa connectors remove NAME [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
15 changes: 8 additions & 7 deletions docs/cmd/md/meroxa_connectors_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ meroxa connector update connector-name --config '{"table.name.format":"public.co
### Options

```
-h, --help help for update
--name string new connector name
--state string new connector state
-c, --config string new connector configuration
-h, --help help for update
--name string new connector name
--state string new connector state
```

### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Manage endpoints on Meroxa
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_endpoints_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ meroxa endpoints create my-endpoint --protocol http --stream my-stream
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
8 changes: 4 additions & 4 deletions docs/cmd/md/meroxa_endpoints_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ meroxa endpoints describe [NAME] [flags]
### Options inherited from parent commands

```
--config string config file
--debug display any debugging information
--json output json
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
--debug display any debugging information
--json output json
--meroxa-config string meroxa configuration file
--timeout duration set the duration of the client timeout in seconds (default 10s) (default 10s)
```

### SEE ALSO
Expand Down
Loading

0 comments on commit 9387bdb

Please sign in to comment.