JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q45793F
  • License MIT

Run command with modified CWD (current working directory)

Package Exports

  • cli-wd

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-wd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm

cli-wd Dependency Status

Run program in a modified working directory.

Example

$ wd /usr/bin pwd
/usr/bin

Put archive file in a custom directory across archivers:

$ wd ./dir tar cvaf ../dir.tbz2 .
$ wd ./dir zip -r ../dir .
$ wd ./dir 7z a ../dir . -tzip

Start a subshell:

$ wd /
$ echo $SHLVL $PWD
2 /

CLI

wd [-s | --shell] <directory> [<command>] [arg]...

Run <command> (which defaults to $SHELL) with supplied arguments in a given working directory. Fall back to shell (just in case <command> is a shell function or alias).

--shell forces command to be executed in shell.

API

This is only a thin wrapper over kexec falling back to child_process.spawnSync, but anyway:

spawnFrom(wd, cmd, argv)

Synchronously spawn process defined by cmd and argv in the working directory wd.

wd
Working directory to spawn process in.
cmd
Command to run.
argv
Array of arguments.

Install

npm install -g cli-wd

License

MIT