Skip to content

rivethorn/nuch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NUCH (NUxt Content Handler)

A small CLI to help manage Markdown content and associated images for Nuxt Content sites.

NUCH Icon

Static Badge

Crates.io Version

GitHub deployments

Quick start

You can install via cargo:

cargo install nuch

or you can install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rivethorn/nuch/releases/download/v1.0.1/nuch-installer.sh | sh

You can also donwload the binary from Releases

Build from source

  • Requirements: Rust toolchain (cargo), and system git on PATH.

  • Build and run:

# Build
cargo build --release

# Run (shows help)
cargo run -- --help

# Create a sample config (writes to XDG_CONFIG_HOME/nuch/config.toml or ~/.config/nuch/config.toml)
cargo run -- --config

Typical usage:

# Publish (interactive): selects a markdown file from your configured working dir
nuch publish

# Delete (interactive): select a published post to remove
nuch delete

Warning

The tool requires a valid config file at XDG_CONFIG_HOME/nuch/config.toml or ~/.config/nuch/config.toml.

Use --config to generate a sample.

Config file (TOML)

The config describes your working and publishing directories and optional image directories. Example sample written by --config:

[working]
files = "Documents/writings"
images = "Documents/writings/images"

[[collection]]
name = "writing"
files = "your-site/content"
images = "your-site/public/images"

[[collection]]
name = "blogs"
files = "your-site/content/blogs"
# images omitted — optional
  • working files (required): directory containing your drafts/ready-for-publish Markdown files.
  • working images (optional): directory holding images referenced by your working markdown.
  • collection name (required): unique name for the collection (e.g., "content", "writing").
  • collection files (required): your predefined collection directory, usually inside content directory (where published markdown should be copied).
  • collection images (optional): directory under the site where images are stored.

The tool validates that working and collections exist, and that working contains at least one .md file.

Development notes

  • Main modules:

    • src/config.rs — config parsing and validation
    • src/fs.rs — filesystem helpers (copy, backup, image matching)
    • src/publish.rs — publish/delete flows (interactive); includes test-only non-interactive helpers
    • src/git.rs — git wrapper helpers
    • src/ui.rs — user prompts & listing
  • Code style: Rust 2024 edition, uses clap for CLI and inquire for interactive prompts.

To-DO

  • Add support for other file formats.

Contributing

Open a PR or issue for bug fixes or feature ideas. Add tests for any changes that touch behavior.