diff --git a/README.md b/README.md index d5cbc27..c8cbda1 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,33 @@ into the Rust code. Documentation of specific syntax features of husht will be added as they are implemented. + +## Usage + +`husht [options] [sources]` + +Transforms some files from husht to Rust. The source specification `sources` +is a list of files, directories or glob patterns, defaulting to `.`. A +directory `dir` is interpreted the same way as the glob pattern `dir/**` -- +in other words, all files recursively within that directory. Glob patterns +are matched and all matching files are added to the list of files to process. +All files in the output directory are ignored. Files that do not have +extension `.toml` or `.hsh` are ignored. The former are copied unchanged; +the latter are transformed per the husht language specification into +Rust `.rs` files. + +Options: + - -h, --help -- Print a usage summary and exit + - --out-dir [dir] -- Specifies the output directory of the transformed + file(s), defaulting to `rust`. The transform of each source file is + written into the output directory, preserving its relative path to its + "root". The root of a file added by virtue of a glob is the top level + directory of that glob pattern, or the current directory if none. + The root of a file specified explicitly is the current directory. + +For example, if the `src` directory contains `main.hsh`, `sub/crate.hsh`, and +`Cargo.toml` (and there are no other .hsh or .toml files in the directory +tree), then `husht src` would write `rust/main.rs`, `rust/sub/crate.rs`, and +`rust/Cargo.toml`. On the other hand just `husht`, defaulting to `husht .`, +would write `rust/src/main.rs`, `rust/src/sub/crate.rs`, and +`rust/src/Cargo.toml`.