Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.03 KB

README.md

File metadata and controls

53 lines (38 loc) · 2.03 KB

gopwsh

PkgGoDev GoReport GoLang .github/workflows/main.yml semantic-release Conventional Commits KeepAChangelog License

Package gopwsh is a simple host for PowerShell with-in your Go code.

Originally inspired by https://github.com/bhendo/go-powershell

Quick Start

go get -u github.com/brad-jones/gopwsh

package main

import (
	"fmt"

	"github.com/brad-jones/gopwsh"
)

func main() {
	shell := gopwsh.MustNew()
	defer shell.Exit()
	stdout, _, err := shell.Execute("Get-ComputerInfo")
	if err != nil {
		panic(err)
	}
	fmt.Println(stdout)
}

Also see further working examples under: https://github.com/brad-jones/gopwsh/tree/master/examples

Cross Platform Support

PowerShell these days of course is a cross platform shell, able to run on Windows, MacSO & Linux.

This go module should in theory work on all those platforms too.

But (at this stage) has not been tested anywhere apart from Windows. Who uses PowerShell outside of Windows... sorry thats short sighted & naive of me.

Eventually I'll get around to writing a full test suite but until then if you are one of these users & notice a bug, PRs are of course welcome :)