NAME

App::FuguWeb::CLI - subcommand dispatch for fuguweb

SYNOPSIS

use App::FuguWeb::CLI;

exit App::FuguWeb::CLI->run(@ARGV);

DESCRIPTION

Fugu::CLI parses the command line and dispatches. This class holds the command table, the global options, and one method for each command. Nothing here repeats a Getopt::Long block.

App::FuguWeb::CLI->run(@argv) returns the exit code. bin/fuguweb passes it straight to exit.

Before a command runs, the class applies the global options and loads the site description with App::FuguWeb::Config. A description that is absent or does not parse gives EXIT_CONFIG_ERROR and one message on standard error.

See fuguweb(1) for the user documentation of the subcommands.

GLOBAL OPTIONS

--project dir

The project root. Without it, the class walks up from the working directory to the first .fuguwebrc.

--quiet

Suppress informational output.

SUBCOMMANDS

build and clean take --out dir, which overrides the out_dir setting. init writes a starter description and is the one command that runs without one.

mint-key, import-key and promote-key write one key directory, and App::FuguWeb::Rotate holds the work. Each one takes a --purpose word and a --dir name. A description with one keys block needs no --dir, and one with several refuses a step without it. mint-key and import-key take a --type, which defaults to signify, and a --secret path. import-key also takes --file, the public key file that it publishes. promote-key takes --retiring, the private half of the key that retires.

mint-key makes a signify key or an openpgp key. An OpenPGP mint takes --email, the one user id of the key, and an optional --expires date of the form YYYY-MM-DD.

import-key publishes a key of every type, x509 included. An issuer makes a certificate, so no verb mints one: --file names one PEM certificate, and --secret names its unencrypted PEM private key.

One signify key of the directory is the root of trust, and its purpose word is root. Every step but two takes --signer, the private half of the current root. A root step takes one --bind stem=path for each key in force. The verbs are the commands that sign, so they are the commands that need signify(1), and the command of each other type: gpg(1) for an OpenPGP key and openssl(1) for a certificate. Each one exits EXIT_TOOL_MISSING without the command that its step needs.

A directory that publishes its first key holds no keys block, because such a block cannot load until a key block stands beside it. The first mint therefore takes --bootstrap and --org, and it can take --dir and --url. --dir defaults to keys for a description that holds no keys block, so the first mint of a whole site needs none. One commit carries the block and the key.

--bootstrap is the intent to make a key directory, and mint-key and import-key alone take it. A step without it refuses a --dir that no keys block names. Each key directory holds a root of trust of its own, so a mistyped --dir would otherwise publish a second root in silence.

EXIT CODES

The first five come from Fugu::CLI and mean the same in every Fugu tool. The rest belong to a site build.

0   EXIT_SUCCESS
1   EXIT_ERROR
2   EXIT_INVALID_ARGS
3   EXIT_CONFIG_ERROR
4   EXIT_RENDER_FAILED
5   EXIT_CHECK_FAILED
6   EXIT_TOOL_MISSING

A caller that builds in a container can thus tell a renderer that is not installed from a page that is malformed.

SEE ALSO

fuguweb(1), App::FuguWeb, App::FuguWeb::Config, Fugu::CLI

AUTHOR

Dick Olsson <hi@senzilla.io>