feat: add xshell

This commit is contained in:
2020-11-07 10:55:52 +08:00
parent 743c38725f
commit 47eb944308
4 changed files with 60 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ Simple Rust Tests
Project or files:
```
.
├── __concurrent
│   └── arc-swap
├── __crypto
│   ├── btc-address
│   ├── crypto
@@ -12,6 +14,7 @@ Project or files:
│   ├── pwhash
│   ├── random
│   ├── ring
│   ├── rsa
│   ├── secp256k1
│   └── totp
├── __database
@@ -20,6 +23,8 @@ Project or files:
├── __diff
│   ├── diffy
│   └── prettydiff
├── __enclave
│   └── virt_enclave
├── __err
│   ├── err_derive
│   └── quick_error
@@ -28,6 +33,8 @@ Project or files:
│   ├── cpp
│   ├── jni
│   └── live-reload-rust
├── __fs
│   └── fuse
├── __image
│   └── svg
├── __lang
@@ -36,6 +43,7 @@ Project or files:
│   ├── quickjs
│   └── sana
├── __linux
│   ├── notify
│   ├── psutil
│   └── sysinfo
├── __misc
@@ -45,6 +53,8 @@ Project or files:
│   ├── smartstring
│   └── walkdir
├── __network
│   ├── ip
│   ├── nfqueue
│   ├── tcp
│   └── udp_laminar
├── __search
@@ -56,6 +66,8 @@ Project or files:
│   ├── encoding
│   ├── flatbuffers
│   └── serde_json
├── __shell
│   └── xshell
├── __std
│   ├── async_await
│   ├── into
@@ -64,6 +76,7 @@ Project or files:
│   └── thread
├── __term
│   ├── colored_msg
│   ├── confy_table
│   ├── indicatif
│   └── term
├── __time
@@ -107,7 +120,7 @@ Project or files:
├── vec.rs
└── while.rs
79 directories, 26 files
92 directories, 26 files
```

23
__shell/xshell/Cargo.lock generated Normal file
View 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
View 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"

View 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(())
}