Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@qui-cli/shell

@qui-cli Plugin: Standardized shelljs wrapper

npm version Module type: ESM

Install

npm install @qui-cli/shell @qui-cli/core

If developing a reusable plugin:

npm install --save-peer  @qui-cli/shell@>=3

Usage

import { Shell } from '@qui-cli/shell';
import { Core } from '@qui-cli/core';

// configure Shell
Root.configure({ showCommands: true });

// load user-provided command-line arguments
await Core.run();

// use Shell
Shell.exec('echo "hello world"');

Configuration

export type Configuration = Plugin.Configuration & {
  showCommands?: boolean;
  silent?: boolean;
};

showCommands

Whether or not to display the commands (rather than just their output) in the console, defaults to false.

silent

Whether or not to show command output (and, potentially, commands themselves) in the console, defaults to true.

Options

Shell exposes both showCommands and silent as user-configurable command line arguments.

Initialization

After user-provided command line arguments are parsed, Shell is updated to reflect user-specified configuration.

API

import { Shell } from '@qui-cli/shell';

Shell.get()

Returns the actual shelljs object.

Shell.exec(command, { silent }): shelljs.ShellString

Execute an arbitrary command in the shell, optionally overriding the current silent setting.

Shell.getPreviousResult(): shelljs.ShellString

Get the result of the most-recently executed command.

Shell.isSilent(): boolean

Whether or not the shell is currently set to silent.

Shell.commandsShown(): boolean

Whether or not the shell is currently set to showCommands.