Execute Powershell script/command or chain of scripts/command with pre-defined alias.
psm exists just to save your time!
No need to import scripts repeatedly every time setting up your working enviroment.
No need to spread out simple functions to seperated scripts. From now on, just gather them all in one:
function runFunction() {
...
}
function rebuildFunction() {
...
}
In psm config, simply import that script and call function, like this:
run: (. ./my-scripts-collection.ps1);runFunction
rebuild: (. ./my-scripts-collection.ps1);rebuildFunction
In terminal, you just need to type and run:
> psm run
> psm rebuild
- Execute PS scripts in other kind of shells
- Chains and pipe commands effortlessly
- Scans current working folder recursively to find PS scripts and auto-generate psm config file.
- Execute scripts in different versions of powershell with no fuss. Just use
--set-path
. - Supports autocomplete for: powershell, bash, zsh. Check out register-completion scripts.
- Need more? Post an issue or make pull request!
Download distribution corresponding to your system in release page
- Via installer: After installing succesfully, run
refreshenv
in terminal at least one then you're good to go. - Via zip: After unzipping
psm.exe
, appends its folder path toPATH
enviroment variable and runrefreshenv
in terminal at least one.
Unpacks gzip file. Appends
alias psm=/path/to/psm
to your .bashrc
or .zshrc
.
Restart your terminal.
psm [-i <ext>] [-s <path>] [-c <keyword>] [-l] [-h] [-v]
psm script_alias
Generate config in current directory
Supports: yaml
, json
Default value is yaml
Set powershell path/command
Default value is powershell
Notes: In Windows, if you installed Powershell Core >= 6.0 and want to run script with it, you should set to pwsh
or direct path to pwsh.exe
Print possible script aliases that match with keyword
List all available script aliases
Print help and exit
Print version number and exit
Put a psm.json
or psm.yaml
in current working folder:
Or use --init
option to auto-generate one:
Inside that file, declare an object with key is whatever shorthand alias you want and value is powershell script to be executed.
{
"configure": ". ./task.ps1;configure",
"build": ". ./task.ps1;build",
"clean": "Remove-Item -Recurse ./build/",
"cleanAll": "Remove-Item -Recurse ./Publish/; Remove-Item -Recurse ./build/",
"fresh": "psm cleanAll; psm configure; psm build"
}
or
configure: ". ./task.ps1;configure"
build: ". ./task.ps1;build"
clean: "Remove-Item -Recurse ./build/"
cleanAll: "Remove-Item -Recurse ./Publish/; Remove-Item -Recurse ./build/"
fresh: "psm cleanAll; psm configure; psm build"
Then in terminal, you just need to run:
> psm fresh
to wipe off Publish
and build
folders, configure project files then build project
Requires:
- Golang
- Powershell >= 6.0
- Clone:
git clone https://github.com/khanhas/psm.git
cd psm
- Build
./build.ps1
- Set enviroment variable so you can run
psm
everywhere:
./install.ps1
- Init command: Gather all scripts file in project folder and automatically generate a
psm.json
/psm.yaml
- Make an installer
- Linux support.