Use size parsing option in pflag
This commit is contained in:
parent
48142c5577
commit
374daebb8d
4 changed files with 11 additions and 11 deletions
10
crypt.go
10
crypt.go
|
@ -37,26 +37,20 @@ func encrypt(args []string) {
|
|||
var keyfile string
|
||||
var envpw string
|
||||
var nopw bool
|
||||
var sblksize string
|
||||
var blksize uint64
|
||||
|
||||
fs.StringVarP(&outfile, "outfile", "o", "", "Write the output to file `F`")
|
||||
fs.StringVarP(&keyfile, "sign", "s", "", "Sign using private key `S`")
|
||||
fs.BoolVarP(&nopw, "no-password", "", false, "Don't ask for passphrase to decrypt the private key")
|
||||
fs.StringVarP(&envpw, "env-password", "", "", "Use passphrase from environment variable `E`")
|
||||
fs.StringVarP(&sblksize, "block-size", "B", "4M", "Use `S` as the encryption block size")
|
||||
fs.SizeVarP(&blksize, "block-size", "B", 128 * 1024, "Use `S` as the encryption block size")
|
||||
|
||||
err := fs.Parse(args)
|
||||
if err != nil {
|
||||
die("%s", err)
|
||||
}
|
||||
|
||||
blksize, err := utils.ParseSize(sblksize)
|
||||
if err != nil {
|
||||
die("%s", err)
|
||||
}
|
||||
|
||||
var pws, infile string
|
||||
|
||||
var sk *sign.PrivateKey
|
||||
|
||||
if len(keyfile) > 0 {
|
||||
|
|
4
go.mod
4
go.mod
|
@ -5,8 +5,8 @@ go 1.13
|
|||
require (
|
||||
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/opencoff/go-utils v0.4.0
|
||||
github.com/opencoff/pflag v0.4.0
|
||||
github.com/opencoff/go-utils v0.4.1
|
||||
github.com/opencoff/pflag v0.5.0
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
||||
gopkg.in/yaml.v2 v2.2.4
|
||||
)
|
||||
|
|
6
go.sum
6
go.sum
|
@ -8,10 +8,16 @@ github.com/opencoff/go-utils v0.3.0 h1:/TQXjf50o3GSB9MItog5L8Gf4GWJ4B5+rmqjB4g2R
|
|||
github.com/opencoff/go-utils v0.3.0/go.mod h1:c+7QUAiCCHcNH6OGvsZ0fviG7cgse8Y3ucg+xy7sGXM=
|
||||
github.com/opencoff/go-utils v0.4.0 h1:pu08Om//u2+YGvLkHa2CyL6eI+/1J0bXih1Z6nuITp8=
|
||||
github.com/opencoff/go-utils v0.4.0/go.mod h1:c+7QUAiCCHcNH6OGvsZ0fviG7cgse8Y3ucg+xy7sGXM=
|
||||
github.com/opencoff/go-utils v0.4.1 h1:Ke4Q1Tl2GKMI+dwleuPNHH713ngRiNMOFIkymncHqXg=
|
||||
github.com/opencoff/go-utils v0.4.1/go.mod h1:c+7QUAiCCHcNH6OGvsZ0fviG7cgse8Y3ucg+xy7sGXM=
|
||||
github.com/opencoff/pflag v0.3.3 h1:yohZkwYGPkB34WXvUQzU5GyLhImnjfePDARUaE8me3U=
|
||||
github.com/opencoff/pflag v0.3.3/go.mod h1:mTLzGGUGda1Av3d34iAJlh0JIlRxmFZtmc6qoWPspK0=
|
||||
github.com/opencoff/pflag v0.4.0 h1:Y+okQXIvgnGplXlKqqm0uWKQ0KaZLlvSBb4ChQ/3vFw=
|
||||
github.com/opencoff/pflag v0.4.0/go.mod h1:mTLzGGUGda1Av3d34iAJlh0JIlRxmFZtmc6qoWPspK0=
|
||||
github.com/opencoff/pflag v0.4.1 h1:kORIcgXprp9zY60yeHqBUnz9Z/mLWzkcESzya0beJ2Y=
|
||||
github.com/opencoff/pflag v0.4.1/go.mod h1:mTLzGGUGda1Av3d34iAJlh0JIlRxmFZtmc6qoWPspK0=
|
||||
github.com/opencoff/pflag v0.5.0 h1:kK3cSTlGj0fHby/PoFzHkf+Jx3PdiACJwzYDWEWlEKQ=
|
||||
github.com/opencoff/pflag v0.5.0/go.mod h1:mTLzGGUGda1Av3d34iAJlh0JIlRxmFZtmc6qoWPspK0=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc h1:c0o/qxkaO2LF5t6fQrT4b5hzyggAkLLlCUjqfRxd8Q4=
|
||||
|
|
2
version
2
version
|
@ -1 +1 @@
|
|||
0.6.0
|
||||
0.6.1
|
||||
|
|
Loading…
Add table
Reference in a new issue