Virtomize/mail2most

"--version" option is misspelled in help text

Closed this issue · 3 comments

Describe the bug
executing "mail2most -h" informs the user that there is an options called "-version"
executing "mail2most -version" then does not produce a version string but outputs the "Usage" hints.

To Reproduce
Steps to reproduce the behavior:

  1. execute "mail2most -h"
  2. note that it says "-version" (one dash)

Expected behavior

  1. execute "mail2most -h"
  2. mail2most outputs help text mentioning "--version" (double dash)

Release version
v1.11.9

Architecture
linux amd64

Hi @mmartin-bbw thanks for opening this issue. I tested your issue with the following result:

$ bin/linux-amd64/mail2most -h
Usage of bin/linux-amd64/mail2most:
  -c string
        path to config file (default "conf/mail2most.conf")
  -version
        display mail2most version
$ bin/linux-amd64/mail2most -version
v1.11.9
$ bin/linux-amd64/mail2most --version
v1.11.9

so far everything looks fine both versions -version and --version work properly.

Upon re-resting I can confirm that both "-version" and "--version" do the same.
But mail2most expects PWD to be where it is installed, so the following works:
cd /opt/mail2most; ./mail2most --version
but the following does not:
cd /some/random/path; /opt/mail2most/mail2most --version
It is a minor inconvenience, but it tripped me up.

I updated the documentation:

[Unit]
Description=mail2most

[Service]
Type=simple
WorkingDirectory=/opt/mail2most
ExecStart=/opt/mail2most/mail2most -c /path/to/mail2most.conf
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target

to ensure using absolute path to config when using systemd.

The default value for -c is conf/mail2most.conf which is a relative path definition and interferes with the way systemd executes binaries.