Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Coverts simple basic shell scripts to windows batch scripts.

License

NotificationsYou must be signed in to change notification settings

sagiegurari/shell2batch

Repository files navigation

crates.ioCIcodecov
licenseLibraries.io for GitHubDocumentationdownloads
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 ofcargo-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:

fnmain(){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 onset FILE1=file1set FILE2=file2@REM this is some test codecopy %FILE1% %FILE2%xcopy /E %DIR1% %DIR2%@REM anothermove file2 file3set MY_DIR=directory@REM flags are supportedrmdir /S /Q %MY_DIR%set MY_DIR=copy /B .\file3+,, .\file3@REM provide custom windows command for specific shell commandcomplex_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

Seecontributing guide

Release History

SeeChangelog

License

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

About

Coverts simple basic shell scripts to windows batch scripts.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp