Movatterモバイル変換


[0]ホーム

URL:


@yarnpkg/shell

4.1.3 • Public • Published

A JavaScript implementation of a bash-like shell (we use it in Yarn 2 to provide cross-platform scripting). This package exposes an API that abstracts both the parser and the interpreter; should you only need the parser you can check out@yarnpkg/parsers, but you probably won't need it.

Usage

import{execute}from'@yarnpkg/shell';process.exitCode=awaitexecute(`ls "$0" | wc -l`,[process.cwd()]);

Features

  • Typechecked
  • Portable across systems
  • Supports custom JS builtins
  • Supports pipes
  • Supports glob patterns (only for files that exist on the filesystem:ls *.txt)
  • Supports logical operators
  • Supports subshells
  • Supports variables
  • Supports string manipulators
  • Supports argc/argv
  • Supports background jobs with color-coded output
  • Supports the most classic builtins
  • Doesn't necessarily need to access the fs

Help Wanted

  • Full glob support (mv build/{index.js,index.build.js},echo {foo,bar},FOO=a,b echo {$FOO,x})
  • More string manipulators

Non-Goals

  • Perfect POSIX compliance (basic scripting is enough for now)
  • Multiline scripts (we mostly target one-liners)
  • Control structures (same reason)

Readme

Keywords

none

Provenance

Share feedback

Package Sidebar

Install

npm i @yarnpkg/shell

Weekly Downloads

421,806

Version

4.1.3

License

BSD-2-Clause

Unpacked Size

58.8 kB

Total Files

15

Last publish

Collaborators

  • daniel15
  • bestander
  • cpojer
  • arcanis
  • yarnbot

[8]ページ先頭

©2009-2025 Movatter.jp