# 💦 drip [![Version info](https://img.shields.io/crates/v/drip.svg)](https://crates.io/crates/drip) [![last-commit](https://img.shields.io/github/last-commit/nullputra/drip)](https://github.com/nullputra/drip/commits/master) [![license](https://img.shields.io/badge/license-CC0_1.0-blue)](https://github.com/nullputra/nlptr-lib/blob/master/LICENSE) ## Synopsis ```bat drip exec FILE_PATH [ARGS...] drip misc CMD [ARGS...] drip {-h|--help|help} drip {-V|--version} ``` ## Install ### Install from cargo ```bat $ cargo install drip ``` ### Build from source ```bat $ git clone https://github.com/nullputra/drip $ cd drip $ cargo build --release ``` ### Print version ```bat # cmd $ copy /y target\\release\\drip.exe . $ drip -V drip 1.0.2 # pwsh $ cp target\\release\\drip.exe . $ .\drip -V drip 1.0.2 ``` ## Examples ### `drip -h` ```bat # cmd(drip) or pwsh(.\drip) $ drip -h drip 1.0.2 Nullputra USAGE: drip.exe OPTIONS: -h, --help Print help information -V, --version Print version information SUBCOMMANDS: exec Execute scripts according to extension help Print this message or the help of the given subcommand(s) misc Running scripts independent of extension ``` ### `drip exec` ```bat # cmd(drip) or pwsh(.\drip) $ cat drip.toml symbol = ">" [exec] cpp = [ "g++ -g -O2 -std=c++17 -W $FILE_PATH -o $FILE_PATH_WITHOUT_EXT", "$FILE_PATH_WITHOUT_EXT", ] py = "py -3 $filePath" $ drip exec tests\data\fft.py scrs: "py -3 tests\data\fft.py" args: [] > py -3 tests\data\fft.py 1 4 11 26 36 40 32 $ drip exec tests\data\z-algorithm.cpp scrs: ["g++ -g -O2 -std=c++17 -W tests\data\z-algorithm.cpp -o tests\data\z-algorithm", "tests\data\z-algorithm"] args: [] > g++ -g -O2 -std=c++17 -W tests\data\z-algorithm.cpp -o tests\data\z-algorithm > tests\data\z-algorithm z-algorithm works ``` ### `drip misc` ```bat # cmd(drip) or pwsh(.\drip) $ cat drip.toml symbol = ">" [env_var] COMMIT_MSG = "Fix src\\main.rs" [misc] echo = "echo $0" echo_confirm = { scrs = "echo $0", confirm = true } echo2 = ["echo $0", "echo $1"] push = { scrs = [ "git add .", 'git commit -m "$COMMIT_MSG"', "git push origin master", ], confirm = true } $ drip misc echo arg0 scrs: "echo arg0" args: ["arg0"] > echo arg0 arg0 $ drip misc echo_confirm arg0 scrs: "echo arg0" args: ["arg0"] Continue? y > echo arg0 arg0 $ drip misc echo2 arg0 arg1 scrs: ["echo arg0", "echo arg1"] args: ["arg0", "arg1"] > echo arg0 arg0 > echo arg1 arg1 $ drip misc push scrs: ["git add --all", "git commit -m "Fix src\\main.rs"", "git push origin master"] args: [] Continue? n Error: Aborted ``` ## Debug ```bat # cmd or pwsh $ git clone https://github.com/nullputra/drip $ cd drip $ cargo run -- exec tests\data\fft.py scrs: "py -3 tests\data\fft.py" args: [] > py -3 tests\data\fft.py 1 4 11 26 36 40 32 ``` # Future Outlook I'd like to support ubuntu as well. ## Refs - [Command Line Apps in Rust](https://rust-cli.github.io/book) - [clap tutorial](https://docs.rs/clap/latest/clap/_derive/_tutorial/index.html) - [Recoverable Errors with Result](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html) - [TOML](https://toml.io/ja/) ## License Licensed under [CC0 1.0] (no credit needed). [cc0 1.0]: https://creativecommons.org/publicdomain/zero/1.0/deed.ja