All Projects → sagiegurari → shell2batch

sagiegurari / shell2batch

Licence: Apache-2.0 license
Coverts simple basic shell scripts to windows batch scripts.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to shell2batch

i2p-rs
Rust client library for interacting with I2P
Stars: ✭ 62 (+47.62%)
Mutual labels:  rust-library
vfin
🦈 GUI framework agnostic virtual DOM library
Stars: ✭ 17 (-59.52%)
Mutual labels:  rust-library
rust-phonenumber
Library for parsing, formatting and validating international phone numbers.
Stars: ✭ 99 (+135.71%)
Mutual labels:  rust-library
arangors
Easy to use rust driver for arangoDB
Stars: ✭ 120 (+185.71%)
Mutual labels:  rust-library
BAT FFMPEG
Batch script files for FFMPEG (Microsoft Windows and DOS, OS/2 🦄)
Stars: ✭ 104 (+147.62%)
Mutual labels:  batch-script
units
A run-time C++ library for working with units of measurement and conversions between them and with string representations of units and measurements
Stars: ✭ 114 (+171.43%)
Mutual labels:  conversion
cpc
Text calculator with support for units and conversion
Stars: ✭ 89 (+111.9%)
Mutual labels:  conversion
cvs2gitdump
python scripts which import cvs tree into git or subversion repository
Stars: ✭ 18 (-57.14%)
Mutual labels:  conversion
bank2ynab
Easily convert and import your bank's statements into YNAB. This project consolidates other conversion efforts into one universal tool.
Stars: ✭ 197 (+369.05%)
Mutual labels:  conversion
tentacle
A multiplexed p2p network framework that supports custom protocols
Stars: ✭ 41 (-2.38%)
Mutual labels:  rust-library
fp-units
An FP-oriented library to easily convert CSS units.
Stars: ✭ 18 (-57.14%)
Mutual labels:  conversion
Nebuchadnezzar
High Performance Key-Value Store
Stars: ✭ 49 (+16.67%)
Mutual labels:  rust-library
caffe weight converter
Caffe-to-Keras weight converter. Can also export weights as Numpy arrays for further processing.
Stars: ✭ 68 (+61.9%)
Mutual labels:  conversion
Awesome-Rust-MachineLearning
This repository is a list of machine learning libraries written in Rust. It's a compilation of GitHub repositories, blogs, books, movies, discussions, papers, etc. 🦀
Stars: ✭ 1,110 (+2542.86%)
Mutual labels:  rust-library
colorful
Make your terminal output colorful.
Stars: ✭ 43 (+2.38%)
Mutual labels:  rust-library
hidapi-rs
Rust bindings for the hidapi C library
Stars: ✭ 103 (+145.24%)
Mutual labels:  rust-library
contour-rs
Contour polygon creation in Rust (using marching squares algorithm)
Stars: ✭ 33 (-21.43%)
Mutual labels:  rust-library
codebreaker-rs
A Rust library to decrypt & encrypt any cheat code for CodeBreaker PS2
Stars: ✭ 18 (-57.14%)
Mutual labels:  rust-library
ghakuf
A Rust library for parsing/building SMF (Standard MIDI File).
Stars: ✭ 30 (-28.57%)
Mutual labels:  rust-library
twitter-stream-rs
A Rust library for listening on Twitter Streaming API.
Stars: ✭ 66 (+57.14%)
Mutual labels:  rust-library

shell2batch

crates.io CI codecov
license Libraries.io for GitHub Documentation downloads
Built with cargo-make

Coverts simple basic shell scripts to windows batch scripts.

Overview

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.

It is possible to provide custom conversion hints by using the # shell2batch: prefix (see below example).

Usage

Simply include the library and invoke the convert function as follows:

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);
}

Installation

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

[dependencies]
shell2batch = "^0.4.5"

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

See Changelog

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].