GithubHelp home page GithubHelp logo

shenmo7192 / bash-to-powershell-converter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nyabkun/bash-to-powershell-converter

0.0 0.0 0.0 15 KB

Converts bash script to powershell script.

JavaScript 40.72% PowerShell 33.19% Shell 26.10%

bash-to-powershell-converter's Introduction

Bash to Powershell Converter

A node.js script that converts bash to powershell.

Only simple things like imports and aliases are supported.

It is a simple script using regular expressions, so feel free to fork it and modify it as you wish.

node bash2pwsh.js .\You-can-test-with-this-bash-script\.bash_profile bash_profile.ps1

.bash_profile [Before]

## Util

function pipe() {
  local outfile=~/pipe.md
  $@ >& $outfile
  code $outfile
}

## App

alias play_mpc_be='C:/App/MediaPlayerClassic-BE/mpc-be64.exe'
alias code='C:/Dev/VSCode/Code.exe'

## Dir

export d_diary='C:/Ws/diary'
export d_ws='C:/Ws'
export d_App='C:/App'
export d_AppInst='C:/AppInst'
export d_Dev='C:/Dev'

alias cd_diary="cd $d_diary"
alias cd_ws="cd $d_ws"
alias cd_App="cd $d_App"
alias cd_AppInst="cd $d_AppInst"
alias cd_Dev="cd $d_Dev"

## Util Alias

alias la='ls -a'
alias ll='ls -al'
alias exp_open_here='explorer .'

## Git Alias

alias git_hist='git log --oneline --graph --decorate --all'
alias git_com='git commit --allow-empty-message --no-edit'
alias git_conf_global='git config --global --edit'
alias git_conf_local='git config --edit'
function git_add_com_push() {
 git add -A
  git commit --allow-empty-message --no-edit
  git push
}

## Edit

function edit_alias(){
  code ~/.alias.zsh
}
function edit_alias_sh_only(){
  code ~/.alias-sh.zsh
}
function edit_zshrc() {
  code ~/.zshrc
}
function edit_pwsh_profile(){
  code C:/Users/owner/Documents/PowerShell/Microsoft.PowerShell_profile.ps1
}

## Env
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfg
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/share/pkgconfig

>>>

bash_profile.ps1 [After]

## Util

function pipe() {
  local outfile=C:/msys64/home/owner/pipe.md
  $args | Out-File -FilePath $outfile
  code $outfile
}

## App

Set-Alias -Name play_mpc_be -Value 'C:/App/MediaPlayerClassic-BE/mpc-be64.exe'
Set-Alias -Name code -Value 'C:/Dev/VSCode/Code.exe'

## Dir

$d_diary='C:/Ws/diary'
$d_ws='C:/Ws'
$d_App='C:/App'
$d_AppInst='C:/AppInst'
$d_Dev='C:/Dev'

function cd_diary() { cd $d_diary }
function cd_ws() { cd $d_ws }
function cd_App() { cd $d_App }
function cd_AppInst() { cd $d_AppInst }
function cd_Dev() { cd $d_Dev }

## Util Alias

function la() { ls -a }
function ll() { ls -al }
function exp_open_here() { explorer . }

## Git Alias

function git_hist() { git log --oneline --graph --decorate --all }
function git_com() { git commit --allow-empty-message --no-edit }
function git_conf_global() { git config --global --edit }
function git_conf_local() { git config --edit }
function git_add_com_push() {
 git add -A
  git commit --allow-empty-message --no-edit
  git push
}

## Edit

function edit_alias(){
  code C:/msys64/home/owner/.alias.zsh
}
function edit_alias_sh_only(){
  code C:/msys64/home/owner/.alias-sh.zsh
}
function edit_zshrc() {
  code C:/msys64/home/owner/.zshrc
}
function edit_pwsh_profile(){
  code C:/Users/owner/Documents/PowerShell/Microsoft.PowerShell_profile.ps1
}

## Env
$env:PKG_CONFIG_PATH += ";C:/msys64/usr/local/lib/pkgconfg"
$env:PKG_CONFIG_PATH += ";C:/msys64/usr/local/share/pkgconfig"
echo "Loaded : $PSCommandPath"

bash-to-powershell-converter's People

Contributors

nyabkun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.