Skip to content

Commit

Permalink
main: add aliases for flags and options
Browse files Browse the repository at this point in the history
Add --help and --version as aliases of -h and -v, respectively.

Also add short flags for other options.

Reported-by: Peter Sanchez <[email protected]>
Signed-off-by: Robin Jarry <[email protected]>
Tested-by: Bence Ferdinandy <[email protected]>
  • Loading branch information
rjarry committed Jun 28, 2024
1 parent 8e1f1dc commit c15c265
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
15 changes: 10 additions & 5 deletions doc/aerc.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,42 @@ aerc - a pretty good email client.

# SYNOPSIS

*aerc* [*-h*] [*-v*] [*-a* _<account>_] [*mailto:*_..._ | *:*_<command...>_ | *mbox:*_<file>_]
*aerc* [*-h*] [*-v*] [*-a* _<name>_] [*-C* _<file>_] [*-A* _<file>_] [*-B*
_<file>_] [*-I*] [*mailto:*_<...>_ | *mbox:*_<file>_ | :_<command...>_]

For a guided tutorial, use *:help tutorial* from aerc, or *man aerc-tutorial*
from your terminal.

# OPTIONS

*-h*
*-h*, *--help*
Show aerc usage help and exit.

*-v*
*-v*, *--version*
Print the installed version of aerc and exit.

*-a* _<account>_
*-a* _<name>_++
*--account* _<name>_
Load only the named account, as opposed to all configured accounts. It
can also be a comma separated list of names. This option may be
specified multiple times. The account order will be preserved.

*-C* _</path/to/aerc.conf>_++
*--aerc-conf* _</path/to/aerc.conf>_
Instead of using _$XDG_CONFIG_HOME/aerc/aerc.conf_ use the file at the
specified path for configuring aerc.

*-A* _</path/to/accounts.conf>_++
*--accounts-conf* _</path/to/accounts.conf>_
Instead of using _$XDG_CONFIG_HOME/aerc/accounts.conf_ use the file at the
specified path for configuring accounts.

*-B* _</path/to/binds.conf>_++
*--binds-conf* _</path/to/binds.conf>_
Instead of using _$XDG_CONFIG_HOME/aerc/binds.conf_ use the file at the
specified path for configuring binds.

*--no-ipc*
*-I*, *--no-ipc*
Run commands (*mailto:*_..._, *:*_<command...>_, *mbox:*_<file>_) directly
in this instance rather than over IPC in an existing aerc instance. Also
disable creation of an IPC server for subsequent aerc instances to
Expand Down
32 changes: 18 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ func buildInfo() string {
}

type Opts struct {
Help bool `opt:"-h" action:"ShowHelp"`
Version bool `opt:"-v" action:"ShowVersion"`
Accounts []string `opt:"-a" action:"ParseAccounts" metavar:"<account>"`
ConfAerc string `opt:"--aerc-conf"`
ConfAccounts string `opt:"--accounts-conf"`
ConfBinds string `opt:"--binds-conf"`
NoIPC bool `opt:"--no-ipc"`
Help bool `opt:"-h,--help" action:"ShowHelp"`
Version bool `opt:"-v,--version" action:"ShowVersion"`
Accounts []string `opt:"-a,--account" action:"ParseAccounts" metavar:"<name>"`
ConfAerc string `opt:"-C,--aerc-conf" metavar:"<file>"`
ConfAccounts string `opt:"-A,--accounts-conf" metavar:"<file>"`
ConfBinds string `opt:"-B,--binds-conf" metavar:"<file>"`
NoIPC bool `opt:"-I,--no-ipc"`
Command []string `opt:"..." required:"false" metavar:"mailto:<address> | mbox:<file> | :<command...>"`
}

Expand All @@ -113,16 +113,20 @@ Aerc is an email client for your terminal.
Options:
-h Show this help message and exit.
-v Print version information.
-a <account> Load only the named account, as opposed to all configured
-h, --help Show this help message and exit.
-v, --version Print version information.
-a <name>, --account <name>
Load only the named account, as opposed to all configured
accounts. It can also be a comma separated list of names.
This option may be specified multiple times. The account
order will be preserved.
--aerc-conf Path to configuration file to be used instead of the default.
--accounts-conf Path to configuration file to be used instead of the default.
--binds-conf Path to configuration file to be used instead of the default.
--no-ipc Run any commands in this aerc instance, and don't create a
-C <file>, --aerc-conf <file>
Path to configuration file to be used instead of the default.
-A <file>, --accounts-conf <file>
Path to configuration file to be used instead of the default.
-B <file>, --binds-conf <file>
Path to configuration file to be used instead of the default.
-I, --no-ipc Run any commands in this aerc instance, and don't create a
socket for other aerc instances to communicate with this one.
mailto:<address> Open the composer with the address(es) in the To field.
If aerc is already running, the composer is started in
Expand Down

0 comments on commit c15c265

Please sign in to comment.