Documentation ¶
Overview ¶
Package cmd some useful tools for command argument
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EncryptAESCMD = &cobra.Command{ Use: "aes", Short: "encrypt file by aes, key's length must be 16/24/32", Long: `encrypt file by aes`, PreRunE: func(cmd *cobra.Command, args []string) error { return setupEncryptAESArgs(cmd) }, Run: func(cmd *cobra.Command, args []string) { fs, err := os.Stat(inputpath) if err != nil { log.Shared.Panic("read path", zap.Error(err)) } if fs.IsDir() { if err = encryptDirFileByAes(); err != nil { log.Shared.Panic("encrypt files in dir", zap.Error(err)) } } else { if err = encryptFileByAes(); err != nil { log.Shared.Panic("encrypt file", zap.Error(err)) } } }, }
EncryptAESCMD encrypt files by aes
`go run cmd/main/main.go encrypt aes -i cmd/root.go -s 123`
View Source
var EncryptCMD = &cobra.Command{ Use: "encrypt", Short: "encrypt file or directory", Long: gutils.Dedent(` encrypt file or directory by aes Usage import ( gcmd "github.com/Laisky/go-utils/v2/cmd" ) func init() { rootCMD.AddCommand(gcmd.EncryptCMD) } Run go run -race main.go encrypt aes -i <file_path> -s <password> `), Args: NoExtraArgs, }
EncryptCMD encrypt files
View Source
var GenTLS = &cobra.Command{ Use: "gentls", Short: "generate tls cert", Args: NoExtraArgs, Run: func(cmd *cobra.Command, args []string) { log.Shared.Info("run generateTLSCert") generateTLSCert() }, }
GenTLS 生成 tls 证书
`go run -race cmd/main/main.go gentls --host 1.2.3.4`
注,RSA 证书没毛病,P256 的 ES 证书 Chrome 尚不支持 inspired by https://golang.org/src/crypto/tls/generate_cert.go
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.