1 unstable release

0.1.0 Mar 5, 2024

#865 in Development tools

MIT license

23KB
235 lines

PRSM - Project Script Manager

Have you ever had a utils/ directory with a bunch of scripts you ran to manage your project? Format a suite of different files types? Run various linters in sequence, or if you find yourself so daring, in parallel? Keeping all these scripts together can be a hassle and you might find yourself wanting to use some form of a script manager, typically within the language the scripts are in. So, for instance, if you have a collection of Python scripts managing your project you may want to use a script manager written in Python.

This is what that is, but it's in Rust.


lib.rs:

PRSM - Project Script Manager

prsm (pronounced "prism") aims to speed up the process of writing simple project management CLI applications. It's common to have a custom suite of formatting, linting, and debugging scripts in separate shell/scripting files. However, for those interested in using Rust for these purposes, it can be daunting to set up their scripts compared to others who use simpler languages such as Python.

The intent of prsm is to reduce any and all complexity of setting up the script manager so you, the developer, can focus more time and energy into your management scripts. You're already using Rust rather than the simpler alternatives. Why introduce even more complexity into your life?

Using prsm is easy thanks to the prsm macro.

use prsm::prsm;

fn format() -> Result<(), std::io::Error> { Ok(()) }
fn lint() -> Result<(), std::io::Error> { Ok(()) }

let script_manager = prsm! {
    [1] "Format repository files" => format(),
    [2] "Lint Rust files" => lint()
};

script_manager.run();

Note that prsm is a library dedicated to abstracting away the setup process of a script manager. It is not interested in the explicit returns that you may have for your functions that manage your project. It's best to use stateless functions for prsm that do not have meaningful return values, as prsm will throw away any return value (other than errors, which are returned for debugging purposes).

No runtime deps