Giter Club home page Giter Club logo

psm's Introduction

psm - Powershell Script Manager

CircleCI

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

Features:

  • 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!

Install

Download distribution corresponding to your system in release page

Windows

  • 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 to PATH enviroment variable and run refreshenv in terminal at least one.

Linux

Unpacks gzip file. Appends

alias psm=/path/to/psm

to your .bashrc or .zshrc.
Restart your terminal.

Usage:

Synopsis

psm [-i <ext>] [-s <path>] [-c <keyword>] [-l] [-h] [-v] 

psm script_alias

Options

-i <ext>, --init <ext>

Generate config in current directory
Supports: yaml, json
Default value is yaml

-s <path>, --set-path <path>

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

-c <keyword>, --complete <keyword>

Print possible script aliases that match with keyword

-l, --list

List all available script aliases

-h, --help

Print help and exit

-v, --version

Print version number and exit

Example:

Put a psm.json or psm.yaml in current working folder:
Or use --init option to auto-generate one:

image

Inside that file, declare an object with key is whatever shorthand alias you want and value is powershell script to be executed.

psm.json

{
  "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

psm.yaml

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

Development

Requires:

  1. Clone:
git clone https://github.com/khanhas/psm.git

cd psm
  1. Build
./build.ps1
  1. Set enviroment variable so you can run psm everywhere:
./install.ps1

Roadmap

  • Init command: Gather all scripts file in project folder and automatically generate a psm.json/psm.yaml
  • Make an installer
  • Linux support.

psm's People

Contributors

khanhas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

psm's Issues

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.