Skip to content

nullputra/drip-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💦 drip-rs

Crates.io Crates.io versions Build status Build status license

Synopsis

drip-rs exec FILE_PATH [ARGS...]
drip-rs misc COMMAND [ARGS...]
drip-rs {-h|--help|help}
drip-rs {-V|--version}

Supported platforms

Windows and Linux

Install

Install with cargo install

$ cargo install drip-rs

Build from source

$ git clone https://github.com/nullputra/drip-rs
$ cd drip-rs
$ cargo build --release

Show version information

$ cargo install drip-rs
$ drip-rs -V
drip-rs 1.0.0

Examples

drip-rs -h

$ drip-rs -h
drip-rs 1.0.0
Nullputra <stdnlptr@gmail.com>
`drip-rs` executes code and runs tasks

USAGE:
    drip-rs.exe <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    exec    Execute code according to extension
    help    Print this message or the help of the given subcommand(s)
    misc    Run task(s)

drip-rs exec FILE_PATH [ARGS...]

$ 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 = { cmd = "py -3 $FILE_PATH", sh = "python3 $FILE_PATH" }

$ drip-rs exec tests/data/fft.py
[INFO] cmd: "python3 tests/data/fft.py"
[INFO] args: []
> python3 tests/data/fft.py
1 4 11 26 36 40 32

$ drip-rs exec tests/data/z-algorithm.cpp
[INFO] cmd: ["g++ -g -O2 -std=c++17 -W tests/data/z-algorithm.cpp -o tests/data/z-algorithm", "tests/data/z-algorithm"]
[INFO] 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-rs misc COMMAND [ARGS...]

$ cat drip.toml
symbol = ">"

[env_var]
COMMIT_MSG = "Fix src/main.rs"

[misc]
echo = "echo $0"
# When the contents of "cmd" and "sh" match,
# they can be specified together by "common".
echo_confirm = { common = "echo $0", confirm = true }
# This is equivalent to the following:
# echo_confirm = { cmd = "echo $0", sh = "echo $0", confirm = true }
echo2 = ["echo $0", "echo ${1}_$2"]
push = { common = [
    "git add --all",
    'git commit -m "$COMMIT_MSG"',
    "git push origin master",
], confirm = true }

$ drip-rs misc echo arg0
scrs: "echo arg0"
args: ["arg0"]
> echo arg0
arg0

$ drip-rs misc echo_confirm arg0
[INFO] cmd: "echo arg0"
[INFO] args: ["arg0"]
Continue? y
> echo arg0
arg0

$ drip-rs misc echo2 arg0 arg1 arg2
[INFO] cmd: ["echo arg0", "echo arg1_arg2"]
[INFO] args: ["arg0", "arg1", "arg2"]
> echo arg0
arg0
> echo arg1_arg2
arg1_arg2

$ drip-rs misc push
[INFO] cmd: ["git add --all", "git commit -m "Fix src/main.rs"", "git push origin master"]
[INFO] args: []
Continue? n
Error: Aborted

Debug

$ git clone https://github.com/nullputra/drip-rs
$ cd drip-rs
$ cargo run -- exec tests/data/fft.py
[INFO] cmd: "python3 tests/data/fft.py"
[INFO] args: []
> python3 tests/data/fft.py
1 4 11 26 36 40 32

Future outlook

  • I'd like to support linux as well.

References

License

Licensed under Creative Commons CC0 1.0 Universal Public Domain Dedication (no credit needed).