Reference

Complete listing of every flag, configuration key, frontmatter field, and exit code.

Invocation

writer <slug> [options]
writer --setup

The <slug> is required for all commands except --setup and --help. It must be lowercase letters, digits, and hyphens only, with no leading or trailing hyphens.

Flags

FlagWhat it does
--draftSets draft: true in frontmatter. Hugo omits draft posts from production builds.
--no-pushBuilds the site but skips git push.
--no-buildSkips the build step; only runs git commit and git push.
--tomlUses TOML frontmatter (+++ delimiters) instead of YAML (---).
--dry-runPrints the frontmatter that would be written and exits. No files are touched.
--section <name>Puts the post in a different content section for this run (e.g. notes, essays).
--ssg <name>Overrides the SSG for this run. Affects which defaults are applied.
--setupRuns the interactive setup wizard. No slug required.
-h, --helpPrints the help message and exits.

Config keys

Set via writer --setup or by editing ~/.config/writer/config directly. Project-local .writerrc overrides the global config.

KeyDefaultWhat it does
SSG hugo Which static site generator you use (hugo, eleventy, jekyll).
BUILD_CMD hugo --minify The exact shell command to build your site. Run after every confirmed post.
CONTENT_DIR content Directory that holds your posts, relative to the site root.
DEFAULT_SECTION posts Sub-directory inside CONTENT_DIR for new posts. Override per-run with --section.
DEFAULT_TAGS (blank) Comma-separated tags pre-filled at the tags prompt. Press Enter to accept, or type new tags to replace them.
BUNDLE_FORMAT true trueslug/index.md (page bundle). falseslug.md (flat file). Must be exactly true or false.
FRONTMATTER_FORMAT yaml yaml for --- delimiters. toml for +++ delimiters. Override per-run with --toml.
EDITOR micro Terminal editor binary. Any editor that accepts editor +N file.md works.
GIT_COMMIT_MSG new post: {slug} Commit message template. {slug} is replaced with the actual slug at runtime.
TIMEZONE auto auto uses the system timezone. Or set an IANA name: America/Winnipeg, Europe/London, UTC.
SITE_DIR (blank) Absolute path to your site root. Writer cds here before anything else. Leave blank to use the current directory.

Config file format

Both ~/.config/writer/config and .writerrc use a simple INI-style format: KEY=value, one per line. Comments start with # and can be inline. Blank lines are ignored.

# ~/.config/writer/config

SSG=hugo
BUILD_CMD=hugo --minify
CONTENT_DIR=content
DEFAULT_SECTION=posts
BUNDLE_FORMAT=true        # true = slug/index.md, false = slug.md
FRONTMATTER_FORMAT=yaml   # yaml or toml
EDITOR=micro
GIT_COMMIT_MSG=new post: {slug}
TIMEZONE=auto             # auto = system TZ; or e.g. America/Winnipeg
SITE_DIR=                 # blank = use current directory

Frontmatter output

YAML (default)

---
title: "On the Meaning of Home"
date: 2026-05-23T14:32:00-06:00
slug: "on-the-meaning-of-home"
tags:
  - place
  - memory
description: "A meditation on what it means to belong somewhere."
draft: false
---

TOML (--toml or FRONTMATTER_FORMAT=toml)

+++
title = "On the Meaning of Home"
date = 2026-05-23T14:32:00-06:00
slug = "on-the-meaning-of-home"
tags = ["place", "memory"]
description = "A meditation on what it means to belong somewhere."
draft = false
+++"

Fields with no value provided are omitted from the output entirely, not written as empty strings. The description field is only added after you close the editor, once you've had a chance to write it.

Slug validation rules

If the slug is invalid, writer prints a specific error explaining what's wrong and suggests a corrected version.

Exit codes

CodeMeaning
0Success
1Invalid slug, missing argument, missing dependency, or empty title
2File already exists and you chose not to overwrite it
3Build command failed (BUILD_CMD exited non-zero)
4Git step failed (git add, git commit, or git push)
5Config file has an unknown key or invalid value

Config loading order

  1. Hardcoded defaults (in lib/defaults.sh)
  2. Global config: ~/.config/writer/config
  3. Writer cds to SITE_DIR if set
  4. Project-local config: .writerrc in the current directory
  5. CLI flags: highest priority, override everything

Dependencies

ToolRequired forHow to get it
bash Running the script Already on every Mac and Linux. Bash 3.2+ supported (macOS default).
git Commit and push sudo apt install git / already on macOS
micro (or other editor) Opening the post for writing micro-editor.github.io: curl https://getmic.ro | bash
Hugo (or other SSG) Building the site gohugo.io/installation
date Post timestamps GNU date preferred; BSD date (macOS) also supported

Source & spec →   ← Guide