### Command Line Interface

When starting TQSL, you may specify command line options that

- initiate the definition or editing of a Station Location
- initiate the signing of a log file
- direct that a signed log file be uploaded to LoTW via the internet

Most command line options are single-letter switches, some of which require an argument; such arguments should be separated from the switch letter by one or more spaces. Arguments that contain spaces or other shell-special characters should be quoted in a manner suitable for the operating system and shell that's being used. If more than one command line switch is specified, each switch must be separated from the preceding switch by one or more spaces.

A filename not preceded by a switch is assumed to be the name of a log file whose QSOs are to be signed.

After taking the actions specified by command line options, TQSL will enter its menu-driven mode of operation unless one of the `-q`, `-x` or `-n` switches are present, in which case it will terminate.

Option | Description
`-a` | The action to be taken if a duplicate, out-of-date-range, or invalid QSO is encountered while signing a log file's QSOs: `-a ask` a dialog will be provided that prompts the user to specify how to proceed `-a abort` no QSOs will be signed `-a compliant` neither duplicate QSO nor out-of-date-range QSOs will be signed; all other QSOs will be signed `-a all` all QSOs, including duplicates and out-of-date-range QSOs, will be signed If no `-a` switch is specified and a duplicate or out-of-date-range QSO is encountered while signing QSOs, a dialog will be provided that prompts the user to specify how to proceed.
`-b date` `-e date` | Specifies the beginning `(-b)`date of QSOs to be signed or the end date `(-e)` for QSOs to be signed. QSOs before the begin date or after the end date will not be signed. If these are used, `-d` should also be specified to suppress the QSO date-range dialog.
`-d` | Suppress the date-range dialog; if this switch is present, the QSO date-range dialog will not be displayed before signing a log.
`-h` | Display command line help.
`-i Filename` | Load a specified Callsign Certificate File (.tq6), a Certificate Container File (.p12), or a Configuration Data File (Config.tq6) .
`-l Station_Location` | Select a defined Station Location to be used when signing log files. If the specified Station Location contains embedded spaces, it must be quoted in a manner suitable for the operating system and shell that's being used. If the specified Station Location doesn't exist, no QSOs will be signed or uploaded unless `-s` is also specified. If `-l` is not present and a log file is being signed, a dialog will be provided that prompts the user to select a Station Location.
`-n` | Checks for and reports the availablility of a new version of TQSL a new version of TQSL's Configuration Data file expiring Callsign Certificates pending Callsign Certificates TQSL displays the above information (if any) to stderr, then exits without digitally signing any specified filename. This command line option should therefore not be used with any other command line option.
`-o Filename` | Specify the name of the digitally signed log file to be created. If the specified Filename contains embedded spaces, it must be quoted in a manner suitable for the operating system and shell that's being used. If `-o` is not present, the specified log filename with its extension set to `.tq8` will be used.
`-p Password` | Specify the password that gains access to a password-protected Callsign Certificate when signing a log file. If the specified Password contains embedded spaces or other shell-special characters, it must be quoted in a manner suitable for the operating system and shell that's being used. If `-p` is not present, a log file is being signed, and the specified or selected Station Location includes a password-protected Callsign Certificate, a dialog will be provided that prompts the user to specify the password.
`-q` | Operate in batch mode: status information will be routed to stderr, and TQSL will terminate after taking the actions specified by command line options.
`-s` | If the `-l` switch is also present, a dialog will be provided that enables the specified Station Location to be edited; otherwise, a dialog will be provided that enables a new Station Location to be defined.
`-t Filename` | Enable Diagnostic Mode and specify the name of the log file into which diagnostic information is written.
`-u` | Instead of saving the digitally signed log file, upload it to LoTW over the Internet. After processing, the uploaded file will be shown in LoTW's Your Activity list with the specified filename preceded by `<TQSLUpl YYYYMMDD-HHMM>`, where `YYYY` is the current year, `MM` is the current month, `DD` is the current day, `HH` is the current hour, and `MM` is the current minute.
`-v` | Display TQSL version information, and terminate.
`-x` | Operate in batch mode: status information will be routed to stderr, and TQSL will terminate after taking the actions specified by command line options.
`Filename` | A command line option that is not a single-letter switch or the argument associated with a single-letter switch will be considered the name of the ADIF or Cabrillo log file to be digitally signed using the specified or selected Station Location. If the specified Filename contains embedded spaces, it must be quoted in a manner suitable for the operating system and shell that's being used. If `-u` is present, the resulting signed log file will be uploaded to LoTW via the internet. Otherwise, the resulting signed log file will be saved in the Filename specified by the `-o` switch; if `-o` is not present, the resulting log file will be saved in the same directory as the log file using the `.tq8` extension, overwriting any existing `.tq8` file of the same name.

##### Invocation Examples:

Without displaying the QSO date-range dialog and ignoring duplicate QSOs, digitally sign the "`cqww log.adi`" log file using the "CQWW Portable" Station Location, upload the digitally signed log file to LoTW, route stderr to the file `results.txt` and then terminate:
`tqsl -d -u -a new -x -l "CQWW Portable" "cqww log.adi" 2>results.txt`

Edit the "Home" station location before beginning menu-driven operation:
`tqsl -l Home -s`

Add a station location, and then terminate:
`tqsl -s -x`

Check for new versions and expiring or pending Callsign Certificates, and then terminate:
`tqsl -n 2>news.txt`

##### Status Information

If invoked with `-q` or `-x`, status information will be routed to stderr. The last line of stderr will have the following format: `HH:MM:SS AM/PM Final Status: Description (Code)` where

- `HH:MM:SS AM/PM` is the timestamp
- `Description` is a textual summary the status that contains no left or right parenthesis
- `Code` is an integer uniquely identifying the status, as described in the following table

Code | Description
`0` | success: all qsos submitted were signed and saved or signed and uploaded
`1` | cancelled by user
`2` | rejected by LoTW
`3` | unexpected response from TQSL server
`4` | TQSL error
`5` | TQSLlib error
`6` | unable to open input file
`7` | unable to open output file
`8` | No QSOs were processed since some QSOs were duplicates or out of date range
`9` | Some QSOs were processed, and some QSOs were ignored because they were duplicates or out of date range
`10` | command syntax error
`11` | LoTW Connection error (no network or LoTW is unreachable)

##### Status Examples:

`05:57:39 PM: Warning: Signing cancelled`
`05:57:39 PM: No records output`
`05:57:39 PM: Final Status: cancelled by user (1)`

`06:05:56 PM: /home/rmurphy/k1mu.adi: 414 QSO records were duplicates`
`06:05:56 PM: /home/rmurphy/k1mu.adi: wrote 1 records to /home/rmurphy/k1mu.tq8`
`06:05:56 PM: /home/rmurphy/k1mu.tq8 is ready to be emailed or uploaded.`
`Note: TQSL assumes that this file will be uploaded to LoTW.`
`Resubmitting these QSOs will cause them to be reported as duplicates.`
`06:05:56 PM: Final Status: Some QSOs were duplicates or out of date range (9)`

`17:21:32 PM: /Signing using Callsign W4TV, DXCC Entity UNITED STATES OF AMERICA`
`17:21:32 PM: /Warning: Your custom mode map WSPR conflicts with the standard mode definition for WSPR and was deleted.`
`17:21:32 PM: /Attempting to upload 2 QSOs`
`17:21:33 PM: /C:\Program Files\LogsAreUs\LotWUpload.ADI: Log uploaded successfully with result "File queued for processing"!`
`17:21:33 PM: /After reading this message, you may close this program.`
`17:21:33 PM: /Final Status: Success (0)`

in response to `-n`
`17:21:32 PM: A new TQSL release (v2.0) is available.`
`17:21:32 PM: A new TrustedQSL configuration file (V2.4) is available.`
`17:21:32 PM: The certificate for VE6LB expires in 9 days.`
`17:21:33 PM: The certificate for VE6LB/A3 expires in 15 days.`
`17:21:33 PM: A Callsign Certificate for VE6LB/P5 is pending.`