feat: add xshell
This commit is contained in:
23
__shell/xshell/Cargo.lock
generated
Normal file
23
__shell/xshell/Cargo.lock
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "xshell"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"xshell 0.1.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xshell"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e9bbfccbb2233e6b0473b7870d4b0811a402e9e249a5e8394e768e5a5c9c37d"
|
||||
dependencies = [
|
||||
"xshell-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xshell-macros"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b94f1c632d730a1704b21dc551a4c74fbed713cfa59593708f94943548206134"
|
||||
12
__shell/xshell/Cargo.toml
Normal file
12
__shell/xshell/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "xshell"
|
||||
version = "0.1.0"
|
||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
xshell = "0.1"
|
||||
|
||||
|
||||
11
__shell/xshell/src/main.rs
Normal file
11
__shell/xshell/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use xshell::{cmd, read_file};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let name = "World";
|
||||
let output = cmd!("echo Hello {name}!").read()?;
|
||||
println!("{}", output);
|
||||
|
||||
let err = read_file("feeling-lucky.txt").unwrap_err();
|
||||
println!("cannot read file: {}", err);
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user