From 22300a4ed7e0d36c2fd749df2e70ed3f3bfff1c7 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Fri, 24 Oct 2025 17:18:35 -0700 Subject: Add in-tool documentation --- enc.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'enc.go') diff --git a/enc.go b/enc.go index 1217606..fc54756 100644 --- a/enc.go +++ b/enc.go @@ -23,6 +23,21 @@ func (f *encryptFlags) registerFlags(fs *flag.FlagSet) { fs.BoolVar(&f.generatePassword, "g", false, "generate a secure password automatically (password will be printed to stderr)") fs.StringVar(&f.password, "p", "", "use the specified password; if not provided, enc will prompt for a password") fs.BoolVar(&f.force, "f", false, "overwrite output files even if they already exist") + fs.Usage = func() { + fmt.Fprintf(fs.Output(), `usage: %s [OPTION]... [FILE]... +Encrypt files, or stdin if no files are provided. + +`, + fs.Name()) + fs.PrintDefaults() + fmt.Fprintf(fs.Output(), ` +One of -g or -p must be used when reading from stdin. When encrypting to +stdout, consider redirecting the result since binary output can mess up +your terminal. Example: + echo test | %s -p 'my super secure password' | base64 +`, + fs.Name()) + } } type encryptOptions struct { -- cgit v1.3.1