40个版本
0.4.5 | 2022年11月1日 |
---|---|
0.4.4 | 2022年2月6日 |
0.4.3 | 2021年11月19日 |
0.4.2 | 2019年9月28日 |
0.1.6 | 2017年11月3日 |
#166 in 文本处理
25,901每月下载量
在12个crates中使用(通过cargo-make)
1MB
853 行
包含(WOFF字体,400KB) docs/api/NanumBarunGothic.ttf.woff2,(WOFF字体,135KB) docs/api/FiraSans-Medium.woff2,(WOFF字体,130KB) docs/api/FiraSans-Regular.woff2,(WOFF字体,82KB) docs/api/SourceSerif4-Bold.ttf.woff2,(WOFF字体,77KB) docs/api/SourceSerif4-Regular.ttf.woff2,(WOFF字体,45KB) docs/api/SourceCodePro-It.ttf.woff2 等 3 个文件 更多信息。
shell2batch
将简单的基本shell脚本转换为Windows批处理脚本。
概述
虽然无法将每个shell脚本自动转换为Windows批处理文件,但此库提供了一种将简单的基本shell命令转换为Windows批处理命令的方法。
此库的原始目标是向cargo-make的用户提供一种使用shell脚本编写简单任务的方法,而无需在每个平台上重复代码。
可以通过使用 # shell2batch: 前缀提供自定义转换提示(见下例)。
用法
只需包含库并按以下方式调用转换函数
fn main() {
let script = shell2batch::convert(
r#"
set -x
export FILE1=file1
export FILE2=file2
#this is some test code
cp ${FILE1} $FILE2
cp -r ${DIR1} $DIR2
#another
mv file2 file3
export MY_DIR=directory
#flags are supported
rm -Rf ${MY_DIR}
unset MY_DIR
touch ./file3
#provide custom windows command for specific shell command
complex_bash_command --flag1 value2 # shell2batch: complex_windows_command /flag10 windows_value
"#,
);
assert_eq!(
script,
r#"
@echo on
set FILE1=file1
set FILE2=file2
@REM this is some test code
copy %FILE1% %FILE2%
xcopy /E %DIR1% %DIR2%
@REM another
move file2 file3
set MY_DIR=directory
@REM flags are supported
rmdir /S /Q %MY_DIR%
set MY_DIR=
copy /B .\file3+,, .\file3
@REM provide custom windows command for specific shell command
complex_windows_command /flag10 windows_value
"#
);
println!("Script: {}", script);
}
安装
要使用此库,只需将其添加为依赖项
[dependencies]
shell2batch = "^0.4.5"
API文档
请参阅完整文档:API文档
贡献
请参阅贡献指南
发行历史
请参阅变更日志
许可
由Sagie Gur-Ari开发,并受Apache 2开源许可协议的许可。
依赖项
~2.1–3MB
~53K SLoC