command

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package command implements subcommands.

Index

Constants

View Source
const (
	// FlagAlbumName is the flag name to specify an album name.
	FlagAlbumName = "album"
	// FlagDirectory is the flag name to specify an output directory where downloaded files will be stored.
	FlagDirectory = "dir"
	// FlagAll is the flag to download all files in a list.
	FlagAll = "all"
	// FlagRecipient is the flag to specify recipient's public key.
	FlagRecipient = "recipient"
	// FlagRecipientFile is the flag to specify a path to the file that contains recipients' public keys.
	FlagRecipientFile = "recipient-file"
	// FlagIdentity is the flag to specify a path to the file that contains the user's private keys.
	FlagIdentity = "identity"
)
View Source
const AgeExt = ".age"

Variables

View Source
var Commands = []*cli.Command{
	{
		Name:  "upload",
		Usage: "Upload files",
		Description: "Upload files specified by the given paths. Each path can have an optional name. " +
			"If a name is given, uploaded file will be renamed with it.\n\n" +
			"If recipients are specified by --recipient and/or --recipient-file flags, " +
			"files will be encrypted before being uploaded.\n\n" +
			"A recipient can be an age public key generated by age-keygen (\"age1...\") " +
			"or an SSH public key (\"ssh-ed25519 AAAA...\", \"ssh-rsa AAAA...\"). \n\n" +
			"A recipient file contains one or more recipients, one per line. " +
			"Empty lines and lines starting with \"#\" are ignored as comments.",
		ArgsUsage: "<path[:name]>...",
		Action:    CmdUpload,
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name: FlagAlbumName,
				Usage: "If multiple files are uploaded, an album consisting of those files will be created. " +
					"This flag can specifies the album `NAME`.",
			},
			&cli.StringSliceFlag{
				Name:     FlagRecipient,
				Aliases:  []string{"r"},
				Category: "End-to-end encryption",
				Usage:    "Encrypt to the specified `RECIPIENT`. Can be repeated.",
			},
			&cli.StringFlag{
				Name:     FlagRecipientFile,
				Aliases:  []string{"R"},
				Category: "End-to-end encryption",
				Usage:    "Encrypt to recipients listed at `PATH`.",
			},
		},
	}, {
		Name:  "download",
		Usage: "Download files",
		Description: "Download files associated with the given URLs. " +
			"If the URL refers an album, you will be asked which file you want to download.\n\n" +
			"If a downloading file has extension \".age\" and an identity is specified with --identity flag, " +
			"the file will be decrypted.\n\n" +
			"An identity file contains one or more secret keys (\"AGE-SECRET-KEY-1...\"), one per line, " +
			"or an SSH key. " +
			"Empty lines and lines starting with \"#\" are ignored as comments.",
		ArgsUsage: "<URL>...",
		Action:    CmdDownload,
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:        FlagDirectory,
				Aliases:     []string{"o"},
				Usage:       "`path` to the directory where downloaded files will be stored",
				DefaultText: ".",
			},
			&cli.BoolFlag{
				Name:  FlagAll,
				Usage: "if an album URL is given, download all files in it",
			},
			&cli.StringFlag{
				Name:     FlagIdentity,
				Aliases:  []string{"i"},
				Category: "End-to-end encryption",
				Usage:    "Use the identity file at `PATH`.",
			},
		},
	},
}

Commands manage sub commands.

View Source
var ErrUnsupportedPublicKey = errors.New("not supported public key")

Functions

func CmdDownload

func CmdDownload(c *cli.Context) error

func CmdUpload

func CmdUpload(c *cli.Context) error

func Decrypt added in v0.7.0

func Decrypt(dest io.WriteCloser, identity []age.Identity) io.WriteCloser

func Encrypt added in v0.7.0

func Encrypt(src io.ReadCloser, recipients []age.Recipient) io.ReadCloser

Types

This section is empty.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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