Skip to content

Command Line Interface

David Foster edited this page Mar 1, 2023 · 3 revisions

The Crystal program is normally started by opening it from macOS Finder or Windows Explorer. However you can also run it from macOS Terminal or Windows Command Prompt. This can be useful to control Crystal from automated scripts (via the --shell option) or to use features that are only available on the command line (like --cookie).

Accessing the CLI

Source

The most straightforward way to access the command line interface is to do so when building Crystal from source:

git clone [email protected]:davidfstr/Crystal-Web-Archiver.git
cd Crystal-Web-Archiver
poetry install

Once Crystal is built, you can run the command line using:

poetry run crystal --help

You should then see usage information.

macOS Binary

To access Crystal's command line interface on macOS, assuming Crystal is installed in /Applications, open the Terminal app and run:

$ "/Applications/Crystal Web Archiver.app/Contents/MacOS/Crystal Web Archiver" --help

You should then see usage information.

Windows Binary

The command line on Windows can only be accessed in a non-interactive fashion. To pass command line arguments you need to create an "arguments.txt" file in the same directory as the "Crystal Web Archiver.exe" with the arguments you want.

For example if Crystal is installed at C:\Program Files (x86)\Crystal Web Archiver use Notepad to create an arguments.txt file in the same directory containing:

--help

Then when you open "Crystal Web Archiver.exe" it will launch, print the usage information to the Windows log files stdout.txt and stderr.txt at C:\Users\davidf\AppData\Local\DaFoster\Crystal Web Archiver\Logs, and exit.

Usage

usage: crystal [-h] [--shell] [--serve] [--cookie COOKIE] [--readonly] [--test] [filepath]

positional arguments:
  filepath         Optional. Path to a *.crystalproj to open.

optional arguments:
  -h, --help       show this help message and exit
  --shell          Start a CLI shell after opening a project.
  --serve          Start serving the project immediately.
  --cookie COOKIE  HTTP Cookie header value when downloading resources.
  --readonly       Whether to open the project as read-only.
  --test           Run automated tests.
Clone this wiki locally