(samizdat cli)

Reference

Overview

The command line of bjo sz, on the functions of (samizdat author).

;; .bjo/sz/main.bjo, which bjo sz writes for a project with an sz.bjo.
(import (std prelude))
(import (samizdat cli))
(import (only "../../sz.bjo" configure))

(defun (main args)
  (sz-main args configure))

bjo sz reads documents and writes them. Each command has its own help: bjo sz md --help.

bjo sz md FILE... [-o OUT] [--check]Markdown (GFM): each FILE.sz gives FILE.md beside it
bjo sz html FILE... [-o OUT] [--check]HTML pages. --fragment writes the body only. --css URL adds a stylesheet
bjo sz build [DIR] [--to md] [-o DIR]every .sz file below DIR, as HTML or Markdown
bjo sz check FILE...read the documents and run their commands. Write nothing
bjo sz outline FILE...the headings, with the id that @ref and a # link take
bjo sz links FILE... [--check]the links and images. --check shows only the broken ones
bjo sz deps FILE...the files the documents are made from, for a build tool
bjo sz tree FILEthe document after its commands ran, as s-expressions
bjo sz commandsthe commands that a document can use here

sz.bjo. A project adds its own commands and hooks with an sz.bjo in its root. It exports configure, a function from Setup to Setup. bjo sz gives it default-setup, and then applies the options of the command line. So an option overrides sz.bjo.

How it runs. bjo sz builds a program whose main calls sz-main, and runs it in the current directory. Without an sz.bjo, configure returns the setup it gets.

See also: sz-main

Reference

Functions

Functions

sz-main

function ↑ Functions

(: sz-main (-> (Vec string) (-> Setup Setup) int))
(sz-main args configure)

Parses the words of bjo sz and runs the command.

args
The words after sz.
configure
Makes the setup from default-setup. The options of the command line are applied after it.
returns
The exit code: 0 for success and for --help, 1 when a document has an error, an output is not up to date with --check, or a link is broken with links --check, and 2 for a wrong command line.
(sz-main ["md" "--check" "README.sz"] (fun (s) s))

The help goes to standard output. Each other message, and the error of a wrong command line, goes to standard error.

See also: Setup, default-setup