slug/

directory
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT

README

Rugo Slug Module (External Module Example)

This example demonstrates how to create a custom Rugo module that wraps an external Go library — in this case, gosimple/slug for generating URL-friendly slugs from text.

Structure

slug/
  module/          # The Rugo module package (reusable by anyone)
    slug.go        # Module registration
    runtime.go     # Go runtime (struct + methods)
  custom-rugo/     # A custom Rugo binary that includes the slug module
    main.go        # Thin wrapper: stdlib + slug module
  example.rugo       # Example Rugo script using the slug module

Build & Run

cd custom-rugo
go build -o myrugo .
./myrugo ../example.rugo

How It Works

  1. module/ is a standard Rugo module — it calls modules.Register() in init() just like the built-in modules.
  2. custom-rugo/main.go imports the slug module alongside the standard Rugo modules, then calls cmd.Execute().
  3. The resulting binary is a full Rugo compiler with the slug module available for import "slug" in .rugo scripts.

Directories

Path Synopsis
Custom Rugo binary with the slug module.
Custom Rugo binary with the slug module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL