### 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
- initiate the display and editing of an ADIF 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 unless the Open ADIF files in ADIF editor box is checked, the named file has an .ADI extension, and the command line includes neither a -q or -x switch, in which case the named log file will be displayed in TQSL's ADIF Editor.

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 already uploaded, 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 already uploaded QSO nor out-of-date-range QSOs will be signed; all other QSOs will be signed `-a all` all QSOs, including already uploaded and out-of-date-range QSOs, will be signed If no `-a` switch is specified and a already uploaded 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.
`-c Callsign` | If present, specifies the Callsign Certificate to be used when signing log files, overriding any Callsign Certificate specified in the Station Location selected by `-l`. If the specified Callsign Certificate's DXCC entity does not match the DXCC entity specified in the Station Location selected by `-l`, an error message will be displayed and no QSOs will be signed.
`-d` | Suppress the date-range dialog; if this switch is present, the QSO date-range dialog will not be displayed before signing a log.
`-f` | This option instructs tqsl how to handle the MY_ fields in an ADIF log file. These specify the callsign, QTH details such as zones, gridsquare, state/county, etc. for a QSO. If the log includes this detail, TQSL can read these fields and take action to use that information to ensure that the Station Location is correct. By default, TQSL will report any discrepancies between QTH and the Station Location; TQSL can also be directed to ignore the QTH information. `-f ignore Directs TQSL to ignore the QTH information `-f report Directs TQSL to report any differences between the station location and the MY_ QTH details -f update Directs TQSL to overwrite the Station Location information with data from the log. When using "-f update", the ideal practice should be to either specify all QTH information (state, county, grid, zones) in the ADIF "MY_" fields or to use an empty Station Location.``
`-h` | Display command line help.
`-i Filename` | Load a specified Callsign Certificate File (.tq6), a Certificate Container File (.p12), a Configuration Data File (Config.tq6), or a TQSL Backup File (tqslconfig.tbk) .
`-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 Passphrase` | Specify the passphrase that gains access to a passphrase-protected Callsign Certificate when signing a log file. If the specified Passphrase 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 passphrase-protected Callsign Certificate, a dialog will be provided that prompts the user to specify the passphrase.
`-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. If the Open ADIF files in ADIF editor box is checked, if the named file has an .ADI extension, and if the command line includes neither a -q or -x switch, then the named log file will be displayed in TQSL's ADIF Editor rather than signed.

##### Invocation Examples:

Without displaying the QSO date-range dialog and ignoring already uploaded 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 compliant -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`

Display the "`cqww log.adi`" log file in TQSL's ADIF Editor:

`tqsl "cqww log.adi"`

- Note that the Open ADIF files in ADIF editor box must be checked; otherwise, the "`cqww log.adi`" log file will be digitally signed.

Check for new versions and expiring or pending Callsign Certificates, and then terminate:

`tqsl -n 2>news.txt`

Note that in the above examples, the redirection of stderr is performed by the Command Processor, not by TQSL."

##### 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 already uploaded or out of date range
`9` | Some QSOs were processed, and some QSOs were ignored because they were already uploaded or out of date range
`10` | command syntax error
`11` | LoTW Connection error (no network or LoTW is unreachable)
`12` | Unknown Error
`13` | When siging a log, the TQSL upload tracking database was locked
`14` | Some QSOs in a log being signed were already uploaded
`15` | When importing a P12 file on the command line, an invalid passphrase was given

##### 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 already uploaded`
`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 already uploaded.`
`06:05:56 PM: Final Status: Some QSOs were already uploaded 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.`