Crate shell2batch [] [src]

shell2batch

Coverts simple basic shell scripts to windows batch scripts.

While it is not really possible to take every shell script and automatically convert it to a windows batch file, this library provides a way to convert simple basic shell commands to windows batch commands.
The original goal of this library is to provide users of cargo-make a way to write simple tasks with shell scripts without duplicating their code for each platform.

Examples

extern crate shell2batch;

fn main() {
    let script = shell2batch::convert(
        r#"
        #this is some test code
        cp file1 file2

        #another
        mv file2 file3

        #flags are supported
        rm -Rf ./directory
        "#
    );

    assert_eq!(
        script,
        r#"
@REM this is some test code
xcopy file1 file2

@REM another
move file2 file3

@REM flags are supported
del /Q ./directory
"#
    );

    println!("Script: {}", script);
}

Installation

In order to use this library, just add it as a dependency:

[dependencies]
shell2batch = "*"

Contributing

See contributing guide

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.

Functions

convert

Converts the provided shell script and returns the windows batch script text.