cmdfile

package
v0.5.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &command.C{
	Name: "file",
	Help: `Manipulate file and directory objects.

File objects are addressed by storage keys. The storage key for
a file may be specified in the following formats:

  <root-name>                   : the file key from a root pointer
  @74686973206973206d79206b6579 : hexadecimal encoded
  @dGhpcyBpcyBteSBrZXk=         : base64 encoded
`,

	Commands: []*command.C{
		{
			Name:  "show",
			Usage: fileCmdUsage,
			Help:  "Print the representation of a file object.",

			SetFlags: command.Flags(flax.MustBind, &showFlags),
			Run:      runShow,
		},
		{
			Name:  "list",
			Usage: fileCmdUsage,
			Help:  "List file attributes in a style similar to the ls command.",

			SetFlags: command.Flags(flax.MustBind, &listFlags),
			Run:      runList,
		},
		{
			Name:  "read",
			Usage: fileCmdUsage,
			Help:  "Read the binary contents of a file object",

			Run: command.Adapt(runRead),
		},
		{
			Name: "set",
			Usage: `<root-key>/<path> <target>
@<origin-key>/<path> <target>`,
			Help: `Set the specified path beneath the origin to the given target.

The storage key of the modified origin is printed to stdout.
If the origin is from a root, the root is updated with the modified origin.

The <target> may be a root-key/path or a @file-key/path. In both cases the path
component is optional; if a root-key is given alone its root file is used as
the target.`,

			Run: command.Adapt(runSet),
		},
		{
			Name: "remove",
			Usage: `<root-key>/<path> ...
@<origin-key>/<path> ...`,
			Help: `Remove the specified path from beneath the origin

The storage key of the modified origin is printed to stdout.
If the origin is from a root, the root is updated with the changes.
`,

			Run: runRemove,
		},
		{
			Name: "set-stat",
			Usage: `<root-key>/<path> <stat-spec>
@<origin-key>/<path> <stat-spec>`,
			Help: `Modify the stat message of the specified path beneath the origin.

The stat spec is a list of fields to update, one or more of:

 mode <perms>   -- set file permissions (e.g., 0755)
 type <type>    -- set file type (see below)
 mtime <time>   -- update file timestamp ("now", @<seconds>, or RFC3339)
 uid <id>       -- set the owner UID
 gid <id>       -- set the group GID
 owner <name>   -- set the owner name ("" to clear)
 group <name>   -- set the group name ("" to clear)
 persist <ok>   -- set or unset stat persistence

Allowed types include:

 f, file:          regular file
 d, dir:           directory
 l, link, symlink: symbolic link
 p, pipe, fifo:    named pipe (FIFO)
 s, socket:        socket
 b, block, bdev:   block device
 c, char, cdev:    character device

If the origin is from a root, the root is updated with the changes.`,

			Run: command.Adapt(runSetStat),
		},
		{
			Name: "xattr",
			Usage: `<root-key>/<path> <xattr-spec>
@<origin-key>/<path> <xattr-spec>`,
			Help: `Edit extended attributes of the specified path beneath the origin.

The xattr spec is one of the following:

  list               -- list the extended attribute names
  clear              -- remove all extended attributes
  get <name>         -- get the value of the xattr
  delete <name>      -- delete the named xattr
  set <name> <value> -- set the value of the xattr

If the origin is from a root, the root is updated with the changes.`,

			Run: command.Adapt(runXAttr),
		},
		{
			Name: "resolve",
			Usage: `<root-key>/<path>
@<origin-key>/<path>`,
			Help: "Show the storage key targeted by the specified path.",

			SetFlags: command.Flags(flax.MustBind, &resolveFlags),
			Run:      command.Adapt(runResolve),
		},
	},
}

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