-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add path config edit command #97
Conversation
Signed-off-by: Dongri Jin <[email protected]>
cmd/config.go
Outdated
switch key { | ||
case "client-id": | ||
configPath.Src.ClientID = value | ||
configPath.Dst.ClientID = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, src client id can be different from dst client id.
The same can be said about connection id, channel id, and port id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add src/dst args
$RLY paths edit $PATH_NAME client-id src clinet-id-src
$RLY paths edit $PATH_NAME client-id dst clinet-id-dst
cmd/config.go
Outdated
@@ -23,6 +22,7 @@ func configCmd(ctx *config.Context) *cobra.Command { | |||
cmd.AddCommand( | |||
configShowCmd(ctx), | |||
configInitCmd(), | |||
configEditCmd(ctx), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you add this feature to the paths
subcommand instead of the config
subcommand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to the paths subcommand
e39fd4c
Signed-off-by: Dongri Jin <[email protected]>
cmd/paths.go
Outdated
@@ -108,14 +110,76 @@ func pathsAddCmd(ctx *config.Context) *cobra.Command { | |||
return fileFlag(cmd) | |||
} | |||
|
|||
func pathsEditCmd(ctx *config.Context) *cobra.Command { | |||
cmd := &cobra.Command{ | |||
Use: "edit [path-name] [key] [src/dst] [value]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following order is more preferable.
- path-name
- src or dst
- key
- value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix order
ad6a4b7
Signed-off-by: Dongri Jin <[email protected]>
cmd/paths.go
Outdated
if err := overWriteConfig(ctx, cmd); err != nil { | ||
return err | ||
} | ||
fmt.Println("config file updated") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongrie
This message is unnecessary and please delete it.
return overWriteConfig(ctx, cmd)
The other part looks perfect. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8923490
Fixed
Signed-off-by: Dongri Jin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks.
Add edit command to config commands
example