summaryrefslogtreecommitdiffstats
path: root/vendor/xshell/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/xshell/README.md
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/xshell/README.md')
-rw-r--r--vendor/xshell/README.md39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/xshell/README.md b/vendor/xshell/README.md
new file mode 100644
index 000000000..36026cb10
--- /dev/null
+++ b/vendor/xshell/README.md
@@ -0,0 +1,39 @@
+# xshell: Making Rust a Better Bash
+
+`xshell` provides a set of cross-platform utilities for writing cross-platform
+and ergonomic "bash" scripts.
+
+## Example
+
+```rust
+//! Clones a git repository and publishes it to crates.io.
+use xshell::{cmd, Shell};
+
+fn main() -> anyhow::Result<()> {
+ let sh = Shell::new()?;
+
+ let user = "matklad";
+ let repo = "xshell";
+ cmd!(sh, "git clone https://github.com/{user}/{repo}.git").run()?;
+ sh.change_dir(repo);
+
+ let test_args = ["-Zunstable-options", "--report-time"];
+ cmd!(sh, "cargo test -- {test_args...}").run()?;
+
+ let manifest = sh.read_file("Cargo.toml")?;
+ let version = manifest
+ .split_once("version = \"")
+ .and_then(|it| it.1.split_once('\"'))
+ .map(|it| it.0)
+ .ok_or_else(|| anyhow::format_err!("can't find version field in the manifest"))?;
+
+ cmd!(sh, "git tag {version}").run()?;
+
+ let dry_run = if sh.var("CI").is_ok() { None } else { Some("--dry-run") };
+ cmd!(sh, "cargo publish {dry_run...}").run()?;
+
+ Ok(())
+}
+```
+
+See [the docs](https://docs.rs/xshell) for more.