command

package
v0.19.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddAuth = &cobra.Command{
	Use:  "addAuth <digest> <user:pass>",
	Args: cobra.ExactArgs(2),
	RunE: commandAddAuth,
}
View Source
var (
	Cat = &cobra.Command{
		Use: "cat <path1> [<path2> ...]",
		Example: `zk cat /zk/path

# List filename before file data
zk cat -l /zk/path1 /zk/path2`,
		Args: cobra.MinimumNArgs(1),
		RunE: commandCat,
	}
)
View Source
var Chmod = &cobra.Command{
	Use: "chmod <mode> <path>",
	Example: `zk chmod n-mode /zk/path
zk chmod n+mode /zk/path`,
	Args: cobra.MinimumNArgs(2),
	RunE: commandChmod,
}
View Source
var Cp = &cobra.Command{
	Use: "cp <src> <dst>",
	Example: `zk cp /zk/path .
zk cp ./config /zk/path/config

# Trailing slash indicates directory
zk cp ./config /zk/path/`,
	Args: cobra.MinimumNArgs(2),
	RunE: commandCp,
}
View Source
var (
	Edit = &cobra.Command{
		Use:   "edit <path>",
		Short: "Create a local copy, edit, and write changes back to cell.",
		Args:  cobra.ExactArgs(1),
		RunE:  commandEdit,
	}
)
View Source
var (
	Ls = &cobra.Command{
		Use: "ls <path>",
		Example: `zk ls /zk
zk ls -l /zk

# List directory node itself)
zk ls -ld /zk

# Recursive (expensive)
zk ls -R /zk`,
		Args: cobra.MinimumNArgs(1),
		RunE: commandLs,
	}
)
View Source
var (
	Rm = &cobra.Command{
		Use: "rm <path>",
		Example: `zk rm /zk/path

# Recursive.
zk rm -R /zk/path

# No error on nonexistent node.
zk rm -f /zk/path`,
		Args: cobra.MinimumNArgs(1),
		RunE: commandRm,
	}
)
View Source
var (
	Root = &cobra.Command{
		Use:   "zk",
		Short: "zk is a tool for wrangling zookeeper.",
		Long: `zk is a tool for wrangling zookeeper.

It tries to mimic unix file system commands wherever possible, but
there are some slight differences in flag handling.

The zk tool looks for the address of the cluster in /etc/zookeeper/zk_client.conf,
or the file specified in the ZK_CLIENT_CONFIG environment variable.

The local cell may be overridden with the ZK_CLIENT_LOCAL_CELL environment
variable.`,
		PersistentPreRun: func(cmd *cobra.Command, args []string) {
			logutil.PurgeLogs()

			fs = &zkfs.FS{
				Conn: zk2topo.Connect(server),
			}
		},
		PersistentPostRun: func(cmd *cobra.Command, args []string) {
			logutil.Flush()
		},
	}
)
View Source
var (
	Stat = &cobra.Command{
		Use:  "stat <path>",
		Args: cobra.MinimumNArgs(1),
		RunE: commandStat,
	}
)
View Source
var (
	Touch = &cobra.Command{
		Use:   "touch <path>",
		Short: "Change node access time.",
		Long: `Change node access time.
		
NOTE: There is no mkdir - just touch a node.
The disntinction between file and directory is not relevant in zookeeper.`,
		Example: `zk touch /zk/path

# Don't create, just touch timestamp.
zk touch -c /zk/path

# Create all parts necessary (think mkdir -p).
zk touch -p /zk/path`,
		Args: cobra.ExactArgs(1),
		RunE: commandTouch,
	}
)
View Source
var Unzip = &cobra.Command{
	Use: "unzip <archive> <path>",
	Example: `zk unzip zktree.zip /
zk unzip zktree.zip /zk/prefix`,
	Args: cobra.ExactArgs(1),
	RunE: commandUnzip,
}
View Source
var (
	Wait = &cobra.Command{
		Use:   "wait <path>",
		Short: "Sets a watch on the node and then waits for an event to fire.",
		Example: ` # Wait for node change or creation.
zk wait /zk/path

# Trailing slash waits on children.
zk wait /zk/path/children/`,
		Args: cobra.ExactArgs(1),
		RunE: commandWait,
	}
)
View Source
var Watch = &cobra.Command{
	Use:     "watch <path>",
	Short:   "Watches for changes to nodes and prints events as they occur.",
	Example: `watch /zk/path`,
	Args:    cobra.MinimumNArgs(1),
	RunE:    commandWatch,
}
View Source
var Zip = &cobra.Command{
	Use:   "zip <path> [<path> ...] <archive>",
	Short: "Store a zk tree in a zip archive.",
	Long: `Store a zk tree in a zip archive.
	
Note this won't be immediately useful to the local filesystem since znodes can have data and children;
that is, even "directories" can contain data.`,
	Args: cobra.MinimumNArgs(2),
	RunE: commandZip,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL