{"id":13611791,"url":"https://github.com/sagiegurari/shell2batch","last_synced_at":"2025-04-07T12:09:10.845Z","repository":{"id":57667217,"uuid":"107773293","full_name":"sagiegurari/shell2batch","owner":"sagiegurari","description":"Coverts simple basic shell scripts to windows batch scripts.","archived":false,"fork":false,"pushed_at":"2024-07-29T12:54:54.000Z","size":4203,"stargazers_count":57,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-15T04:26:53.709Z","etag":null,"topics":["batch-script","conversion","rust","rust-library","scripting","shell-script"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagiegurari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-21T11:04:56.000Z","updated_at":"2024-10-02T19:06:32.000Z","dependencies_parsed_at":"2024-01-13T17:44:06.177Z","dependency_job_id":"2133ace8-3581-4a2f-afcf-d201d9225c22","html_url":"https://github.com/sagiegurari/shell2batch","commit_stats":{"total_commits":115,"total_committers":5,"mean_commits":23.0,"dds":"0.10434782608695647","last_synced_commit":"7bd421bd5a90eea419160f8525bf7b0c9f7dd7ed"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fshell2batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fshell2batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fshell2batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fshell2batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagiegurari","download_url":"https://codeload.github.com/sagiegurari/shell2batch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648978,"owners_count":20972945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch-script","conversion","rust","rust-library","scripting","shell-script"],"created_at":"2024-08-01T19:02:08.618Z","updated_at":"2025-04-07T12:09:10.819Z","avatar_url":"https://github.com/sagiegurari.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# shell2batch\n\n[![crates.io](https://img.shields.io/crates/v/shell2batch.svg)](https://crates.io/crates/shell2batch) [![CI](https://github.com/sagiegurari/shell2batch/workflows/CI/badge.svg?branch=master)](https://github.com/sagiegurari/shell2batch/actions) [![codecov](https://codecov.io/gh/sagiegurari/shell2batch/branch/master/graph/badge.svg)](https://codecov.io/gh/sagiegurari/shell2batch)\u003cbr\u003e\n[![license](https://img.shields.io/crates/l/shell2batch.svg)](https://github.com/sagiegurari/shell2batch/blob/master/LICENSE) [![Libraries.io for GitHub](https://img.shields.io/librariesio/github/sagiegurari/shell2batch.svg)](https://libraries.io/cargo/shell2batch) [![Documentation](https://docs.rs/shell2batch/badge.svg)](https://docs.rs/crate/shell2batch/) [![downloads](https://img.shields.io/crates/d/shell2batch.svg)](https://crates.io/crates/shell2batch)\u003cbr\u003e\n[![Built with cargo-make](https://sagiegurari.github.io/cargo-make/assets/badges/cargo-make.svg)](https://sagiegurari.github.io/cargo-make)\n\n\u003e Coverts simple basic shell scripts to windows batch scripts.\n\n* [Overview](#overview)\n* [Usage](#usage)\n* [Installation](#installation)\n* [API Documentation](https://sagiegurari.github.io/shell2batch/)\n* [Contributing](.github/CONTRIBUTING.md)\n* [Release History](CHANGELOG.md)\n* [License](#license)\n\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\n## Overview\nWhile 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.\u003cbr\u003e\nThe original goal of this library is to provide users of [cargo-make](https://sagiegurari.github.io/cargo-make/) a way to write simple tasks with shell scripts without duplicating their code for each platform.\u003cbr\u003e\n\u003cbr\u003e\nIt is possible to provide custom conversion hints by using the **# shell2batch:** prefix (see below example).\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n## Usage\nSimply include the library and invoke the convert function as follows:\n\n\u003c!--{ \"examples/example.rs\" | lines: 3 | code: rust }--\u003e\n```rust\nfn main() {\n    let script = shell2batch::convert(\n        r#\"\n        set -x\n\n        export FILE1=file1\n        export FILE2=file2\n\n        #this is some test code\n        cp ${FILE1} $FILE2\n        cp -r ${DIR1} $DIR2\n\n        #another\n        mv file2 file3\n\n        export MY_DIR=directory\n\n        #flags are supported\n        rm -Rf ${MY_DIR}\n\n        unset MY_DIR\n\n        touch ./file3\n\n        #provide custom windows command for specific shell command\n        complex_bash_command --flag1 value2 # shell2batch: complex_windows_command /flag10 windows_value\n        \"#,\n    );\n\n    assert_eq!(\n        script,\n        r#\"\n@echo on\n\nset FILE1=file1\nset FILE2=file2\n\n@REM this is some test code\ncopy %FILE1% %FILE2%\nxcopy /E %DIR1% %DIR2%\n\n@REM another\nmove file2 file3\n\nset MY_DIR=directory\n\n@REM flags are supported\nrmdir /S /Q %MY_DIR%\n\nset MY_DIR=\n\ncopy /B .\\file3+,, .\\file3\n\n@REM provide custom windows command for specific shell command\ncomplex_windows_command /flag10 windows_value\n\"#\n    );\n\n    println!(\"Script: {}\", script);\n}\n```\n\u003c!--{ end }--\u003e\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n## Installation\nIn order to use this library, just add it as a dependency:\n\n```ini\n[dependencies]\nshell2batch = \"^0.4.5\"\n```\n\n## API Documentation\nSee full docs at: [API Docs](https://sagiegurari.github.io/shell2batch/)\n\n## Contributing\nSee [contributing guide](.github/CONTRIBUTING.md)\n\n\u003ca name=\"history\"\u003e\u003c/a\u003e\n## Release History\n\nSee [Changelog](CHANGELOG.md)\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\nDeveloped by Sagie Gur-Ari and licensed under the Apache 2 open source license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fshell2batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagiegurari%2Fshell2batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fshell2batch/lists"}