Skip to content

Latest commit

 

History

History
192 lines (154 loc) · 7.24 KB

cli.mdx

File metadata and controls

192 lines (154 loc) · 7.24 KB
title CLI reference
description Commands, flags, output modes, and defaults.

Command grammar

moji
moji <query> [flags]
moji get <query> [flags]
moji convert <input> [--to ttf|otf|woff2] [-o <output>] [--json]
moji inspect <input> [--json]
moji config [show]
moji cache clear
moji --version
moji --help

moji

When stdin and stdout are terminals, open the home TUI and wait for a font query. In a non-interactive process, print an actionable usage error instead of waiting for input.

moji <query>

Search enabled providers. When stdin and stdout are terminals, open the live TUI. Otherwise print a table. --json always prints structured output.

The results TUI keeps the query visible and presents every result as a source-bounded family candidate, including candidates that contain only one file. The Family, Files, Format, and Provider columns use one grid, and the Provider column shows only the provider name. enter opens the candidate and reveals its individual files. The family preview initially selects the highest-ranked file for each normalized weight and posture, so duplicate Bold files do not all enter a family download. a selects every file when needed; space toggles individual files. D downloads the current selection. The default order recommends the strongest match, while the other orders put the largest families or preferred formats first. Navigation and the current position remain in the footer. Provider details remain available from the Health screen instead of occupying settled results.

moji get <query>

Search, rank, select, and download. A trailing weight is parsed from the query. The phrases entire family and all weights select multiple files from the best family source.

moji convert <input>

Convert a local desktop font to WOFF2, or restore a WOFF2 font to the desktop format recorded inside it. Conversion runs entirely in the CLI. It does not load providers, use the result cache, or open the TUI.

moji convert Inter.ttf
moji convert Inter.otf --to woff2
moji convert Inter.woff2
moji convert Inter.woff2 --to otf -o build/Inter.otf

TTF and OTF inputs default to WOFF2. WOFF2 input defaults to TTF when it contains TrueType outlines and OTF when it contains CFF outlines. --to asserts an explicit target. Moji detects the source format from the file content, not its extension.

Source Target
TTF WOFF2
OTF WOFF2
WOFF2 containing TrueType outlines TTF
WOFF2 containing CFF outlines OTF

Moji changes the container flavor without converting glyph outlines. It rejects TTF-to-OTF, OTF-to-TTF, same-format conversions, font collections, and unsupported font formats.

Without --output, the converted file is written beside the input with the target extension. If the input already uses that extension despite containing a different format, Moji inserts .converted before the extension. Moji never replaces an existing destination. It writes and validates a temporary file before committing the completed output atomically. On Unix-like systems, the output inherits the input file's permission bits.

Plain output reports Converted: <path>. --json prints this stable object:

{
  "input": "Inter.ttf",
  "output": "Inter.woff2",
  "source_format": "ttf",
  "target_format": "woff2",
  "size": 12345,
  "sha256": "..."
}

moji inspect <input>

Read a local TTF, OTF, or WOFF2 font and report the Unicode scripts mapped by its character map. Inspection detects the source format from file content and does not load providers, use the result cache, or change the input file.

moji inspect Inter.ttf
moji inspect Inter.woff2 --json

Plain output includes the file identity, font family when present, glyph count, Unicode data version, and a table like this:

Script    Encoded  Assigned  Coverage
Arabic    471      1368      34.43%
Cyrillic  327      506       64.62%
Latin     1110     1481      74.95%

Encoded is the number of assigned characters in that script whose character map entry points to a glyph. Assigned comes from the Go toolchain's Unicode script tables. Coverage is Encoded / Assigned * 100. Scripts with zero encoded characters are omitted, so a missing script means zero coverage. The top-level encoded-character count includes every mapped Unicode scalar, including private-use characters that do not belong to a named script.

Inspection supports TTF, OTF, and WOFF2. It rejects font collections and the legacy WOFF1, dfont, PFB, and PFM formats. These formats need different character-map parsers, and PFM files contain metrics rather than glyphs.

moji config

Create the default config when missing, then open it with $EDITOR.

moji config show

Print effective configuration as JSON. The GitHub token is redacted.

moji cache clear

Delete cached provider responses and recreate the cache directory.

Flags

Flag Short Default Meaning
--format <list> -f config default Comma-separated otf, ttf, woff, woff2, dfont, pfb, or pfm
--weight <name> -w any Keep only a normalized font weight
--max <count> -n all in TUI / 10 output / 1 get Maximum results or downloads
--provider <list> all enabled Comma-separated github, getfonts, dafont, fontsquirrel, fontshare, registry, plugins, or websearch
--json off Print machine-readable JSON
--dry-run off Preview a get selection without downloading
--download-dir <path> -d ~/Downloads/moji Download destination
--verbose -v off Print provider failures, counts, and elapsed time
--debug off Print provider state and retry details
--no-cache off Bypass cached search results
--token-stdin off Read a GitHub token from standard input
--allow-insecure off Allow HTTP for a source you explicitly trust
--to <format> inferred convert only: target ttf, otf, or woff2
--output <path> -o beside input convert only: converted font output path
--help -h Show help and ignore other arguments
--version Print the installed Moji version

Flags may appear before or after query words. Values can use a separate argument or --flag=value.

TUI keys

Key Action
typed text Enter a query on the home screen
enter Start the home-screen search or open result details
up / k Select previous result
down / j Select next result
page up / page down Move by one visible page
home / g Select the first result
end / G Select the last result
space Toggle the active file in a family preview
a / n Select all files or clear the selection in a family preview
D Download selected result
/ Filter loaded results
f Cycle all, OTF, TTF, and WOFF2
o Cycle best-match, most-files, and preferred-format ordering
tab / H Open provider health
esc Close details or exit
q / Ctrl-C Exit

Standard streams

  • Search results and successful command output use stdout.
  • Diagnostics, verbose status, debug status, and errors use stderr.
  • Color is disabled when NO_COLOR is set or TERM=dumb.