Skip to content

The command line interface

Benjamin Seidenberg edited this page Feb 6, 2024 · 15 revisions

Getting started

This is a document on how to use Pat's command-line interface.

If you prefer, check out KM4ACK's excellent Youtube series Winlink on a Raspberry Pi.

Setting up your text editor

Pat's command-line interface relies heavily on using an external text editor. For users that are not that familiar with the unix command line environment, this can be challenging at first.

The application will invoke the default text editor for the operating system you are using, but this can be overridden by setting the EDITOR environment variable.

nano is a simple editor that is easy to get started with. It's the default on many Debian based Linux distributions. To set up nano as your default editor on Mac OS or Linux, simply run these two commands in your terminal:

echo 'export EDITOR=nano' >> ~/.profile
source ~/.profile

See howtogeek.com's beginners guide to nano to read more about how to use nano.

Configure

In v0.12 and later, Pat uses OS-specific best practice locations:

OS Location
Linux/Raspberry Pi /home/${user}/.config/pat
Mac /Users/${user}/Library/Application Support/pat
Windows C:\Users\${user}\AppData\Local\pat

Use pat env to see your directory locations.

To open the file in an editor, simply run the configure command:

pat configure

The configuration file is formatted as json.

To get "on the air" you'll first have to set up your callsign, maidenhead locator and secure login credentials. Look for the attributes mycall, locator and secure_login_password and set them appropriately.

If you are new to Winlink and do not have a password yet, do not worry, Winlink will create a new one when you connect the first time. Leave it blank for now, and once you get the new password, run configure again to set it. You MUST connect via telnet for the first time. The system will automatically send you a message with the password, which will be in the first message in your ~/.local/share/pat/mailbox/YOURCALL/in dir. You can read this with pat read or pat http. This password will be needed for future communications, so make sure you do configure it once this message is received.

Example:

{
  "mycall": "LA5NTA",
  "locator": "JP20qe",
  "secure_login_password": "MyPassword",
}

For more detailed documentation of the configuration file, see godocs.

Environment variables

As of v0.15.1 you can set and override individual config fields using environment variables. Following the same structure as the configuration file, the syntax is PAT_{field} and PAT_{field}_{subfield}. E.g. PAT_MYCALL=LA5NTA and PAT_ARDOP_ADDR=host:port.

ARDOP configuration

To configure ARDOP you'll need to locate the ardop section of the config file. It should look something like this:

"ardop": {
  "addr": "localhost:8515",
  "arq_bandwidth": {
    "Forced":false,
    "Max":500
  },
  "beacon_interval": 0,
  "cwid_enabled": true,
  "rig": "",
  "ptt_ctrl": false
},

If you are going to use an ARDOP TNC instance running on your local machine, this default config should be fine.

The arq_bandwidth parameters controls the bandwidth of a connection. See the documentation of your ARDOP TNC for more details on this topic.

If you need/want rig control (for PTT and QSY over CAT) you will have to define which rig (listed in hamlib_rigs) the application should use.

More in-depth documentation are available in the wiki pages ARDOP and Rig control.

Printing the help text

To print the help text for the application you can run pat help, which will provide you with an overview of all commands and options.

You can print detailed usage text for a command also. pat help connect will print detailed information on how the connect command should be used.

Composing a new email

To compose a new email, use the compose command:

pat compose

You will be prompted with some basic options before the editor opens and you can start to compose your message:

martinhpedersen@duo:~$ pat compose
From [LA5NTA]: (just hit ENTER to use the default value)
To: LA3QMA
Cc: LA4PM,LA7UM,LA5KTA
Subject: Postman Pat
Press ENTER to start composing the message body. _

When you are done editing the message, save (nano : ctrl+o followed by ENTER) and exit (nano: ctrl+x).

You will now be prompted to add attachments. If you have none, simply hit ENTER.. otherwise give the full path to the attachment.

The application will now print your newly composed message, which has been posted to your outbox (~/.local/share/pat/mailbox/YOURCALL/out).

To learn more about how messages are stored on your system, see The mailbox directory.

Sending your message

To send your message from the outbox, you must connect to an RMS. If you're connected to the internet, you can use the telnet alias that ships in config.json:

$ pat connect telnet
2020/04/27 09:59:56 Connecting to WL2K (telnet)...
2020/04/27 09:59:58 Connected to 52.1.178.80:8772 (tcp)
[WL2K-5.0-B2FWIHJM$]
;PQ: 23883765
CMS>
>FC EM RLXENF3IHPA4 258 217 0
Sending checksum 68
FS Y
Remote accepted RLXENF3IHPA4
Transmitting [Your message subject] [offset 0]
Your message subject: 100%
FF
>FQ
2020/04/27 09:59:59 Disconnected.

See pat help connect for constructing connection URLs for other radio transports.