This is just a draft of an idea I had for a CLI Mastodon client. It’s by no means an actual spec, more just a list of options hinting at behavior. It’s meant to be inspired a bit by less, a bit by ed, with a hint of git-remote semantics.
- mtd (Short for MasToDon client)
- General Options
These may be set in the general config.
- -n <int>
- Set the frame size for the current session, causing each browsing command to show <int> many toots at a time. This is set before moving the frame as requested, and anchors against a specific edge depending on the action. When moving the frame to newer toots, it anchors against the frame’s new edge, and when moving to older toots, it anchors against the frame’s old edge. Applicable to
tail
,previous
,next
,redisplay
. - -a <acct>
- Use <acct>. This means different things depending on the action:
- When doing a read or login operation
- If unspecified, read from all added accounts. If given one or more times, read from all of the given accounts together. In this case, it may be given alongside
--interaction
. - When doing a write or interaction
- Set the account used for interaction. In this context, it overrides what would be inferred or what had been set from
--interaction
.
- –interaction <acct>
- Applicable only for login operations. Use <acct> as the default account for interaction. This is sometimes optional: If the session is limited to one account (or only one account has been added), it will be used by inference for interaction. Otherwise, if unspecified and not inferrable, interaction commands will raise errors.
- –net-timeout <decimal>
- Set the timeout in seconds for basic network actions. Ones that are expected to take longer will be given a multiple of this amount. Applicable to
signin
,tail
,next
. - –undo-period <decimal>
- Set the number of seconds before write actions will be committed and sent out to your instance.
- add <acct-nickname> <masto.example.com> <[email protected]>
- Log in to the specified site, with the given username (usually an email address used to sign up). Save the credential token under the give account nickname for later use.
- signin|login
- Open a new session (‘tab’) for browsing. Further commands from the current tty-like device will go through this tab. Spawn a background process to eagerly fetch and cache posts. This background process will stay alive as long as you continue to use mtd commands, but will exit after one minute of inactivity.
- General options set the default for all applicable commands in the current session.
- -a <acct>
- (Optional) Show only toots from this account (default all or as-configured). Specify multiple times to browse from multiple accounts. Affects the default account for interaction.
- –interactive|-i
- Begin an interactive session of mtd. Instead of rigging up further calls to
mtd
in the current terminal screen, begin a shell-like interface. Any regularmtd ...
command can be given, but with themtd
part implied.
- signout|logout
- End the login session for this tty, and quit the background process.
- i[nteractive]
- Shortcut for
mtd signin --interactive
. - kill
- Same as logout, but start by sending the background process a kill -9.
- tail
- Move the frame to the newest toots, and display it. This triggers a sync from the server if the background process is not already streaming.
- -f
- Keep streaming new toots onto the terminal, and keep the frame slid to latest. Use C-c to exit.
- p[rev[ious]]
- Move the frame to the next-older range of toots, and display it.
- n[ext]
- Move the frame to the next-newer range of toots, and display it. As with tail, if this runs up against the newest loaded toots, it will cause a refresh before displaying.
- (l|redisplay)
- Redisplay the current frame. (Lowercase L is chosen as the mnemonic because of its use in interactive terminal programs as a command to redraw the screen.)
- -n
- If used, in this context anchors against the frame’s new-edge.
- c[ompose]
- Compose a new toot. This will open a template in your
$EDITOR
. You’ll write your toot at the top of the file, and specify metadata options in email-like headers below that.- -a <acct>
- Compose from the given account. If not specified, will use the default account for interaction.
- –re <id>
- Reply to toot number <id> as listed in the last-displayed frame.
- re[ply] <id>
- Shortcut for
mtd compose --re <id>
. - b[oost] <id>
- Boost toot number <id>
- f|fave|favo[u]rite|like <id>
- Favorite toot number <id>
- redraft <id> <compose options>
-
- Copy out the contents of toot <id>, then delete it. For obvious reasons, this always uses the account the toot was posted from, and you must have already added this account to mtd. This step is performed immediately and is not undo-able.
- Compose a new toot, just as running
mtd compose <compose options>
, but prepopulate it with the old toot’s contents. The following options are preserved from the old toot, unless you override them:- -a
- Account to post from
- –re
- Toot to reply to. Pass the empty string to convert the old post to a non-reply.
- delete|rm <id>
- Delete toot <id>. Will save the contents of the toot in the current session. After the undo period has expired, if the very next command is
undo
, the compose interface will be relaunched, akin to a redraft.- –now
- Delete immediately; effectively set
--undo-period
to 0.
- undo|abort
- If run within the undo period, cancel the last-given write or interaction command.
- General Options
I have no real intention of implementing this client at all, and thus release all of the above ideas—to the extent to which I came up with them—into the public domain.