Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shell-args

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shell-args

Parsing and quoting for shell command lines that supports both bash and windows styles of quoting.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
552
decreased by-38.46%
Maintainers
1
Weekly downloads
 
Created
Source

shell-args

A simple set of functions for parsing a command line string into arguments and converting command line arguments into a correctly escaped string.

Many other npm modules offer this functionality however the only ones I could find only support unix style escaping and so do not work correctly for windows command lines.

This module exports bashShellParse, winShellParse, bashShellQuote and winShellQuote. It also exports shellQuote and shellParse which call the function correct for the current platform.

The parse functions accept a string and return an array of strings:

import { bashShellQuote } from "shell-args";

bashShellParse("hello there world"); // -> ["hello", "there", "world"]
bashShellParse("\"hello there\" world"); // -> ["hello there", "world"]
bashShellParse(`foo
test\\(\\)`); // -> ["foo", "test()"]

The quote functions accept an array of strings and return a string:

import { bashShellParse } from "shell-args";

bashShellQuote(["hello", "there", "world"]); // -> "hello there world"
bashShellQuote(["hello there", "world"]); // -> "\"hello there\" world"
bashShellQuote(["foo", "test()"]); // -> ["foo", "test\\(\\)"]

Keywords

FAQs

Package last updated on 06 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc