A declarative command definition framework that enables type-safe, cross-platform command-line tools with clean syntax.
- Declarative Syntax: Define command structures with clean, readable syntax
- Type Safety: Built-in type system with compile-time parameter validation
- Cross-Platform: Generate commands for Windows (batch/cmd) and Unix (bash/sh)
- Modular Design: Import and implement commands across modules for code reuse
- Smart Compilation: Automatically generate platform-specific implementations
// Define cat command
cmd cat {
showAll: bool // -A, --show-all
numberNonBlank: bool // -b, --number-nonblank
number: num // -n, --number
squeezeBlank: bool // -s, --squeeze-blank
showTabs: bool // -T, --show-tabs
showNonPrinting: bool // -v, --show-nonprinting
help: bool // --help
version: bool // --version
@Option("FILE")
files: str[]
}
cmd add {
cmd volume {
@Option("volumename")
volumename: str
@Option("provider")
provider: symbol
}
cmd alias {
@Option("aliasname")
aliasname: str
@Option("aliasvalue")
aliasvalue: str
}
}
// Implement Windows batch version of echo
impl bat.echo for bash.echo {
cmd off {
off() => $this null // do nothing
}
cmd on {
on() => $this null // do nothing
}
echo($super.help) => $this $this.to_str()
}
@hulo:build batch
- Generate Windows batch/cmd scripts@hulo:build bash
- Generate Unix bash/sh scripts
commands/
├── a/ # Commands starting with A
│ ├── add.hl
│ ├── arp.hl
│ └── ...
├── c/ # Commands starting with C
│ ├── cat.hl
│ ├── cls.hl
│ └── ...
├── e/ # Commands starting with E
│ ├── echo.impl.hl
│ ├── del.hl
│ └── ...
└── ...
- System Administration: Define cross-platform system management commands
- Development Tools: Create type-safe command-line utilities
- Automation Scripts: Generate portable script files
- Educational: Learn declarative command definition approaches
Issues and Pull Requests are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.