licensectl 0.1.1

A CLI to fetch, store, and apply open-source license templates with interactive placeholder fill-in
licensectl-0.1.1 is not a library.

licensectl

A lightweight CLI to fetch, store, and apply open-source license templates.

Features

  • add — fetch a plain-text license from a URL and store it locally (with TLS via rustls, no native-tls/schannel)
  • Template conversion on import — [year]/<fullname>-style brackets in fetched text become {{year}}/{{fullname}} placeholders; bracketed text with spaces is confirmed first, then renamed (default: spaces → underscores)
  • list — show registered licenses and which placeholders each one needs
  • init — generate a LICENSE file in the current project, filling in placeholders interactively
  • delete — remove a license from the registry
  • Placeholders — templates using {{var}} are detected and prompted; empty input uses a sensible default when available
  • Safe defaults — {{year}} defaults to the current year; name-like placeholders (name, fullname, author, holder, owner, copyright) default to git config user.name
  • Overwrite protection — init and add prompt before replacing existing files; use --force to skip
  • Custom output path — write the license anywhere with -o; an existing directory target resolves to <dir>/LICENSE

Installation

cargo install licensectl

Usage

Add a license to the registry

licensectl add Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0.txt

Only URLs returning plain text are supported (HTML pages won't work). Bracket placeholders in the fetched text, such as [year] or <fullname>, are automatically converted to {{year}} / {{fullname}} templates. Bracketed text containing spaces (e.g. [name of copyright owner]) is confirmed with Is "[...]" a placeholder? [y/N]; if you accept, you can name it — the default replaces spaces with underscores (name_of_copyright_owner).

List registered licenses

licensectl list
MIT (needs: year, fullname)
Apache-2.0

Initialize a project with a license

licensectl init MIT

Placeholders are prompted interactively. Pressing Enter accepts the suggested default shown in brackets:

Value for "year" [2026]:
Value for "fullname" [Jane Doe]: ACME Corp

Write to a custom location or force-overwrite an existing file:

licensectl init MIT -o ../LICENSE
licensectl init MIT -f

Delete a license

licensectl delete MIT

How it works

Licenses are stored as plain text files under the platform config directory:

OS Location
Windows %APPDATA%\licensectl\licenses
macOS ~/Library/Application Support/licensectl/licenses
Linux $XDG_CONFIG_HOME/licensectl/licenses (or ~/.config/licensectl/licenses)

init reads the template, detects {{var}} placeholders, prompts for values, and writes the rendered result to ./LICENSE (or the -o path). License names must contain only letters, digits, ., _, and -.

Development

cargo build
cargo test
cargo clippy -- -D warnings
cargo fmt --check

License

MIT