About
The sprint crate provides the Shell struct which represents a shell
session in your library or CLI code and can be used for running commands:
Shell exposes its properties so you can easily
create a custom shell or modify an existing shell with
the settings you want.
The sprint crate also provides the sprint CLI which provides an easy way to
use the library directly from the command line in three modes:
CLI examples
$ sprint -h
Command runner
Usage: sprint [OPTIONS] [STRING]...
Arguments:
[STRING]... File(s) or command(s)
Options:
-s, --shell <STRING> Shell [default: "sh -c"]
-f, --fence <STRING> Fence [default: ```]
-i, --info <STRING> Info [default: text]
-p, --prompt <STRING> Prompt [default: "$ "]
-w, --watch <PATH> Watch files/directories and rerun command on change;
see also `-d` option
-d, --debounce <SECONDS> Debounce; used only with `-w` [default: 5.0]
-C, --color <COLOR> Force enable/disable terminal colors [default: auto]
[possible values: auto, always, never]
-h, --help Print help
-V, --version Print version
Run command(s) given as arguments
$ sprint ls
```text
$ ls
Cargo.lock
Cargo.toml
CHANGELOG.md
Makefile.md
README.md
src
t
target
tests
```
Run interactively

Run in watch mode
Run a command, watch one or more file or directory paths for changes, kill the command if it is still running, and rerun the command.
Watch mode is similar to cargo-watch, watchexec, inotifywait, and other utilities except
these misfire on events that don't actually modify a file's contents; sprint only runs if a
watched file's contents are modified, or a file or directory is created or deleted in a watched
directory.
If a command is not provided, sprint simply reports actionable changes.
A .gitignore file in the current directory is used to ignore files unless given explicitly by a
-w option.
Use the -d option to modify the debounce time used to ignore subsequent events.
$ sprint -w src 'cargo build'
```text
$ cargo build
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
```
* Modified: `src/bin/sprint.rs`
```text
$ cargo build
Compiling sprint v0.9.0 (/home/qtfkwk/github.com/qtfkwk/sprint)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.96s
...
Library examples
Run command(s) and show the output
use *;
let shell = default;
shell.run;
// or equivalently:
//shell.run_str(&["ls", "ls -l"]);
Run command(s) and return the output
use *;
let shell = default;
let results = shell.run;
assert_eq!;
Customize
use *;
let shell = Shell ;
shell.run;
Modify
use *;
let mut shell = default;
shell.shell = None;
shell.run;
shell.sync = false;
shell.run;
Changelog
Please find the CHANGELOG.md in the repository.