pkg

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlgAll = []string{hashAlgSha256, hashAlgSha1, hashAlgMd5}

all algorithms

View Source
var CommandCp *cli.Command = &cli.Command{
	Name:                  internal.CmdCp,
	Version:               internal.Version,
	Usage:                 "Copy file or directory",
	ArgsUsage:             "[from] [to] [options]",
	Description:           "from\t\tsource (masks supported, example: *.txt)\nto\t\tdestination",
	CustomHelpTemplate:    cli.SubcommandHelpTemplate,
	EnableShellCompletion: true,
	Action:                cpAction,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    cpFlagMode,
			Aliases: []string{cpAliasMode},
			Value:   false,
			Usage:   "force",
		},
	},
}

TODO https://man7.org/linux/man-pages/man1/cp.1.html

View Source
var CommandHash *cli.Command = &cli.Command{
	Name:                  internal.CmdHash,
	Version:               internal.Version,
	Usage:                 "Hash string or file",
	EnableShellCompletion: true,
	ArgsUsage:             "[options]",
	CustomHelpTemplate:    cli.SubcommandHelpTemplate,
	Action:                hashAction,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    hashFlagAlgoritm,
			Aliases: []string{hashAliasAlgoritm},
			Value:   hashAlgSha256,
			Usage:   fmt.Sprintf("hashing algorithm (%s)", strings.Join(AlgAll, ", ")),
		},
		&cli.StringFlag{
			Name:    hashFlagFile,
			Aliases: []string{hashAliasFile},
			Usage:   "file to hash",
		},
		&cli.StringFlag{
			Name:    hashFlagString,
			Aliases: []string{hashAliasString},
			Usage:   "string to hash",
		},
	},
}
View Source
var CommandMkdir *cli.Command = &cli.Command{
	Name:                  internal.CmdMkdir,
	Version:               internal.Version,
	Usage:                 "Creates directory",
	ArgsUsage:             "[directory] [options]",
	CustomHelpTemplate:    cli.SubcommandHelpTemplate,
	EnableShellCompletion: true,
	Action:                mkdirAction,
	Flags: []cli.Flag{
		&cli.UintFlag{
			Name:    mkFlagMode,
			Aliases: []string{mkAliasMode},
			Value:   777,
			Usage:   "mode",
		},
	},
}
View Source
var CommandMv *cli.Command = &cli.Command{
	Name:                  internal.CmdMv,
	Version:               internal.Version,
	Usage:                 "Mode file or directory",
	ArgsUsage:             "[from] [to] [options]",
	Description:           "from\t\tsource (masks supported, example: *.txt)\nto\t\tdestination",
	CustomHelpTemplate:    cli.SubcommandHelpTemplate,
	EnableShellCompletion: true,
	Action:                mvAction,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    mvFlagMode,
			Aliases: []string{mvAliasMode},
			Value:   false,
			Usage:   "force",
		},
	},
}

TODO https://man7.org/linux/man-pages/man1/mv.1.html

Functions

func HashFile

func HashFile(alg string, path string) (*string, error)

func HashString

func HashString(alg string, text string) (*string, error)

func MakeDir

func MakeDir(path string, perm os.FileMode) (*string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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