Beispiel #1
0
package main

import (
	"fmt"
	"os"

	flag "github.com/EricLagergren/pflag"
)

const (
	Help    = "help"
	Version = "version"
)

var (
	recursive      = flag.BoolP("recursive", "R", false, "")
	changes        = flag.BoolP("changes", "c", false, "")
	dereference    = flag.Bool("dereference", false, "")
	from           = flag.Bool("from", false, "")
	noDereference  = flag.BoolP("no-dereference", "h", false, "")
	noPreserveRoot = flag.Bool("no-preserve-root", false, "")
	quiet          = flag.Bool("quiet", false, "")
	silent         = flag.Bool("silent", false, "")
	reference      = flag.Bool("reference", false, "")
	verbose        = flag.BoolP("verbose", "v", false, "")

	version = flag.Bool("version", false, "")
)

func main() {
	flag.Usage = func() {
The install flags -- shared with overwrite and remove -- are as follows:
	
	-a, --all           install all utilities
	-d, --dir           install utilities in specific dir (default %s ($GOBIN))
	-o, --overwrite     overwrite current GNU coreutils (if they exist)
	-p, --prefix=S      prefix command with S, e.g., if -p=go-, then
	                    the command file would be named go-wc, go-cat, etc.
		--files-from=F  install files from F (newline delimited)
		--files-from0=F install files from F (null-delimited)

`,
}

var (
	all       = flag.BoolP("all", "a", false, "")
	overwrite = flag.BoolP("overwrite", "o", false, "")
	prefix    = flag.StringP("prefix", "p", "", "")
	dir       = flag.StringP("dir", "d", "", "")

	complicated = *overwrite || *prefix != "" || *dir != ""
)

func installUtils(names []string) {
	if gobin == "" && *dir == "" {
		fmt.Println("go-coreutils: Cannot have empty $GOBIN and empty --dir")
		os.Exit(1)
	}

	if len(names) < 1 {
		fmt.Println("go-coreutils: Must list utilities to install or use --all option")
Beispiel #3
0
  -e, --exclude		exclude specific special characters (default = "")
  -i, --include-special	include special characters (default = random)
  -l, --length		required password length (default = 8)
  -w, --lower		number of lowercase characters (default = random)
  -n, --number		number of passwords to print (default = 1)
  -s, --special		number of special characters (default = 0)
  -u, --uppercase	number of uppercase characters (default = random)

Report pwpls bugs to [email protected]
pwpls home page: <https://github.com/EricLagergren/pwpls>
`
)

var (
	alg            = flag.StringP("alg", "a", "random", "")
	b64            = flag.BoolP("base64", "b", false, "")
	digits         = flag.IntP("digits", "d", 0, "")
	exclude        = flag.StringP("exclude", "e", "", "")
	includeSpecial = flag.BoolP("include-special", "i", false, "")
	length         = flag.IntP("length", "l", 8, "")
	lower          = flag.IntP("lower", "w", 0, "")
	number         = flag.IntP("number", "n", 1, "")
	special        = flag.IntP("special", "s", -1, "")
	upper          = flag.IntP("uppercase", "u", -1, "")

	vers = flag.BoolP("version", "v", false, "")

	logger = log.New(os.Stderr, "pwpls: ", 0)
)

type algFn func(bool) string