KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
multisheller
★ 16
Open GitHub ↗
No description available.
Download README (.md)
Explore Similar Repositories
amazon-qldb-driver-rust
:
A Rust implementation of a driver for Amazon QLDB.
URCL
:
URCL is a "Universal Redstone Computer Language", it's an intermediate language so it isn't designed to be run on CPUs. URCL compiles to a specified ISA using a custom config file.
russtat
:
Russian statistical database EMISS python frontend
mangabz_spider
:
Spidering comics from mangabz
ti.youtube
:
A small library to get the URL of the desired YouTube video ID to use it natively in Ti.Media.VideoPlayer.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
multisheller
?
Download (.md)
# sh multiplexer This project implements a simple DSL (in Python) to generate shell scripts for many different shells. This is particularly useful for conda-recipes (specifically the sometimes used activation and deactivation scripts). If one writes the activation or deactivation script using this project, it is trivial to generate the same activation flow for many different shells: - bash - powershell - cmd.bat - zsh - xonsh This grew out of a frustration on how hard it is to write bash / cmd.bat scripts that work cross-platform and for all shells that people use (esp. powershell). Examples: If you save: ```py if_(conda_prefix == "test").then_( cmds.export("TEST_VARIABLE", path.join(cmds.env("CONDA_PREFIX"), "test/for/something")) ) ``` in a file called `project_activate.msh`, and you convert it with: ~~~ multisheller project_activate.msh ~~~ This will generate many shell files, such as `project_activate.bash`, `project_activate.bat`, one for each supported shell. For example, if you open the `project_activate.bash` you will find: ```sh # Taken from http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html # Functions to help us manage paths. Second argument is the name of the # path variable to be modified (default: PATH) pathremove () { local IFS=':' local NEWPATH local DIR local PATHVARIABLE=${2:-PATH} for DIR in ${!PATHVARIABLE} ; do if [ "$DIR" != "$1" ] ; then NEWPATH=${NEWPATH:+$NEWPATH:}$DIR fi done export $PATHVARIABLE="$NEWPATH" } pathprepend () { # pathremove $1 $2 local PATHVARIABLE=${2:-PATH} export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" } pathappend () { # pathremove $1 $2 local PATHVARIABLE=${2:-PATH} export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" } if [[ $CONDA_PREFIX -eq test ]]; then export TEST_VARIABLE=$CONDA_PREFIX/test/for/something fi; ``` while in `project_activate.ps1` : ~~~ if (($Env:CONDA_PREFIX) -eq (test)) { $Env:TEST_VARIABLE=$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath test/for/something) } ~~~ If you want to customize the name of the converted scripts, you can use the `--output` option of `multisheller` : ~~~ multisheller project_activate.msh --output setup ~~~ This will create the `setup.bash`, `setup.zsh`, `setup.bat`, ... files.