Created
February 23, 2023 18:25
-
-
Save adsr/ce572ce05ecb45eb36bc9f91d94d2d06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/go/cmd/zk/zkcmd.go b/go/cmd/zk/zkcmd.go | |
index 6b2c4a3840..8045d33b3f 100644 | |
--- a/go/cmd/zk/zkcmd.go | |
+++ b/go/cmd/zk/zkcmd.go | |
@@ -466,41 +466,41 @@ func cmdTouch(ctx context.Context, subFlags *pflag.FlagSet, args []string) error | |
case createParents: | |
_, err = zk2topo.CreateRecursive(ctx, zconn, zkPath, data, 0, zk.WorldACL(zk.PermAll), 10) | |
default: | |
_, err = zconn.Create(ctx, zkPath, data, 0, zk.WorldACL(zk.PermAll)) | |
} | |
if err != nil { | |
return fmt.Errorf("touch: cannot modify %v: %v", zkPath, err) | |
} | |
return nil | |
} | |
func cmdRm(ctx context.Context, subFlags *pflag.FlagSet, args []string) error { | |
var ( | |
force bool | |
recursiveDelete bool | |
forceAndRecursive bool | |
) | |
subFlags.BoolVarP(&force, "force", "f", false, "no warning on nonexistent node") | |
subFlags.BoolVarP(&recursiveDelete, "recursivedelete", "r", false, "recursive delete") | |
- subFlags.BoolVarP(&forceAndRecursive, "forceandrecursive", "rf", false, "shorthand for -r -f") | |
+ subFlags.BoolVarP(&forceAndRecursive, "forceandrecursive", "F", false, "shorthand for -r -f") | |
if err := subFlags.Parse(args); err != nil { | |
return err | |
} | |
force = force || forceAndRecursive | |
recursiveDelete = recursiveDelete || forceAndRecursive | |
if subFlags.NArg() == 0 { | |
return fmt.Errorf("rm: no path specified") | |
} | |
if recursiveDelete { | |
for _, arg := range subFlags.Args() { | |
zkPath := fixZkPath(arg) | |
if strings.Count(zkPath, "/") < 2 { | |
return fmt.Errorf("rm: overly general path: %v", zkPath) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment