discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Stephen Gregoratto <dev@sgregoratto.me>
To: Ingo Schwarze <schwarze@usta.de>
Cc: Stephen Gregoratto <dev@sgregoratto.me>, discuss@mandoc.bsd.lv
Subject: Re: mdoc synopsis style for more than one mandatory, mutually exclusive options?
Date: Tue, 20 Jul 2021 14:10:38 +1000	[thread overview]
Message-ID: <20210720041038.3k5pt4q2r4lzlhec@BlackBox> (raw)
In-Reply-To: <20210720003457.GB7771@athene.usta.de>

Hi Ingo,

Thanks for your recommendations. The program I'm working on is an
implementation of age[1], a encryption program. It's supposed to act as
just another UNIX-style filter that just works™.

My implementation is different in that I'm not strictly following the
reference's style of arguments, as I find them too complicated for my
tastes. It commits the "sin" of arguments taking on different meanings
in different contexts. You make a good point about needless complexity,
and I've tried to structure my implementation to reduce this as much as
possible, mainly by using subcommands.


Here's the full synopsis of the previous scenario, in context:

  zage encrypt [-a] [-i file] [-o file] \
    -R recipient-file -I identity-file recipients ...
  zage encrypt [-a] [-i file] [-o file] -p

Here "recipients" are public keys, in two forms: age X25519 keys and
OpenSSH Ed25519 keys. They're short enough that it's reasonable to
expect users to paste them in as arguments. -R denotes files
containing these recipient types, one per line. This means that users
can pass their authorized_keys file, and encrypt to any ssh-ed25519 key
in said file. I kept going back and forth between having -R only
specified once or more than, but I decided to stick with the latter
since it leads to cute invocations like:

-R ~/.ssh/id_ed25519.pub -R <(curl -s https://github.com/ischwarze.keys)

-I is similar to -R, except it reads secret keys, and thus has to
compute the public key of each. This one is a holdover from the
reference implementation, and I'm not so sure about keeping it around.

-i and -o are the usual input and output files, defaulting to stdin/out
if not given. -a is for PEM/ASCII armour, and -p is a special case for
password encryption.

Hope that clears things up. I think I'll stick to your advice about
keeping the SYNOPSIS simple, and explain in detail later on (probably in
a subheading to keep things neat).

[1] https://age-encryption.org/v1
-- 
Stephen Gregoratto
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv


  reply	other threads:[~2021-07-20  4:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 22:48 Stephen Gregoratto
2021-07-20  0:34 ` Ingo Schwarze
2021-07-20  4:10   ` Stephen Gregoratto [this message]
2021-07-20 13:02     ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210720041038.3k5pt4q2r4lzlhec@BlackBox \
    --to=dev@sgregoratto.me \
    --cc=discuss@mandoc.bsd.lv \
    --cc=schwarze@usta.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).