linutil/xtask/src/main.rs
Adam Perkowski 01d571fc9e
📔 docs: auto generation (#784)
* remove contributing guidelines duplicate

`docs/contributing.md` is now auto generated

* Commit Contributing Guidelines

* core `xtask` functionality

* almost there

* write panic

* almost almost there

* there.

* remove empty descriptions

* better contributing.md comment

* Commit Contributing Guidelines

* remove entries without descriptions

---------

Co-authored-by: adamperkowski <adamperkowski@users.noreply.github.com>
2024-10-08 16:12:47 -05:00

41 lines
794 B
Rust

mod docgen;
mod path;
use std::{env, error::Error};
type DynError = Box<dyn Error>;
pub mod tasks {
use crate::docgen::USER_GUIDE;
use crate::docgen::{userguide, write};
use crate::DynError;
pub fn docgen() -> Result<(), DynError> {
write(USER_GUIDE, &userguide()?);
Ok(())
}
pub fn print_help() {
println!(
"
Usage: `cargo xtask <task>`
Tasks:
docgen: Generate Markdown files.
"
);
}
}
fn main() -> Result<(), DynError> {
let task = env::args().nth(1);
match task {
None => tasks::print_help(),
Some(t) => match t.as_str() {
"docgen" => tasks::docgen()?,
invalid => return Err(format!("Invalid task: {}", invalid).into()),
},
};
Ok(())
}