3.1 Command Line

The Python file counterpart.py implements most of the reference conversion for Counterpart.

This file can be run as a stand-alone command line utility to open a Texinfo web page URL in Emacs. In this way, Counterpart can also be used on a Linux system as this approach does not require macOS nor Safari.

Command Line Usage

The basic usage is to run counterpart with the --no-shortcut and -p (or --path) options:

$ python counterpart.py --no-shortcut -p '/snap/bin' <reference>

The above invocation will generate the translated <reference> to an Info node reference.

The file counterpart.py can be made executable by copying it to a directory in the PATH environment variable and turning on its file mode to executable via chmod. It is common to rename the file to have no suffix as well.

Command Line Help

Running counterpart with the -h or --help option will show its usage string.

usage: counterpart [-h] [-v] [-s | --shortcut | --no-shortcut] [-e | --execute | --no-execute] [-p PATH] [-t {scrim,info}] reference

Convert Texinfo web page reference to Info node.

positional arguments:
  reference             Either URL path or URL.

options:
  -h, --help            show this help message and exit
  -v, --version         print version information and exit
  -s, --shortcut, --no-shortcut
                        If set, run as if invoked via macOS Shortcut.
  -e, --execute, --no-execute
                        Open counterpart reference. Only valid when --no-shortcut is used.
  -p, --path PATH       Path to emacsclient. Only valid when --no-shortcut is used.
  -t, --target {scrim,info}
                        Target format. Only valid when --no-shortcut is used.

Examples

Here are some examples of running counterpart.

Write Info node reference to stdout from counterpart web page URL:

$ counterpart --no-shortcut -p '/snap/bin' 'https://kickingvegas.github.io/triode/Features.html'
(info "(triode) Features")

Write Info node reference to stdout from counterpart web page URL and open in Emacs via emacsclient:

$ counterpart --no-shortcut --execute -p '/snap/bin' 'https://kickingvegas.github.io/triode/Features.html'