Crates.io | shell-rs |
lib.rs | shell-rs |
version | 0.2.6 |
source | src |
created_at | 2019-08-22 15:19:15.200115 |
updated_at | 2022-07-13 01:35:40.435877 |
description | Rust reimplementation of common coreutils APIs |
homepage | https://github.com/xushaohua/shell-rs |
repository | https://github.com/xushaohua/shell-rs |
max_upload_size | |
id | 158894 |
size | 821,488 |
shell-rs is rust reimplementation of common coreutils APIs.
Add this to Cargo.toml
:
[dependencies]
shell-rs = "0.2"
Add this to your crate:
extern crate shell_rs;
Make directories recursively:
use shell_rs::{mkdir, MkDirOptions};
let mut options = MkDirOptions::new();
options.recursive = true;
options.mode = 0o700;
let ret = mkdir("/tmp/test1/test2", &options);
assert_eq!(ret, Ok(()));
Expand environment variables:
use shell_rs::expand_env;
let s = expand_env("${PWD}/a/$HOME/c.txt");
let pwd = std::env::current_dir().unwrap();
let home = std::env::home_dir().unwrap();
let s2 = format!(
"{}/a/{}/c.txt",
pwd.to_str().unwrap(),
home.to_str().unwrap()
);
assert_eq!(s, s2);
coreutils, cross-platform Rust rewrite of the GNU coreutils
fs_extra, expanding opportunities standard library std::fs and std::io
This library is release in Apache License.