mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
34 lines
845 B
TypeScript
34 lines
845 B
TypeScript
import nodePowershell = require('node-powershell');
|
|
|
|
var options: nodePowershell.ShellOptions = {
|
|
debugMsg: true
|
|
};
|
|
|
|
// Initialization
|
|
var ps = new nodePowershell(options);
|
|
|
|
// Methods
|
|
ps.addCommand('Write-Host node-powershell', [
|
|
{ name: 'foregroundcolor', value: 'red' },
|
|
{ name: 'nonewline' } //switch
|
|
]).then((cmdsArr: string[]) => { }).catch((err: any) => { });
|
|
|
|
ps.addCommand('Write-Host node-powershell', [
|
|
{ foregroundcolor: 'red' }
|
|
]);
|
|
|
|
ps.invoke().then((output: string) => { }).catch((err: any) => { });
|
|
|
|
ps.dispose().then((code: string) => { }).catch((err: any) => { });
|
|
|
|
// Properties
|
|
console.log(ps.history);
|
|
|
|
ps.streams.stdin.write('data');
|
|
ps.streams.stdout.on('data', (data: any) => { });
|
|
|
|
// Events
|
|
ps.on('output', (data: string) => { });
|
|
ps.on('err', (err: string) => { });
|
|
ps.on('end', (code: string) => { });
|