1.0.1 • Published 3 years ago

@adlib/shell-quote v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

@adlib/shell-quote

Create a "shell-like" quoted command string from an args array. Double quotes are used when possible, and backslash escapes when necessary.

This is mostly intended for pretty printing commands executed from inside a NodeJS script. But, it should generate command strings safe to cut and paste into a sh, bash, or zsh prompt.

Usage

import { quote } from '@adlib/shell-quote';

const command = quote(['npm', 'i', 'react@^17']);
// npm i "react@^17"