https://github.com/alanlivio/ps-sh-helpers
Template to easily create multi-OS bash helpers for Windows (MSYS2/GitBash/WSL), Ubuntu, and Mac.
https://github.com/alanlivio/ps-sh-helpers
bash bash-alias bash-profile bash-script bashrc desktop-environment dotfiles dotfiles-setup linux macos shell windows windows-terminal windows-tweaks
Last synced: 2 months ago
JSON representation
Template to easily create multi-OS bash helpers for Windows (MSYS2/GitBash/WSL), Ubuntu, and Mac.
- Host: GitHub
- URL: https://github.com/alanlivio/ps-sh-helpers
- Owner: alanlivio
- Created: 2015-10-13T18:38:11.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T18:24:18.000Z (8 months ago)
- Last Synced: 2024-10-26T03:42:03.856Z (8 months ago)
- Topics: bash, bash-alias, bash-profile, bash-script, bashrc, desktop-environment, dotfiles, dotfiles-setup, linux, macos, shell, windows, windows-terminal, windows-tweaks
- Language: Shell
- Homepage:
- Size: 1.34 MB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ps-sh-helpers
`ps-sh-helpers` is a template for creating your library PowerShell and Bash helpers. It is very useful for Windows users that wants take the best of WSL Bash and integrate it with PowerShell.
`ps-sh-helpers` organize helpers in OS-dependent from `os/.*` files and loads program-dependent from `programs/.*` files. It is initialized at `.bashrc` by loading `init.sh` or at `PowerShell_profile.ps1` by loading `init.ps1` (see diagram below).
```mermaid
%%{init: {'theme':'dark'}}%%
flowchart LR
bashrc[".bashrc"]
ps-init["init.ps1"]
sh-init["init.sh"]
program-dependent["
programs/[program].bash
...
"]
OS-dependent["
os/win.bash
os/ubu.bash
...
"]
bashrc --> |"loads"| sh-init
sh-init --> |"loads if program exists"| program-dependent
sh-init --> |"loads if running at OS"| OS-dependent
sh-init --> |"bash alias to each function at"| ps-init
``````mermaid
%%{init: {'theme':'dark'}}%%
flowchart LR
psprofile["profile.ps1"]
ps-init["init.ps1"]
sh-init["init.sh"]
program-dependent["
programs/[program].ps1
...
"]
OS-dependent["
os/win.ps1
os/ubu.ps1
...
"]psprofile--> |"loads"| ps-init
ps-init --> |"loads if program exists"| program-dependent
ps-init --> |"loads if running at OS"| OS-dependent
ps-init --> |"bash alias to each function at"| sh-init
```## How to install
You can use the Bash commands below to fetch, install, and setup `ps-sh-helpers` to be loaded in your `.bashrc`:
```bash
git clone https://github.com/alanlivio/ps-sh-helpers ~/.ps1-sh-helpers
echo "source ~/.ps-sh-helpers/init.sh" >> ~/.bashrc
```You can use the PowerShell commands below to fetch, install, and setup `ps-sh-helpers` to be loaded in your `profile.ps1`:
```ps1
git clone https://github.com/alanlivio/ps-sh-helpers ${env:userprofile}\.ps1-sh-helpers
$contentAdd = '. "${env:userprofile}\.ps-sh-helpers\init.ps1""'
# to setup WindowsPowerShell
Set-Content "${env:userprofile}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" $contentAdd
```Pay attention that to setup a PowerShell >= 6, the last line should be:
`Set-Content "${env:userprofile}/Documents/PowerShell/profile.ps1" $contentAdd`## References
This project takes inspiration from:
-
-
-
-
-
-
-
-
-
-
-
-
-
-