rhask 0.2.2

Rhai-based Task Runner.
Documentation
default_task("fzf");

task("fzf", || {
    description("choose and run a task via fzf (optionally scoped to a group)");
    args(#{
        group: ""
    });
    actions(|group| {
        let list_cmd = if group.is_empty() {
            "rhask list -F".to_string()
        } else {
            "rhask list -F ".to_string() + group
        };
        exec(
            list_cmd + " | fzf | awk '{print $1}' | xargs -r rhask run"
        );
    });
});

group("build_suite", || {
    description("Collection of build-related tasks");

    task("clean", || {
        description("Remove build artifacts");
        actions( || {
            exec("cargo clean");
            print("Cleanup completed");
        });
    });

    task("build", || {
        description("Build the project");
        actions( || {
            exec("cargo build");
            print("Build finished");
        });
    });

    task("test", || {
        description("Run tests");
        actions( || {
            exec("cargo test");
            print("Tests completed");
        });
    });

    task("fmt", || {
        description("Run rustfmt");
        actions( || {
            exec("cargo fmt");
            print("Formatting completed");
        });
    });

    task("clippy", || {
        description("Run clippy");
        actions( || {
            exec("cargo clippy");
            print("linting completed");
        });
    });

    task("dev", || {
        description("Execute common development tasks");
        actions( || {
            trigger("fmt");
            trigger("test");
            trigger("clippy");
            trigger("build");
            print("Development task collection finished");
        });
    });
});

group("coverage", || {
    description("Coverage measurement helpers");

    task("all", || {
        description("Run coverage for unit + integration tests");
        dir("./scripts");
        actions(|| {
            exec("./coverage.sh --mode all");
        });
    });

    task("unit", || {
        description("Run coverage for unit tests only");
        dir("./scripts");
        actions(|| {
            exec("./coverage.sh --mode unit");
        });
    });

    task("integration", || {
        description("Run coverage for integration tests only");
        dir("./scripts");
        actions(|| {
            exec("./coverage.sh --mode integration");
        });
    });
});

import "rhaskfile_demo";
import "rhaskfile_sample";