diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-24 17:18:35 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-24 17:18:35 -0700 |
| commit | 22300a4ed7e0d36c2fd749df2e70ed3f3bfff1c7 (patch) | |
| tree | ee18d1b611804ec9ab379b75333191384ffdf78e /enc.go | |
| parent | Get rid of defaultOptions (diff) | |
| download | sym-22300a4ed7e0d36c2fd749df2e70ed3f3bfff1c7.tar.zst | |
Add in-tool documentation
Diffstat (limited to 'enc.go')
| -rw-r--r-- | enc.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 { |
