pkg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// arguments
	FlagAlgoritm  = "algorithm"
	FlagFile      = "file"
	FlagString    = "string"
	AliasAlgoritm = "a"
	AliasFile     = "f"
	AliasString   = "s"

	// algorithms
	AlgSha256 = "sha256"
	AlgSha1   = "sha1"
	AlgMd5    = "md5"
)
View Source
const (
	// arguments
	FlagMode  = "mode"
	AliasMode = "m"
)

Variables

all algorithms

View Source
var CommandHash *cli.Command = &cli.Command{
	Name:                  internal.CommandHash,
	Version:               internal.Version,
	Usage:                 "Hash string or file",
	EnableShellCompletion: true,
	ArgsUsage:             "[options]",
	Action:                hashAction,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    FlagAlgoritm,
			Aliases: []string{AliasAlgoritm},
			Value:   AlgSha256,
			Usage:   fmt.Sprintf("hashing algorithm (%s)", strings.Join(AlgAll, ", ")),
		},
		&cli.StringFlag{
			Name:    FlagFile,
			Aliases: []string{AliasFile},
			Usage:   "file to hash",
		},
		&cli.StringFlag{
			Name:    FlagString,
			Aliases: []string{AliasString},
			Usage:   "string to hash",
		},
	},
}
View Source
var CommandMkdir *cli.Command = &cli.Command{
	Name:                  internal.CmdMkdir,
	Version:               internal.Version,
	Usage:                 "Creates directory",
	ArgsUsage:             "[directory]",
	EnableShellCompletion: true,
	Action:                mkdirAction,
	Flags: []cli.Flag{
		&cli.UintFlag{
			Name:    FlagMode,
			Aliases: []string{AliasMode},
			Value:   777,
			Usage:   "mode",
		},
	},
}

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