Showing preview only (654K chars total). Download the full file or copy to clipboard to get everything.
Repository: dthree/cash
Branch: master
Commit: 3e28dae8bdb7
Files: 353
Total size: 583.5 KB
Directory structure:
gitextract_hiy2al8k/
├── .babelrc
├── .eslintignore
├── .gitignore
├── .istanbul.yml
├── .travis.yml
├── LICENSE
├── README.md
├── appveyor.yml
├── bin/
│ ├── alias.js
│ ├── cash.js
│ ├── cat.js
│ ├── cd.js
│ ├── clear.js
│ ├── cp.js
│ ├── echo.js
│ ├── export.js
│ ├── false.js
│ ├── grep.js
│ ├── head.js
│ ├── kill.js
│ ├── less.js
│ ├── ls.js
│ ├── mkdir.js
│ ├── mv.js
│ ├── parser.js
│ ├── pwd.js
│ ├── rm.js
│ ├── sort.js
│ ├── source.js
│ ├── tail.js
│ ├── touch.js
│ ├── true.js
│ ├── unalias.js
│ └── which.js
├── commands.json
├── dist/
│ ├── commands/
│ │ ├── alias.js
│ │ ├── boilerplate.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── less.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── delimiter.js
│ ├── help/
│ │ ├── alias.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── help.js
│ ├── index.js
│ ├── lib/
│ │ └── sugar.js
│ ├── preparser.js
│ ├── util/
│ │ ├── colorFile.js
│ │ ├── columnify.js
│ │ ├── converter.date.js
│ │ ├── converter.path.js
│ │ ├── converter.permissions.js
│ │ ├── expand.js
│ │ ├── fetch.js
│ │ ├── fileFromPath.js
│ │ ├── intercept.js
│ │ ├── interfacer.js
│ │ ├── lpad.js
│ │ ├── pad.js
│ │ ├── stripAnsi.js
│ │ ├── unlinkSync.js
│ │ ├── walkDir.js
│ │ └── walkDirRecursive.js
│ └── windows.js
├── gulpfile.js
├── package.json
├── packages/
│ ├── cat/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── cat.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── cat.js
│ │ │ ├── help/
│ │ │ │ └── cat.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ ├── fetch.js
│ │ │ ├── interfacer.js
│ │ │ ├── lpad.js
│ │ │ └── stripAnsi.js
│ │ └── package.json
│ ├── cp/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── cp.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── cp.js
│ │ │ ├── help/
│ │ │ │ └── cp.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── false/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── false.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── false.js
│ │ │ ├── help/
│ │ │ │ └── false.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── head/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── head.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── head.js
│ │ │ ├── help/
│ │ │ │ └── head.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── kill/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── kill.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── kill.js
│ │ │ ├── help/
│ │ │ │ └── kill.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── ls/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── ls.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── ls.js
│ │ │ ├── help/
│ │ │ │ └── ls.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── colorFile.js
│ │ │ ├── columnify.js
│ │ │ ├── converter.date.js
│ │ │ ├── converter.permissions.js
│ │ │ ├── expand.js
│ │ │ ├── fileFromPath.js
│ │ │ ├── interfacer.js
│ │ │ ├── lpad.js
│ │ │ ├── pad.js
│ │ │ ├── stripAnsi.js
│ │ │ ├── walkDir.js
│ │ │ └── walkDirRecursive.js
│ │ └── package.json
│ ├── mkdir/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── mkdir.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── mkdir.js
│ │ │ ├── help/
│ │ │ │ └── mkdir.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── mv/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── mv.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── mv.js
│ │ │ ├── help/
│ │ │ │ └── mv.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── pwd/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── pwd.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── pwd.js
│ │ │ ├── help/
│ │ │ │ └── pwd.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── rm/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── rm.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── rm.js
│ │ │ ├── help/
│ │ │ │ └── rm.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ ├── interfacer.js
│ │ │ └── unlinkSync.js
│ │ └── package.json
│ ├── sort/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── sort.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── sort.js
│ │ │ ├── help/
│ │ │ │ └── sort.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ ├── fetch.js
│ │ │ ├── interfacer.js
│ │ │ └── stripAnsi.js
│ │ └── package.json
│ ├── tail/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── tail.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── tail.js
│ │ │ ├── help/
│ │ │ │ └── tail.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── converter.path.js
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── template.README.md
│ ├── template.package.json
│ ├── touch/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── touch.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── touch.js
│ │ │ ├── help/
│ │ │ │ └── touch.js
│ │ │ ├── lib/
│ │ │ │ └── sugar.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── true/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── true.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── true.js
│ │ │ ├── help/
│ │ │ │ └── true.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ └── which/
│ ├── README.md
│ ├── bin/
│ │ ├── parser.js
│ │ └── which.js
│ ├── dist/
│ │ ├── commands/
│ │ │ └── which.js
│ │ ├── help/
│ │ │ └── which.js
│ │ ├── preparser.js
│ │ └── util/
│ │ └── interfacer.js
│ └── package.json
├── src/
│ ├── commands/
│ │ ├── alias.js
│ │ ├── boilerplate.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── less.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── delimiter.js
│ ├── help/
│ │ ├── alias.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── help.js
│ ├── index.js
│ ├── lib/
│ │ └── sugar.js
│ ├── preparser.js
│ ├── util/
│ │ ├── colorFile.js
│ │ ├── columnify.js
│ │ ├── converter.date.js
│ │ ├── converter.path.js
│ │ ├── converter.permissions.js
│ │ ├── expand.js
│ │ ├── fetch.js
│ │ ├── fileFromPath.js
│ │ ├── intercept.js
│ │ ├── interfacer.js
│ │ ├── lpad.js
│ │ ├── pad.js
│ │ ├── stripAnsi.js
│ │ ├── unlinkSync.js
│ │ ├── walkDir.js
│ │ └── walkDirRecursive.js
│ └── windows.js
└── test/
├── alias.js
├── cat.js
├── cd.js
├── clear.js
├── cp.js
├── echo.js
├── export.js
├── head.js
├── help.js
├── index.js
├── kill.js
├── ls.js
├── mkdir.js
├── mv.js
├── preparser.js
├── pwd.js
├── rm.js
├── sort.js
├── source.js
├── tail.js
├── touch.js
├── true.js
├── unalias.js
├── util/
│ ├── playground.js
│ └── util.js
├── vorpal.js
├── which.js
└── windows.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": ["es2015"]
}
================================================
FILE: .eslintignore
================================================
src/lib/sugar.js
================================================
FILE: .gitignore
================================================
*.log
# Runtime data
pids
*.pid
*.seed
*sublime*
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.cmd_history
.cmd_history/*
.cmd_history/cmd_historycash
================================================
FILE: .istanbul.yml
================================================
verbose: false
instrumentation:
root: .
extensions:
- .js
default-excludes: true
excludes: ['./dist/lib/sugar.js']
embed-source: false
variable: __coverage__
compact: true
preserve-comments: false
complete-copy: false
save-baseline: false
baseline-file: ./coverage/coverage-baseline.json
include-all-sources: false
include-pid: false
es-modules: false
reporting:
print: summary
reports:
- lcov
dir: ./coverage
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
report-config:
clover: {file: clover.xml}
cobertura: {file: cobertura-coverage.xml}
json: {file: coverage-final.json}
json-summary: {file: coverage-summary.json}
lcovonly: {file: lcov.info}
teamcity: {file: null, blockName: Code Coverage Summary}
text: {file: null, maxCols: 0}
text-lcov: {file: lcov.info}
text-summary: {file: null}
hooks:
hook-run-in-context: false
post-require-hook: null
handle-sigint: false
check:
global:
statements: 0
lines: 0
branches: 0
functions: 0
excludes: []
each:
statements: 0
lines: 0
branches: 0
functions: 0
excludes: []
================================================
FILE: .travis.yml
================================================
sudo: false
language: node_js
node_js:
- "7"
- "6"
- "5"
- "4"
- "8"
after_success: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
branches:
only:
- master
================================================
FILE: LICENSE
================================================
(The MIT License)
Copyright (c) 2015 DC <threedeecee@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
<h1 align="center">
<img width="284" src="http://i.imgur.com/tKrIdAI.jpg" alt="Cash">
<!--<img width="256" src="http://i.imgur.com/oIN1WsM.jpg" alt="Cash">-->
</h1>
> Cross-platform Linux commands in pure ES6
[](https://travis-ci.org/dthree/cash/)
[](https://ci.appveyor.com/project/dthree/cash)
[](https://coveralls.io/github/dthree/cash?branch=master)
[](https://gitter.im/dthree/cash?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[](https://github.com/sindresorhus/xo)
Cash is a cross-platform implementation of Unix shell commands written in straight ES6. No native compiling and no external dependencies.
While young, Cash aims to offer an alternative Linux feel on Windows and to open the door to cross-platform bash scripting in a Javascript environment.
```bash
> npm install cash -g
> cash
$
```
<p align="center">
<img src="http://i.giphy.com/xT0BKNwUPFhFj2glry.gif" alt="Cash" />
</p>
### Woah.
Yeah. But it gets better.
Let's mix some Windows & Unix commands together:
```bash
$ ipconfig | grep IPv4 | sort
IPv4 Address. . . . . . . . . . . : 10.10.40.50
IPv4 Address. . . . . . . . . . . : 192.168.100.11
$
```
[Learn more](https://github.com/dthree/cash/wiki/Usage-|-Interactive)
### But I don't want to type "cash"
No problem. Let's make all commands global on your system:
```bash
> npm install cash-global -g
> ls -lah
```
[Learn more](https://github.com/dthree/cash/wiki/Usage-|-Global)
### Nice, but I only want certain commands
You're covered!
```bash
> npm install cash-ls -g
> npm install cash-grep -g
```
[Learn more](https://github.com/dthree/cash/wiki/Usage-|-Global#installing-individual-commands)
### Wow. But I want this programmatically!
Again, you're in business:
```js
const $ = require('cash');
const out = $.ls('.', {l: true});
```
Not terse enough? How about this:
```js
const out = $('ls -lah');
```
Not :sunglasses: enough? Try this:
```js
require('cash') `
cp -R ./src ./dest
ls | grep *-spec.js | cat
rm ./specResults.html
`;
```
*For even better programmatic Unix commands, check out [ShellJS](https://github.com/shelljs/shelljs).*
[Learn more](https://github.com/dthree/cash/wiki/Usage-|-Programmatic)
### Isn't this impossible to do in Node?
It was, before [Vorpal](https://github.com/dthree/vorpal).
Made with ❤ by [dthree](https://github.com/dthree).
Love it? Give it a :star: or a tweet to help spread the word!
## Notice
This is now an [OPEN Open Source](http://openopensource.org/) project. I am not able to invest a significant amount of time into maintaining Cash and so am looking for volunteers who would like to be active maintainers of the project. If you are interested, shoot me a note.
## Contents
- [Introduction](#introduction)
- [Supported commands](#supported-commands)
- [Configuration (.cashrc)](#configuration)
- [Contributing](#contributing)
- [FAQ](#faq)
- [Team](#team)
- [License](#license)
- [Wiki](https://github.com/dthree/cash/wiki)
## Introduction
Cash is a project working on a cross-platform implementation of the most used Unix-based commands in pure JavaScript and with no external dependencies.
The goal of Cash is to open up these commands to the massive JavaScript community for the first time, and to provide a cleaner, simpler and flexible alternative to applications like Cygwin for those wanting the Linux feel on Windows.
Cash was built with strict attention to nearly exact implementations and excellent test coverage of over 200 unit tests.
## Supported commands
The following commands are currently implemented:
- alias
- cat
- clear
- cd
- cp
- echo
- export
- false
- grep
- head
- kill
- less
- ls
- mkdir
- mv
- pwd
- rm
- sort
- source
- tail
- touch
- true
- unalias
Want more commands?
- [Vote on the next commands](https://github.com/dthree/cash/wiki/Roadmap)
- [Help spread the word:](http://bit.ly/1LBEJ5s) More knowledge of Cash equals more contributors
- [Contribute](#contributing)
## Configuration
Want to configure things to your heart's content? Just add your configurations in a `.cashrc` file (`_cashrc` also works, for Windows folk) and put that in your home directory. This supports anything you can do inside a cash command prompt (`export`ing environmental variables, aliases, etc.).
## Contributing
- [Editing commands](https://github.com/dthree/cash/wiki/Contributing#editing-existing-commands)
- [Adding new commands](https://github.com/dthree/cash/wiki/Contributing)
We are currently looking for Core Team members who can push forward Cash at a rapid rate. Are you an awesome developer up to the challenge? Send me a ping.
### Awesome contributors
- [@nfischer](https://github.com/nfischer): Added `source`, `export`, `true` and `false` commands, among several other contributions.
- [@safinn](https://github.com/safinn): Added `clear` and `tail` commands.
- [@legien](https://github.com/legien): Added `head` command.
- [@cspotcode](https://github.com/cspotcode): Implemented template literal execution.
## FAQ
#### Why Cash?
In its very essence, Cash replaces the Windows CLI prompt (`>`) with the Unix one (`$`), the dollar symbol.
Cash was most fitting in this sense:
> Ask and ye shall receive
```
> cash
$
````
Cash is also a play on the word `bash`, and is actually[\[1\]](https://xkcd.com/906) a recursive acronym for Cash Shell.
Shout out to [@aseemk](https://github.com/aseemk) for donating the name.
#### Doesn't ShellJS do this?
No.
For those who don't know, [ShellJS](https://github.com/shelljs/shelljs) is an awesome Node package that implements UNIX shell commands programatically in JavaScript. Check it out - really. While ShellJS was tremendously helpful in figuring out how to accomplish Cash, the two do not really conflict.
ShellJS gives the feel of UNIX commands in a code environment, but aims to implement the commands in a way that makes sense for a JavaScript library. This means that many commands return JavaScript objects, and some of the rougher and more dangerous edges of bash have been softened a bit.
For example, with cash:
```javascript
$('ls'); // 'node_modules\n'
$('echo foo > foo.txt');
```
With ShellJS:
```javascript
ls(); // ['node_modules'];
echo('foo').to('foo.txt');
```
## Team
| [](https://github.com/dthree) | [](https://github.com/nfischer) |
|:---:|:---:|
| [David Caccavella](https://github.com/dthree) | [Nate Fischer](https://github.com/nfischer) |
Want to join the team? [Let us know](mailto:threedeecee@gmail.com).
## License
MIT © [David Caccavella](https://github.com/dthree)
================================================
FILE: appveyor.yml
================================================
environment:
matrix:
- nodejs_version: '7'
- nodejs_version: '6'
- nodejs_version: '5'
- nodejs_version: '4'
- nodejs_version: '8'
install:
- ps: Install-Product node $env:nodejs_version
- set CI=true
- set CASH_APPVEYOR=true
- npm install -g npm@latest || (timeout 30 && npm install -g npm@latest)
- set PATH=%APPDATA%\npm;%PATH%
- npm install || (timeout 30 && npm install)
matrix:
fast_finish: true
build: off
version: '{build}'
shallow_clone: true
clone_depth: 1
test_script:
- node --version
- npm --version
- npm run test-win || (timeout 30 && npm run test-win)
================================================
FILE: bin/alias.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'alias');
================================================
FILE: bin/cash.js
================================================
#!/usr/bin/env node
'use strict';
var cash = require('../dist/index');
var delimiter = require('./../dist/delimiter')
delimiter.refresh(cash.vorpal, function () {
cash.show();
});
================================================
FILE: bin/cat.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'cat');
================================================
FILE: bin/cd.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'cd');
================================================
FILE: bin/clear.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'clear');
================================================
FILE: bin/cp.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'cp');
================================================
FILE: bin/echo.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'echo');
================================================
FILE: bin/export.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'export');
================================================
FILE: bin/false.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'false');
================================================
FILE: bin/grep.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'grep');
================================================
FILE: bin/head.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'head');
================================================
FILE: bin/kill.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'kill');
================================================
FILE: bin/less.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'less');
================================================
FILE: bin/ls.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'ls');
================================================
FILE: bin/mkdir.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'mkdir');
================================================
FILE: bin/mv.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'mv');
================================================
FILE: bin/parser.js
================================================
'use strict';
module.exports = function (args, command) {
args.splice(0, 2);
var pipes = (args.indexOf('|') > -1);
if (args.length === 0) {
// If we don't have to parse arguments, do
// the quickest load: just the raw js file
// of the command and nothing else.
var cmd = require('./../dist/commands/' + command)();
cmd.exec.call(console, {options: {}}, {});
} else if (pipes === false) {
// If we need to parse args for this
// command only, pull up vorpal and just load
// that one command.
var vorpal = require('vorpal')();
vorpal.api = {};
require('./../dist/commands/' + command)(vorpal);
args = args.join(' ');
// If we passed in a help request, load in
// the help file.
if (args.indexOf('help') > -1 || args.indexOf('?') > -1) {
let help;
try {
help = require('./../dist/help/' + command + '.js');
help = String(help).replace(/^\n|\n$/g, '');
} catch (e) {}
let cmdObj = vorpal.find(command);
if (cmdObj && help) {
cmdObj.help(function (argus, cb) {
cb(help);
})
}
}
vorpal.exec(command + ' ' + args);
} else {
// If we get into piping other commands,
// we need to go full bore and load the
// entire cash library.
// I guess we could technically parse all
// of the passed args, look for applicable
// commands and only load those, but that's
// some messy work for something that might
// not matter. If you're reading this and
// have deemed it matters, do a PR.
var cash = require('./../dist/index');
cash.vorpal.exec(command + ' ' + args.join(' '));
}
};
================================================
FILE: bin/pwd.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'pwd');
================================================
FILE: bin/rm.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'rm');
================================================
FILE: bin/sort.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'sort');
================================================
FILE: bin/source.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'source');
================================================
FILE: bin/tail.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'tail');
================================================
FILE: bin/touch.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'touch');
================================================
FILE: bin/true.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'true');
================================================
FILE: bin/unalias.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'unalias');
================================================
FILE: bin/which.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'which');
================================================
FILE: commands.json
================================================
{
"commands": [
"alias",
"cat",
"cd",
"clear",
"cp",
"echo",
"head",
"export",
"false",
"kill",
"ls",
"mkdir",
"mv",
"pwd",
"sort",
"source",
"tail",
"touch",
"true",
"less",
"grep",
"rm",
"unalias",
"which"
],
"globalExclusions": [
"alias",
"cd",
"echo",
"export",
"less",
"sort",
"source",
"unalias"
],
"importedCommands": [
"less",
"grep"
],
"windowsExclusions": [
"time"
],
"dependencies": {
"./dist/delimiter.js": ["username", "./dist/util/converter.path.js", "user-home"],
"./dist/util/colorFile.js": ["./dist/util/stripAnsi.js"],
"./dist/util/columnify.js": ["./dist/util/stripAnsi.js", "./dist/util/pad.js"],
"./dist/util/converter.path.js": [],
"./dist/util/converter.permissions.js": [],
"./dist/util/converter.date.js": [],
"./dist/util/expand.js": ["glob"],
"./dist/util/fetch.js": ["./dist/util/expand.js"],
"./dist/util/fileFromPath.js": [],
"./dist/util/interfacer.js": [],
"./dist/util/lpad.js": ["./dist/util/stripAnsi.js"],
"./dist/util/pad.js": ["./dist/util/stripAnsi.js"],
"./dist/util/stripAnsi.js": [],
"./dist/util/walkDir.js": [],
"./dist/util/walkDirRecursive.js": [],
"./dist/util/unlinkSync.js": []
},
"packages": {
"cat": {
"dependencies": ["lodash", "vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/fetch.js",
"./dist/util/interfacer.js",
"./dist/util/lpad.js",
"./dist/util/stripAnsi.js",
"./dist/util/expand.js"
]
},
"cp": {
"dependencies": ["lodash", "vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/expand.js",
"./dist/util/interfacer.js"
]
},
"false": {
"dependencies": [],
"files": [
"./dist/util/interfacer.js"
]
},
"head": {
"dependencies": ["vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/interfacer.js",
"./dist/util/expand.js"
]
},
"kill": {
"dependencies": ["fkill", "lodash"],
"files": [
"./dist/util/interfacer.js"
]
},
"ls": {
"dependencies": ["lodash", "chalk", "filesize", "vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/colorFile.js",
"./dist/util/columnify.js",
"./dist/util/converter.date.js",
"./dist/util/expand.js",
"./dist/util/fileFromPath.js",
"./dist/util/interfacer.js",
"./dist/util/pad.js",
"./dist/util/lpad.js",
"./dist/util/converter.permissions.js",
"./dist/util/stripAnsi.js",
"./dist/util/walkDir.js",
"./dist/util/walkDirRecursive.js"
]
},
"mkdir": {
"dependencies": ["vorpal-autocomplete-fs"],
"files": ["./dist/util/interfacer.js"]
},
"mv": {
"dependencies": ["lodash", "vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/expand.js",
"./dist/util/interfacer.js"
]
},
"pwd": {
"dependencies": [],
"files": [
"./dist/util/interfacer.js"
]
},
"sort": {
"dependencies": ["lodash", "vorpal-autocomplete-fs", "glob", "array-shuffle"],
"files": [
"./dist/util/fetch.js",
"./dist/util/interfacer.js",
"./dist/util/stripAnsi.js",
"./dist/util/expand.js"
]
},
"tail": {
"dependencies": ["vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/interfacer.js",
"./dist/util/converter.path.js",
"./dist/util/expand.js"
]
},
"touch": {
"dependencies": ["lodash", "fs-extra", "vorpal-autocomplete-fs"],
"files": [
"./dist/util/interfacer.js",
"./dist/lib/sugar.js"
]
},
"true": {
"dependencies": [],
"files": [
"./dist/util/interfacer.js"
]
},
"rm": {
"dependencies": ["vorpal-autocomplete-fs", "glob"],
"files": [
"./dist/util/expand.js",
"./dist/util/interfacer.js",
"./dist/util/unlinkSync.js"
]
},
"which": {
"dependencies": ["which"],
"files": [
"./dist/util/interfacer.js"
]
}
}
}
================================================
FILE: dist/commands/alias.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var alias = {
exec: function exec(args, options) {
args = args || [];
options = options || {};
var vorpal = options.vorpal;
if (!vorpal) {
throw new Error('Alias is not programatically supported.');
}
vorpal._aliases = vorpal._aliases || [];
if (args.length < 1) {
options.p = true;
}
if (typeof args === 'string' || args instanceof String) {
args = [args];
}
// Parse incoming args. Accept either:
// alias foo=bar, or
// alias foo 'bar and so on'.
var key = args.join(' ');
var value = void 0;
if (String(key).indexOf('=') > -1) {
var parts = String(key).trim().split('=');
key = parts[0];
value = parts[1] || value;
} else {
var _parts = String(key).trim().split(' ');
key = _parts.shift();
value = _parts.join(' ');
}
// Remove wrapped quotes from value.
if (value !== undefined) {
value = String(value).replace(/^[\"|\']|[\"|\']$/g, '');
}
// Pull list of aliases
var all = void 0;
try {
all = JSON.parse(vorpal.localStorage.getItem('aliases') || []);
} catch (e) {
all = [];
vorpal.localStorage.removeItem('aliases');
}
if (options.p) {
for (var i = 0; i < all.length; ++i) {
var item = vorpal.localStorage.getItem('alias|' + all[i]);
if (item !== undefined && item !== null) {
this.log('alias ' + all[i] + '=\'' + item + '\'');
}
}
} else {
if (value) {
vorpal.localStorage.setItem('alias|' + key, value);
all = all.filter(function (val) {
return val !== key;
});
all.push(key);
} else {
var _item = vorpal.localStorage.getItem('alias|' + key);
if (_item !== undefined && _item !== null) {
this.log('alias ' + key + '=\'' + _item + '\'');
} else {
this.log('-cash: alias: ' + key + ': not found');
}
}
var aliases = {};
for (var _i = 0; _i < all.length; ++_i) {
var _item2 = vorpal.localStorage.getItem('alias|' + all[_i]);
if (_item2 !== undefined && _item2 !== null) {
aliases[all[_i]] = _item2;
}
}
vorpal._aliases = aliases;
}
vorpal.localStorage.setItem('aliases', JSON.stringify(all));
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return alias;
}
vorpal.api.alias = alias;
vorpal.command('alias [name...]').parse(preparser).option('-p', 'print all defined aliases in a reusable format').action(function (args, callback) {
args.options = args.options || {};
args.options.vorpal = vorpal;
return interfacer.call(this, {
command: alias,
args: args.name,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/boilerplate.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
/**
* This is a boilerplate for implementing a new command.
* Delete all of these comments / instructions before finishing.
*/
/**
* 0. Replace all instances of `cmdName` with
* the exact name of the command being implemented.
*/
var cmdName = {
/**
* The cmdName.exec method is exposed by Cash
* as the only public interfacer to your command.
*/
exec: function exec(args, options) {
options = options || {};
/**
* 1. Validate arg input to include every
* possible form of input, such as:
*
* a. as a string:
* cash.foo('bar and so on', {option: true});
*
* b. as an array:
* cash.foo(['bar', 'and', 'so', 'on'], {option: true});
*
* c. as interpeted through Vorpal:
* cash('foo bar and so on --option');
*/
/**
* 2. For errors, use `this.log` to print the
* error message to the user, and only return
* the error code (1, 2, etc.)
*
* if (args.length < 1) {
* this.log('foo: cannot bar: requires at least one file name');
* return 1;
* }
*/
/**
* 3. For all other stdout to the user, use `this.log`.
* For large jobs that should stream logging a
* bit at a time, use multiple `this.log` statements
* and cash will handle the heavy lifting of piping
* and returning the final assembled output to the
* user in the case of programmatically executed
* commands.
*/
/**
* 4. When complete with no errors, return 0;
*
* return 0;
*/
}
};
module.exports = function (vorpal) {
/**
* When do a raw execution of the command
* without options, Vorpal is not used. In this
* case, the raw command is returned.
*/
if (vorpal === undefined) {
return cmdName;
}
vorpal.api.cmdName = cmdName;
/**
* Registers the command in Vorpal.
* Command strings, options and their
* descriptions should exactly emulate
* existing commands.
*/
vorpal.command('cmdName [files...]').parse(preparser).option('-o, --option', 'option description').action(function (args, callback) {
args.options = args.options || {};
/**
* The interfacer method does a
* lot of heavy lifting on interfacing with
* the command properly.
*/
return interfacer.call(this, {
command: cmdName,
args: args.files, // only pass in what you need from Vorpal
options: args.options, // split the options into their own arg
callback: callback
});
});
};
================================================
FILE: dist/commands/cat.js
================================================
'use strict';
var fsAutocomplete = require('vorpal-autocomplete-fs');
var fetch = require('./../util/fetch');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var lpad = require('./../util/lpad');
var strip = require('./../util/stripAnsi');
var cat = {
exec: function exec(args, options) {
var self = this;
// Input normalization
if (args === undefined) {
args = {
files: []
};
} else if (typeof args === 'string' || args instanceof String) {
args = {
files: [args]
};
} else if (Array.isArray(args)) {
args = {
files: args
};
}
options = options || {};
// -A handler
if (options.showall) {
options.shownonprinting = true;
options.showends = true;
options.showtabs = true;
}
// -e handler
if (options.e) {
options.shownonprinting = true;
options.showends = true;
}
// -t handler
if (options.t) {
options.shownonprinting = true;
options.showtabs = true;
}
var stdout = '';
try {
var stdin = fetch(args.files, args.stdin, {
onDirectory: function onDirectory(name) {
return 'cat: ' + name + ': Is a directory';
},
onInvalidFile: function onInvalidFile(name) {
return 'cat: ' + name + ': No such file or directory';
}
});
var ctr = 0;
for (var i = 0; i < stdin.length; ++i) {
// If -s, squeeze double blank lines to a
// single line.
if (options.squeezeblank) {
stdin[i] = stdin[i].replace(/\n\n\s*\n/g, '\n\n');
}
if (options.showtabs) {
stdin[i] = stdin[i].replace(/\t/g, '^I');
}
// Get rid of trailing line break because
// node logging does it anyway.
stdin[i] = stdin[i].replace(/\s$/, '');
var parts = String(stdin[i]).split('\n');
for (var j = 0; j < parts.length; ++j) {
var blank = strip(parts[j]).trim() === '';
// If -b, number every non-blank line
// If -n, number every line
var numbered = !blank && options.numbernonblank || options.number && !options.numbernonblank;
if (numbered) {
ctr++;
}
var numStr = numbered ? lpad(String(ctr), 6, ' ') + ' ' : '';
// If -E, append a $ to each line end.
var dollarStr = options.showends ? '$' : '';
var line = numStr + parts[j] + dollarStr;
stdout += line + '\n';
}
}
if (stdout.length > 0) {
self.log(stdout.slice(0, stdout.length - 1));
}
return 0;
} catch (e) {
/* istanbul ignore next */
self.log(e.stack);
/* istanbul ignore next */
return 1;
}
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return cat;
}
vorpal.api.cat = cat;
vorpal.command('cat [files...]').parse(preparser).option('-A, --show-all', 'equivalent to -vET').option('-b, --number-nonblank', 'number nonempty output lines, overrides -n').option('-e', 'equivalent to -vE').option('-E, --show-ends', 'display $ at end of each line').option('-n, --number', 'number all output lines').option('-s, --squeeze-blank', 'suppress repeated empty output lines').option('-t', 'equivalent to -vT').option('-T, --show-tabs', 'display TAB characters as ^I').option('-v, --show-nonprinting', 'use ^ and M- notation, except for LFD and TAB') // this doesn't work yet...
.autocomplete(fsAutocomplete()).action(function (args, cb) {
args.options = args.options || {};
return interfacer.call(this, {
command: cat,
args: args,
options: args.options,
callback: cb
});
});
};
================================================
FILE: dist/commands/cd.js
================================================
'use strict';
var fsAutocomplete = require('vorpal-autocomplete-fs');
var delimiter = require('./../delimiter');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var cd = {
exec: function exec(dir, options) {
var self = this;
var vpl = options.vorpal;
options = options || {};
dir = !dir ? delimiter.getHomeDir() : dir;
// Allow Windows drive letter changes
dir = dir && dir.length === 2 && dir[1] === '/' ? dir[0] + ':' : dir;
try {
process.chdir(dir);
if (vpl) {
delimiter.refresh(vpl);
}
return 0;
} catch (e) {
return cd.error.call(self, e, dir);
}
},
error: function error(e, dir) {
var status = void 0;
var stdout = void 0;
if (e.code === 'ENOENT' && e.syscall === 'uv_chdir') {
status = 1;
stdout = '-bash: cd: ' + dir + ': No such file or directory';
} else {
status = 2;
stdout = e.stack;
}
this.log(stdout);
return status;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return cd;
}
vorpal.api.cd = cd;
vorpal.command('cd [dir]').parse(preparser).autocomplete(fsAutocomplete({ directory: true })).action(function (args, callback) {
args.options = args.options || {};
args.options.vorpal = vorpal;
return interfacer.call(this, {
command: cd,
args: args.dir,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/clear.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var clear = {
exec: function exec() {
this.log('\u001b[2J\u001b[0;0H');
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return clear;
}
vorpal.api.clear = clear;
vorpal.command('clear').action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: clear,
args: args,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/cp.js
================================================
'use strict';
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var path = require('path');
var os = require('os');
var expand = require('./../util/expand');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var cp = {
exec: function exec(args, options) {
var self = this;
options = options || {};
args = args === undefined ? [] : args;
args = Array.isArray(args) ? args : args.split(' ');
args = args.filter(function (arg) {
return String(arg).trim() !== '';
});
options.noclobber = options.force === true ? false : options.noclobber;
options.recursive = options.R === true ? true : options.recursive;
if (args.length < 1) {
this.log('cp: missing file operand\nTry \'cp --help\' for more information.');
return 1;
}
if (args.length === 1) {
this.log('cp: missing destination file operand after ' + args[0] + '\nTry \'cp --help\' for more information.');
return 1;
}
args = expand(args);
var dest = args.pop();
var sources = args;
var exists = fs.existsSync(dest);
var stats = exists && fs.statSync(dest);
// Dest is not existing dir, but multiple sources given
if ((!exists || !stats.isDirectory()) && sources.length > 1) {
this.log('cp: target ' + dest + ' is not a directory');
return 1;
}
// Dest is an existing file, but no -f given
if (exists && stats.isFile() && options.noclobber) {
// just dont do anything
return 0;
}
if (options.recursive) {
sources.forEach(function (src, i) {
if (src[src.length - 1] === '/') {
sources[i] += '*';
} else if (fs.statSync(src).isDirectory() && !exists) {
sources[i] += '/*';
}
});
try {
fs.mkdirSync(dest, parseInt('0777', 8));
} catch (e) {
// like Unix's cp, keep going even if we can't create dest dir
}
}
sources = expand(sources);
sources.forEach(function (src) {
if (!fs.existsSync(src)) {
self.log('cp: cannot stat ' + src + ': No such file or directory');
return;
}
if (fs.statSync(src).isDirectory()) {
if (!options.recursive) {
self.log('cp: omitting directory ' + src);
} else {
// 'cp /a/source dest' should create 'source' in 'dest'
var newDest = path.join(dest, path.basename(src));
var checkDir = fs.statSync(src);
try {
fs.mkdirSync(newDest, checkDir.mode);
} catch (e) {
/* istanbul ignore if */
if (e.code !== 'EEXIST') {
throw new Error();
}
}
cpdirSyncRecursive.call(self, src, newDest, options);
}
return;
}
// If here, src is a file
// When copying to '/path/dir', iDest = '/path/dir/file1'
var iDest = dest;
if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) {
iDest = path.normalize(dest + '/' + path.basename(src));
}
if (fs.existsSync(iDest) && options.no_force) {
return;
}
copyFileSync.call(self, src, iDest);
});
}
};
function cpdirSyncRecursive(sourceDir, destDir, options) {
var self = this;
/* istanbul ignore if */
if (!options) {
options = {};
}
var checkDir = fs.statSync(sourceDir);
try {
fs.mkdirSync(destDir, checkDir.mode);
} catch (e) {
/* istanbul ignore if */
if (e.code !== 'EEXIST') {
throw e;
}
}
var files = fs.readdirSync(sourceDir);
for (var i = 0; i < files.length; i++) {
var srcFile = sourceDir + '/' + files[i];
var destFile = destDir + '/' + files[i];
var srcFileStat = fs.lstatSync(srcFile);
if (srcFileStat.isDirectory()) {
// recursion this thing right on back.
cpdirSyncRecursive.call(self, srcFile, destFile, options);
} else if (srcFileStat.isSymbolicLink()) {
var symlinkFull = fs.readlinkSync(srcFile);
fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
// At this point, we've hit a file actually worth copying... so copy it on over.
} else if (fs.existsSync(destFile) && options.noclobber) {
// be silent
} else {
copyFileSync.call(self, srcFile, destFile);
}
}
}
function copyFileSync(src, dest) {
/* istanbul ignore if */
if (!fs.existsSync(src)) {
this.log('cp: cannot stat ' + src + ': No such file or directory');
return;
}
var BUF_LENGTH = 64 * 1024;
var buf = new Buffer(BUF_LENGTH);
var bytesRead = BUF_LENGTH;
var pos = 0;
var fdr = null;
var fdw = null;
try {
fdr = fs.openSync(src, 'r');
} catch (e) {
/* istanbul ignore next */
this.log('cp: cannot open ' + src + ': ' + e.code);
/* istanbul ignore next */
return;
}
try {
fdw = fs.openSync(dest, 'w');
} catch (e) {
/* istanbul ignore next */
this.log('cp: cannot write to destination file ' + dest + ': ' + e.code);
/* istanbul ignore next */
return;
}
while (bytesRead === BUF_LENGTH) {
bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
fs.writeSync(fdw, buf, 0, bytesRead);
pos += bytesRead;
}
fs.closeSync(fdr);
fs.closeSync(fdw);
fs.chmodSync(dest, fs.statSync(src).mode);
}
module.exports = function (vorpal) {
if (vorpal === undefined) {
return cp;
}
vorpal.api.cp = cp;
vorpal.command('cp [args...]').parse(preparser).option('-f, --force', 'do not prompt before overwriting').option('-n, --no-clobber', 'do not overwrite an existing file').option('-r, --recursive', 'copy directories recursively').option('-R', 'copy directories recursively').autocomplete(fsAutocomplete()).action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: cp,
args: args.args,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/echo.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var echo = {
exec: function exec(arg, options) {
var self = this;
options = options || {};
try {
var text = arg || '';
text = !Array.isArray(text) ? [text] : text;
var result = text.join(' ');
var out = '';
if (options.e && !options.E) {
for (var i = 0; i < result.length; ++i) {
var nxt = result[i] + (result[i + 1] || '');
if (nxt === '\\b') {
out = out.slice(0, out.length - 1);
i++;
} else if (nxt === '\\c') {
break;
} else if (nxt === '\\n') {
out += '\n';
i++;
} else if (nxt === '\\r') {
out += '\r';
i++;
} else if (nxt === '\\t') {
out += ' ';
i++;
} else if (nxt === '\\\\') {
out += '\\';
i += 2;
} else {
out += result[i];
}
}
result = out;
}
// Bug: If nothing is passed, ensure we keep
// a blank line. Vorpal is designed to just
// eat blank lines, so we have a problem.
result = result === '' ? '' : result;
this.log(result);
return 0;
} catch (e) {
/* istanbul ignore next */
return echo.error.call(self, e);
}
},
error: function error(e) {
/* istanbul ignore next */
this.log(e.stack);
/* istanbul ignore next */
return 2;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return echo;
}
vorpal.api.echo = echo;
vorpal.command('echo [arg...]').parse(preparser).option('-e', 'enable interpretation of the following backslash escapes').option('-E', 'explicitly suppress interpretation of backslash escapes').action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: echo,
args: args.arg,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/export.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var _export = {
exec: function exec(args, options) {
args = args || [];
options = options || {};
if (args.length < 1) {
options.p = true;
}
if (typeof args === 'string' || args instanceof String) {
args = [args];
}
// Parse similarly to how `alias` does
var id = args.join(' ');
var value = '';
if (String(id).indexOf('=') > -1) {
var parts = String(id).trim().split('=');
id = parts[0];
value = parts[1] || value;
if (value.match(/^".*"$/)) {
value = JSON.parse(value);
} else {
var regMatch = value.match(/^'(.*)'$/);
if (regMatch && regMatch[1]) {
value = regMatch[1];
}
}
} else {
var _parts = String(id).trim().split(' ');
id = _parts.shift();
value = _parts.join(' ') || null;
}
var validIdRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
if (options.p) {
for (var name in process.env) {
if (process.env.hasOwnProperty(name)) {
this.log('declare -x ' + String(name) + '=' + JSON.stringify(process.env[name]).replace(/\$/g, '\\$'));
}
}
} else if (id.match(validIdRegex)) {
process.env[id] = value !== null ? value : process.env[id];
} else {
this.log('-cash: export: `' + id + '\': not a valid identifier');
return 1;
}
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return _export;
}
vorpal.api.export = _export;
vorpal.command('export [name...]').parse(preparser).option('-p', 'print all defined aliases in a reusable format').action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: _export,
args: args.name,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/false.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var _false = {
exec: function exec() {
// Always return 1
return 1;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return _false;
}
vorpal.api.false = _false;
vorpal.command('false').action(function (args, callback) {
return interfacer.call(this, {
command: _false,
callback: callback
});
});
};
================================================
FILE: dist/commands/grep.js
================================================
'use strict';
module.exports = require('vorpal-grep');
================================================
FILE: dist/commands/head.js
================================================
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var interfacer = require('./../util/interfacer');
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var expand = require('./../util/expand');
var head = {
exec: function exec(args, options) {
options = options || {};
args = args || '';
var source = args.stdin === undefined ? 'files' : 'stdin';
var lines = options.lines ? Math.abs(options.lines) : 10;
if (!Number.isInteger(lines)) {
this.log('head: ' + options.lines + ': invalid number of lines');
return 0;
}
/* istanbul ignore next */
if (source === 'stdin') {
var _stdout = head.readLines(args.stdin[0], lines);
_stdout = _stdout.replace(/\n$/, '');
if (_stdout.trim() !== '') {
this.log(_stdout);
}
return 0;
}
var files = args.files || args;
files = (typeof files === 'undefined' ? 'undefined' : _typeof(files)) === 'object' && files !== null && !Array.isArray(files) ? [] : files;
files = files === undefined ? [] : files;
files = typeof files === 'string' ? String(files).split(' ') : files;
files = files.filter(function (arg) {
return String(arg).trim() !== '';
});
files = expand(files);
var stdout = '';
var verbose = files.length > 1 && !options.silent || options.verbose;
for (var i = 0; i < files.length; i++) {
try {
var content = fs.readFileSync(files[i]).toString();
if (verbose) {
stdout += (i > 0 ? '\n' : '') + '==> ' + files[i] + ' <==\n';
}
stdout += head.readLines(content, lines);
} catch (e) {
stdout += 'head: cannot open ' + files[i] + ' for reading: No such file or directory';
}
}
stdout = stdout.replace(/\n$/, '');
if (stdout.trim() !== '') {
this.log(stdout);
}
return 0;
},
readLines: function readLines(content, numberOfLines) {
var stdout = '';
var contentArray = content.split('\n');
var linesToRead = numberOfLines >= contentArray.length ? contentArray.length : numberOfLines;
for (var i = 0; i < linesToRead; i++) {
if (stdout === '') {
stdout = contentArray[i] + '\n';
continue;
}
stdout += contentArray[i] + '\n';
}
return stdout;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return head;
}
vorpal.api.head = head;
vorpal.command('head [files...]').option('-n, --lines [number]', 'print the first K lines instead of the first 10').option('-q, --silent', 'Suppresses printing of headers when multiple files are being examined.').option('-v, --verbose', 'Always output headers giving file names.').autocomplete(fsAutocomplete()).action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: head,
args: args,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/kill.js
================================================
'use strict';
var fkill = require('fkill');
var os = require('os');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var usage = 'kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]';
var windows = os.platform().indexOf('win') > -1;
var signals = {
SIGKILL: 9,
SIGTERM: 15,
KILL: 9,
TERM: 15,
9: 'KILL',
15: 'TERM'
};
var kill = {
exec: function exec(args, options) {
options = options || {};
var procs = args;
procs = procs === undefined ? [] : procs;
procs = typeof procs === 'string' ? String(procs).split(' ') : procs;
procs = procs.filter(function (arg) {
return String(arg).trim() !== '';
});
function log(str) {
if (options.vorpal) {
options.vorpal.log(str);
} else {
/* istanbul ignore next */
console.log(str);
}
}
if (options.l !== undefined) {
if (options.l === true) {
this.log(' 9) SIGKILL 15) SIGTERM');
return 0;
}
if (signals[options.l]) {
this.log(signals[options.l]);
return 0;
}
this.log('-cash: kill: ' + options.l + ': invalid signal specification');
return 0;
}
if (procs.length < 1) {
this.log(usage);
return 0;
}
var forced = options['9'] === true || options.n === 9 || String(options.s).toLowerCase() === 'sigkill' || String(options.s).toLowerCase() === 'kill';
var opts = { force: forced };
var _loop = function _loop(i) {
var proc = procs[i];
proc = !isNaN(proc) ? parseFloat(proc) : proc;
proc = windows && isNaN(proc) && proc.indexOf('.') === -1 ? proc + '.exe' : proc;
fkill(proc, opts).then(function () {
// .. chill
}).catch(function (err) {
if (String(err.message).indexOf('failed') > -1) {
log('-cash: kill: (' + proc + ') - No such process');
}
});
};
for (var i = 0; i < procs.length; ++i) {
_loop(i);
}
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return kill;
}
vorpal.api.kill = kill;
vorpal.command('kill [process...]').parse(preparser).option('-9', 'sigkill').option('-s [sig]', 'sig is a signal name').option('-n [sig]', 'sig is a signal number').option('-l [sigspec]', 'list the signal names').action(function (args, callback) {
args.options = args.options || {};
args.options.vorpal = vorpal;
return interfacer.call(this, {
command: kill,
args: args.process,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/less.js
================================================
'use strict';
module.exports = require('vorpal-less');
================================================
FILE: dist/commands/ls.js
================================================
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var chalk = require('chalk');
var filesize = require('filesize');
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var os = require('os');
var expand = require('./../util/expand');
var colorFile = require('./../util/colorFile');
var columnify = require('./../util/columnify');
var dateConverter = require('./../util/converter.date');
var fileFromPath = require('./../util/fileFromPath');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var pad = require('./../util/pad');
var lpad = require('./../util/lpad');
var permissionsConverter = require('./../util/converter.permissions');
var strip = require('./../util/stripAnsi');
var walkDir = require('./../util/walkDir');
var walkDirRecursive = require('./../util/walkDirRecursive');
var pads = { pad: pad, lpad: lpad };
var ls = {
self: null,
/**
* Main command execution.
*
* @return {Object} { status, stdout }
* @api public
* @param paths
* @param options
*/
exec: function exec(paths, options) {
ls.self = this;
paths = paths !== null && !Array.isArray(paths) && (typeof paths === 'undefined' ? 'undefined' : _typeof(paths)) === 'object' ? paths.paths : paths;
paths = paths || ['.'];
paths = Array.isArray(paths) ? paths : [paths];
paths = expand(paths);
options = options || {};
var preSortedPaths = ls.preSortPaths(paths);
var dirResults = [];
for (var i = 0; i < preSortedPaths.dirs.length; ++i) {
if (options.recursive) {
var result = ls.execDirRecursive(preSortedPaths.dirs[i], options);
dirResults = dirResults.concat(result);
} else {
dirResults.push(ls.execDir(preSortedPaths.dirs[i], options));
}
}
var stdout = '';
if (preSortedPaths.files.length > 0) {
stdout += ls.execLsOnFiles('.', preSortedPaths.files, options).results;
}
var dirOutput = ls.formatAll(dirResults, options, dirResults.length + preSortedPaths.files.length > 1);
stdout += stdout && dirOutput ? '\n\n' + dirOutput : dirOutput;
if (strip(stdout).trim() !== '') {
ls.self.log(String(stdout).replace(/\\/g, '/'));
}
return 0;
},
preSortPaths: function preSortPaths(paths) {
var dirs = [];
var files = [];
for (var i = 0; i < paths.length; i++) {
var p = paths[i];
try {
var stat = fs.statSync(p);
if (stat.isDirectory()) {
dirs.push(p);
} else if (stat.isFile()) {
files.push({
file: p,
data: stat
});
}
} catch (e) {
e.syscall = 'scandir';
ls.error(p, e);
}
}
files.sort();
dirs.sort();
return { files: files, dirs: dirs };
},
/**
* Returns ls stderr and response codes
* for errors.
*
* @param {String} path
* @param {Error} e
* @param {String} e.code
* @param {String} e.syscall
* @param {String} e.stack
* @api private
*/
error: function error(path, e) {
var status = void 0;
var stdout = void 0;
if (e.code === 'ENOENT' && e.syscall === 'scandir') {
status = 1;
stdout = 'ls: cannot access ' + path + ': No such file or directory';
} else {
status = 2;
stdout = e.stack;
}
ls.self.log(stdout);
return { status: status, stdout: stdout };
},
/**
* Recursively executes `execDir`.
* For use with `ls -R`.
*
* @param {String} path
* @param {Object} options
* @return {Array} results
* @api private
*/
execDirRecursive: function execDirRecursive(path, options) {
var self = this;
var results = [];
walkDirRecursive(path, function (pth) {
var result = self.execDir(pth, options);
results.push(result);
});
return results;
},
/**
* Executes `ls` functionality
* for a given directory.
*
* @param {String} path
* @param {Object} options
* @return {{path: String, size: *, results: *}} results
* @api private
*/
execDir: function execDir(path, options) {
var rawFiles = [];
function pushFile(file, data) {
rawFiles.push({
file: file,
data: data
});
}
// Add in implied current and parent dirs.
pushFile('.', fs.statSync('.'));
pushFile('..', fs.statSync('..'));
// Walk the passed in directory,
// pushing the results into `rawFiles`.
walkDir(path, pushFile, ls.error);
var o = ls.execLsOnFiles(path, rawFiles, options);
o.path = path;
return o;
},
execLsOnFiles: function execLsOnFiles(path, rawFiles, options) {
var files = [];
var totalSize = 0;
// Sort alphabetically be default,
// unless -U is specified, in which case
// we don't sort.
if (!options.U) {
rawFiles = rawFiles.sort(function (a, b) {
// Sort by size.
if (options.S) {
// Hack for windows - a directory lising
// in linux says the size is 4096, and Windows
// it's 0, leading to inconsistent sorts based
// on size, and failing tests.
var win = os.platform() === 'win32';
a.data.size = win && a.data.isDirectory() && a.data.size === 0 ? 4096 : a.data.size;
b.data.size = win && b.data.isDirectory() && b.data.size === 0 ? 4096 : b.data.size;
return a.data.size > b.data.size ? -1 : a.data.size < b.data.size ? 1 : 0;
}
if (options.t) {
// Sort by date modified.
return a.data.mtime < b.data.mtime ? 1 : b.data.mtime < a.data.mtime ? -1 : 0;
}
// Sort alphabetically - default.
var aFileName = fileFromPath(a.file).trim().toLowerCase().replace(/\W/g, '');
var bFileName = fileFromPath(b.file).trim().toLowerCase().replace(/\W/g, '');
return aFileName > bFileName ? 1 : aFileName < bFileName ? -1 : 0;
});
}
// Reverse whatever sort the user specified.
if (options.reverse) {
rawFiles.reverse();
}
var _loop = function _loop(i) {
var file = rawFiles[i].file;
var data = rawFiles[i].data;
var fileShort = fileFromPath(file);
var dotted = fileShort && fileShort.charAt(0) === '.';
var implied = fileShort === '..' || fileShort === '.';
var type = data.isDirectory() ? 'd' : '-';
var permissions = permissionsConverter.modeToRWX(data.mode);
var hardLinks = data.nlink;
var size = options.humanreadable ? filesize(data.size, { unix: true }) : data.size;
var modified = dateConverter.unix(data.mtime);
var owner = data.uid;
var group = data.gid;
var inode = data.ino;
totalSize += data.size;
var fileName = fileShort;
// If --classify, add '/' to end of folders.
fileName = options.classify && data.isDirectory() ? fileName + '/' : fileName;
// If getting --directory, give full path.
fileName = options.directory && file === '.' ? path : fileName;
// Color the files based on $LS_COLORS
fileName = data.isFile() ? colorFile(fileName) : fileName;
// If not already colored and is executable,
// make it green
var colored = strip(fileName) !== fileName;
if (String(permissions).indexOf('x') > -1 && !colored && data.isFile()) {
fileName = chalk.green(fileName);
}
// If --quote-name, wrap in double quotes;
fileName = options.quotename ? '"' + fileName + '"' : fileName;
// Make directories cyan.
fileName = data.isDirectory() ? chalk.cyan(fileName) : fileName;
var include = function () {
var directory = options.directory;
var all = options.all;
var almostAll = options.almostall;
var result = false;
if (directory && file !== '.') {
result = false;
} else if (!dotted) {
result = true;
} else if (all) {
result = true;
} else if (!implied && almostAll) {
result = true;
} else if (directory && file === '.') {
result = true;
}
return result;
}();
var details = [type + permissions, hardLinks, owner, group, size, modified, fileName];
if (options.inode) {
details.unshift(inode);
}
var result = options.l && !options.x ? details : fileName;
if (include) {
files.push(result);
}
};
for (var i = 0; i < rawFiles.length; ++i) {
_loop(i);
}
return ls.formatDetails(files, totalSize, options);
},
formatDetails: function formatDetails(files, totalSize, options) {
var result = void 0;
// If we have the detail view, draw out
// all of the details of each file.
// Otherwise, just throw the file names
// into columns.
if (Array.isArray(files[0])) {
var longest = {};
for (var i = 0; i < files.length; ++i) {
for (var j = 0; j < files[i].length; ++j) {
var len = String(files[i][j]).length;
longest[j] = longest[j] || 0;
longest[j] = len > longest[j] ? len : longest[j];
}
}
var newFiles = [];
for (var _i = 0; _i < files.length; ++_i) {
var glob = '';
for (var _j = 0; _j < files[_i].length; ++_j) {
var padFn = _j === files[_i].length - 1 ? 'pad' : 'lpad';
if (_j === files[_i].length - 1) {
glob += String(files[_i][_j]);
} else {
glob += pads[padFn](String(files[_i][_j]), longest[_j], ' ') + ' ';
}
}
newFiles.push(String(glob));
}
result = newFiles.join('\n');
} else if (options['1']) {
result = files.join('\n');
} else {
var opt = {};
if (options.width) {
opt.width = options.width;
}
result = columnify(files, opt);
}
return {
size: options.humanreadable ? filesize(totalSize, { unix: true }) : totalSize,
results: result
};
},
/**
* Concatenates the results of multiple
* `execDir` functions into their proper
* form based on options provided.
*
* @param {Array} results
* @param {Object} options
* @param {boolean} showName
* @return {String} stdout
* @api private
*/
formatAll: function formatAll(results, options, showName) {
var stdout = '';
if (showName) {
for (var i = 0; i < results.length; ++i) {
stdout += results[i].path + ':\n';
if (options.l) {
stdout += 'total ' + results[i].size + '\n';
}
stdout += results[i].results;
if (i !== results.length - 1) {
stdout += '\n\n';
}
}
} else if (results.length === 1) {
if (options.l && !options.x) {
stdout += 'total ' + results[0].size + '\n';
}
stdout += results[0].results;
}
return stdout;
}
};
/**
* Expose as a Vorpal extension.
*/
module.exports = function (vorpal) {
if (vorpal === undefined) {
return ls;
}
vorpal.api.ls = ls;
vorpal.command('ls [paths...]').parse(preparser).option('-a, --all', 'do not ignore entries starting with .').option('-A, --almost-all', 'do not list implied . and ..').option('-d, --directory', 'list directory entries instead of contents, and do not dereference symbolic links').option('-F, --classify', 'append indicator (one of */=>@|) to entries').option('-h, --human-readable', 'with -l, print sizes in human readable format (e.g., 1K 234M 2G)').option('-i, --inode', 'print the index number of each file').option('-l', 'use a long listing format').option('-Q, --quote-name', 'enclose entry names in double quotes').option('-r, --reverse', 'reverse order while sorting').option('-R, --recursive', 'list subdirectories recursively').option('-S', 'sort by file size').option('-t', 'sort by modification time, newest first').option('-U', 'do not sort; list entries in directory order').option('-w, --width [COLS]', 'assume screen width instead of current value').option('-x', 'list entries by lines instead of columns').option('-1', 'list one file per line').autocomplete(fsAutocomplete()).action(function (args, cb) {
return interfacer.call(this, {
command: ls,
args: args.paths,
options: args.options,
callback: cb
});
});
};
================================================
FILE: dist/commands/mkdir.js
================================================
'use strict';
var fs = require('fs');
var path = require('path');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var mkdir = {
exec: function exec(args, options) {
var self = this;
var dirs = args || [];
options = options || {};
if (typeof dirs === 'string') {
dirs = dirs.split(' ');
}
dirs = dirs.filter(function (str) {
return String(str).trim() !== '';
});
if (dirs.length < 1) {
this.log('mkdir: missing operand\nTry \'mkdir --help\' for more information.');
}
dirs.forEach(function (dir) {
if (fs.existsSync(dir)) {
if (!options.parents) {
self.log('mkdir: cannot create directory ' + dir + ': File exists');
}
return;
}
// Base dir does not exist, and no -p option given
var baseDir = path.dirname(dir);
if (!fs.existsSync(baseDir) && !options.parents) {
self.log('mkdir: cannot create directory ' + dir + ': No such file or directory');
return;
}
if (options.parents) {
mkdirSyncRecursive.call(self, dir, options);
} else {
fs.mkdirSync(dir, parseInt('0777', 8));
if (options.verbose) {
self.log('mkdir: created directory ' + dir);
}
}
});
return 0;
}
};
function mkdirSyncRecursive(dir, options) {
var baseDir = path.dirname(dir);
if (fs.existsSync(baseDir)) {
fs.mkdirSync(dir, parseInt('0777', 8));
if (options.verbose) {
this.log('mkdir: created directory ' + dir);
}
return;
}
mkdirSyncRecursive.call(this, baseDir, options);
fs.mkdirSync(dir, parseInt('0777', 8));
if (options.verbose) {
this.log('mkdir: created directory ' + dir);
}
}
module.exports = function (vorpal) {
if (vorpal === undefined) {
return mkdir;
}
vorpal.api.mkdir = mkdir;
vorpal.command('mkdir [directory...]').parse(preparser).option('-p, --parents', 'no error if existing, make parent directories as needed').option('-v, --verbose', 'print a message for each created directory').autocomplete(fsAutocomplete({ directory: true })).action(function (args, callback) {
args.options = args.options || {};
args.options.vorpal = vorpal;
return interfacer.call(this, {
command: mkdir,
args: args.directory,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/mv.js
================================================
'use strict';
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var path = require('path');
var expand = require('./../util/expand');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var mv = {
exec: function exec(args, options) {
var self = this;
options = options || {};
args = args === undefined ? [] : args;
args = Array.isArray(args) ? args : args.split(' ');
args = args.filter(function (arg) {
return String(arg).trim() !== '';
});
options.noclobber = options.force === true ? false : options.noclobber;
if (args.length < 1) {
this.log('mv: missing file operand\nTry \'mv --help\' for more information.');
return 1;
}
if (args.length === 1) {
this.log('mv: missing destination file operand after ' + args[0] + '\nTry \'mv --help\' for more information.');
return 1;
}
args = expand(args);
var dest = args.pop();
var sources = args;
var exists = fs.existsSync(dest);
var stats = exists && fs.statSync(dest);
// Dest is not existing dir, but multiple sources given
if ((!exists || !stats.isDirectory()) && sources.length > 1) {
this.log('mv: target ' + dest + ' is not a directory');
return 1;
}
// Dest is an existing file, but no -f given
if (exists && stats.isFile() && options.noclobber) {
// just dont do anything
return 0;
}
if (options.striptrailingslashes) {
sources = sources.map(function (src) {
return String(src).replace(/\/$/g, '');
});
}
sources.forEach(function (src) {
if (!fs.existsSync(src)) {
self.log('mv: cannot stat ' + src + ': No such file or directory');
return;
}
// When copying to '/path/dir', iDest = '/path/dir/file1'
var iDest = dest;
if (exists && stats.isDirectory()) {
iDest = path.normalize(dest + '/' + path.basename(src));
}
// If the file exists and we're not clobbering, skip.
if (fs.existsSync(iDest) && options.noclobber) {
return;
}
if (path.resolve(src) === path.dirname(path.resolve(iDest))) {
self.log('mv: ' + src + ' and ' + iDest + ' are the same file');
return;
}
fs.renameSync(src, iDest);
if (options.verbose === true) {
self.log(String(src + ' -> ' + iDest).replace(/\\/g, '/'));
}
});
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return mv;
}
vorpal.api.mv = mv;
vorpal.command('mv [args...]').parse(preparser).option('-f, --force', 'do not prompt before overwriting').option('-n, --no-clobber', 'do not overwrite an existing file').option('--striptrailingslashes', 'remove any trailing slashes from each source') // vorpal bug, need to add dashes between words
.option('-v, --verbose', 'explain what is being done').autocomplete(fsAutocomplete()).action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: mv,
args: args.args,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/pwd.js
================================================
'use strict';
var path = require('path');
var interfacer = require('./../util/interfacer');
var pwd = {
exec: function exec() {
this.log(path.resolve(process.cwd()).replace(/\\/g, '/'));
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return pwd;
}
vorpal.api.pwd = pwd;
vorpal.command('pwd [files...]').action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: pwd,
args: args.files,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/rm.js
================================================
'use strict';
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var expand = require('./../util/expand');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var unlinkSync = require('./../util/unlinkSync');
var rm = {
exec: function exec(args, options) {
var self = this;
options = options || {};
options.recursive = options.R ? options.R : options.recursive;
var files = args;
files = files === undefined ? [] : files;
files = typeof files === 'string' ? [files] : files;
files = expand(files);
files.forEach(function (file) {
if (!fs.existsSync(file)) {
// Path does not exist, no force flag given
if (!options.force) {
self.log('rm: cannot remove ' + file + ': No such file or directory');
return 2;
}
/* istanbul ignore next */
return 0;
}
var stats = fs.lstatSync(file);
if (stats.isFile() || stats.isSymbolicLink()) {
if (options.force) {
unlinkSync(file);
return 0;
}
if (isWriteable(file)) {
unlinkSync(file);
} else {
/* istanbul ignore next */
self.log('rm: cannot remove ' + file + ': permission denied');
/* istanbul ignore next */
return 2;
}
return 0;
}
// Path is an existing directory, but no -r flag given
if (stats.isDirectory() && !options.recursive) {
self.log('rm: cannot remove: path is a directory');
return 2;
}
// Recursively remove existing directory
if (stats.isDirectory() && options.recursive) {
rmdirSyncRecursive.call(self, file, options.force, options.dir);
}
});
}
};
function rmdirSyncRecursive(dir, force, removeEmptyDir) {
var self = this;
var files = void 0;
files = fs.readdirSync(dir);
// Loop through and delete everything in the sub-tree after checking it
for (var i = 0; i < files.length; i++) {
var file = dir + '/' + files[i];
var currFile = fs.lstatSync(file);
if (currFile.isDirectory()) {
// Recursive function back to the beginning
rmdirSyncRecursive(file, force, removeEmptyDir);
} else if (currFile.isSymbolicLink()) {
// Unlink symlinks
/* istanbul ignore next */
if (force || isWriteable(file)) {
try {
unlinkSync(file);
} catch (e) {
self.log('rm: cannot remove ' + file + ': code ' + e.code);
return 2;
}
}
} else if (force || isWriteable(file)) {
// Assume it's a file.
try {
unlinkSync(file);
} catch (e) {
/* istanbul ignore next */
self.log('rm: cannot remove ' + file + ': code ' + e.code);
/* istanbul ignore next */
return 2;
}
}
}
// Now that we know everything in the sub-tree has been deleted,
// we can delete the main directory.
var result = void 0;
try {
// Retry on windows, sometimes it takes a little time before all the files in the directory are gone
var start = Date.now();
while (true) {
try {
result = fs.rmdirSync(dir);
/* istanbul ignore next */
if (fs.existsSync(dir)) {
throw new Error('EAGAIN');
}
break;
} catch (er) {
// In addition to error codes, also check if the directory still exists and loop again if true
/* istanbul ignore next */
if (process.platform === 'win32' && (er.code === 'ENOTEMPTY' || er.code === 'EBUSY' || er.code === 'EPERM' || er.code === 'EAGAIN')) {
if (Date.now() - start > 1000) {
throw er;
}
/* istanbul ignore next */
} else if (er.code === 'ENOENT') {
// Directory did not exist, deletion was successful
break;
/* istanbul ignore next */
} else {
throw er;
}
}
}
} catch (e) {
/* istanbul ignore next */
self.log('rm: cannot remove directory ' + dir + ': code ' + e.code);
/* istanbul ignore next */
return 2;
}
return result;
}
// Hack to determine if file has write permissions for current user
// Avoids having to check user, group, etc, but it's probably slow.
function isWriteable(file) {
var writePermission = true;
try {
var __fd = fs.openSync(file, 'a');
fs.closeSync(__fd);
} catch (e) {
/* istanbul ignore next */
writePermission = false;
}
return writePermission;
}
module.exports = function (vorpal) {
if (vorpal === undefined) {
return rm;
}
vorpal.api.rm = rm;
vorpal.command('rm [files...]').parse(preparser).option('-f, --force', 'ignore nonexistent files and arguments, never prompt').option('-r, --recursive', 'remove directories and their contents recursively').option('-R', 'remove directories and their contents recursively').autocomplete(fsAutocomplete()).action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: rm,
args: args.files,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/sort.js
================================================
'use strict';
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var fetch = require('./../util/fetch');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var strip = require('./../util/stripAnsi');
var shuffle = require('array-shuffle');
var sort = {
counter: 0,
stdin: '',
exec: function exec(args, options) {
var self = this;
// Hack to handle multiple calls
// due to fragmented stdin, such as
// by piping. In essence, we're waiting
// 100 milliseconds for all of the
// requests to come in, and then running
// sort. Only applies when sort is called
// through a piped command.
/* istanbul ignore next */
if (args && args.stdin && options.bypass !== true) {
sort.counter++;
sort.stdin += args.stdin + '\n';
if (sort.counter === 1) {
setTimeout(function () {
sort.counter = 0;
args.stdin = sort.stdin;
sort.stdin = '';
options.bypass = true;
sort.exec.call(self, args, options);
}, 100);
}
return;
}
sort.counter = 0;
sort.stdin = '';
// Input normalization
if (args === undefined) {
args = {
files: []
};
} else if (typeof args === 'string' || args instanceof String) {
args = {
files: [args]
};
} else if (Array.isArray(args)) {
args = {
files: args
};
}
options = options || {};
function log(stdout) {
if (options.output) {
if (options.output === true) {
self.log('sort: option \'--output\' requires an argument\nTry \'sort --help\' for more information.');
return 0;
}
try {
fs.writeFileSync(options.output, stdout);
return 0;
} catch (e) {
if (e.code === 'ENOENT') {
self.log('sort: open failed: ' + options.output + ': No such file or directory');
} else {
/* istanbul ignore next */
self.log('sort: open failed: ' + options.output + ': ' + e.code);
}
return 2;
}
} else {
self.log(stdout);
}
}
try {
var stdin = fetch(args.files, args.stdin, {
onDirectory: function onDirectory(name) {
/* istanbul ignore next */
return 'sort: read failed: ' + name + ': Is a directory';
},
onInvalidFile: function onInvalidFile(name) {
/* istanbul ignore next */
return 'sort: cannot read: ' + name + ': No such file or directory';
}
});
var combined = '';
for (var i = 0; i < stdin.length; ++i) {
// Get rid of trailing line break because
// node logging does it anyway.
combined += stdin[i];
}
combined = combined.replace(/\s$/, '');
var parts = String(combined).split('\n');
if (options.check) {
// Check if the thing was already sorted.
var original = String(combined).split('\n');
var disorder = void 0;
for (var _i = 0; _i < original.length; ++_i) {
var a = original[_i];
var b = original[_i + 1];
if (a && b) {
if (!isNaN(a) && !isNaN(b) && parseFloat(a) > parseFloat(b)) {
/* istanbul ignore next */
disorder = true;
} else if (a > b) {
disorder = true;
}
if (disorder) {
// To do: right now, I don't say the file
// name of the bad sorted item - I have to
// figure this out as I join all the files
// together beforehand and lose track.
disorder = 'sort: -:' + (_i + 2) + ': disorder: ' + b;
break;
}
}
}
if (disorder) {
log(disorder);
return;
}
}
parts = parts.sort(function (a, b) {
var aAlpha = strip(a).replace(/\W+/g, '');
var bAlpha = strip(b).replace(/\W+/g, '');
var aNumeric = strip(a).replace(/\D/g, '');
var bNumeric = strip(b).replace(/\D/g, '');
if (options.humannumericsort) {
var aHuman = parseHumanReadableNumbers(strip(a));
var bHuman = parseHumanReadableNumbers(strip(b));
if (aHuman.group < bHuman.group) {
return -1;
} else if (aHuman.group > bHuman.group) {
return 1;
} else if (aHuman.num < bHuman.num) {
return -1;
} else if (aHuman.num > bHuman.num) {
return 1;
}
return aAlpha.localeCompare(bAlpha);
} else if (options.monthsort) {
var aMonth = parseMonths(strip(a));
var bMonth = parseMonths(strip(b));
var result = aMonth - bMonth;
if (aMonth === bMonth) {
result = aAlpha.localeCompare(bAlpha);
}
return result;
} else if (options.numericsort) {
var _result = aNumeric - bNumeric;
_result = _result === 0 ? aAlpha.localeCompare(bAlpha) : _result;
return _result;
}
return aAlpha.localeCompare(bAlpha);
});
if (options.randomsort) {
parts = shuffle(parts);
}
if (options.reverse) {
parts.reverse();
}
var out = parts.join('\n');
if (String(out).trim() !== '') {
log(out);
}
return;
} catch (e) {
/* istanbul ignore next */
self.log(e.stack);
/* istanbul ignore next */
return;
}
}
};
// This shit is gnarly.
// Per the coreutils sort.c:
// <none/unknown> < K/k < M < G < T < P < E < Z < Y
var humanOrdering = { '': 0, 'K': 1, 'k': 1, 'M': 2, 'G': 3, 'T': 4, 'P': 5, 'E': 6, 'Z': 7 };
var humanReadableSort = new RegExp(/^([0-9]+)?[\.]?[0-9]+[K|k|M|G|T|P|E|Z|Y]/g);
function parseHumanReadableNumbers(nbr) {
nbr = String(nbr).replace(/(\r\n|\n|\r)/gm, '');
if (String(nbr).match(humanReadableSort)) {
var num = parseFloat(String(nbr).replace(/[a-zA-Z]/g, '').trim());
var group = humanOrdering[String(nbr).replace(/[^a-zA-Z]/g, '').trim()] || 0;
return {
num: num,
group: group
};
}
var isNumber = String(nbr).match(/^[0-9]/);
var stripped = isNumber ? parseFloat(String(nbr).replace(/[^0-9.]/g, '')) : 'NaN';
var result = !isNaN(stripped) ? stripped : -99999999999;
return {
num: result,
group: 0
};
}
var monthOrdering = {
jan: 1,
feb: 2,
mar: 3,
apr: 4,
may: 5,
jun: 6,
jul: 7,
aug: 8,
sep: 9,
oct: 10,
nov: 11,
dec: 12
};
var months = new RegExp(/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i);
function parseMonths(str) {
var match = String(str).match(months);
if (match) {
return monthOrdering[String(str.slice(0, 3).toLowerCase())];
}
return 0;
}
module.exports = function (vorpal) {
if (vorpal === undefined) {
return sort;
}
vorpal.api.sort = sort;
vorpal.command('sort [files...]').parse(preparser).option('-M, --month-sort', 'compare (unknown) < \'JAN\' < ... < \'DEC\'').option('-h, --human-numeric-sort', 'compare human readable numbers (e.g., 2K 1G)').option('-n, --numeric-sort', 'compare according to string numerical value').option('-R, --random-sort', 'sort by random hash of keys').option('-r, --reverse', 'reverse the result of comparisons').option('-c, --check', 'check for sorted input; do not sort').option('-o, --output [file]', 'write result to file instead of standard output').autocomplete(fsAutocomplete()).action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: sort,
args: args,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/source.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var fs = require('fs');
var usage = '-cash: source: filename argument required\nsource: usage: source filename [arguments]';
var source = {
exec: function exec(args, options) {
options = options || {};
args = args || {};
if (typeof args === 'string') {
var params = args.split(/\s+/);
args = {};
args.file = params[0];
if (params.length > 1) {
args.params = params.slice(1);
}
}
var vorpal = options.vorpal;
/* istanbul ignore next */
if (!vorpal) {
throw new Error('Source is not programatically supported.');
}
if (!args.file) {
this.log(usage);
return 2;
}
try {
// Once support for referencing parameters ($1, $2, etc.) gets added, this
// should swap these out with the value of args.params
fs.readFileSync(args.file, 'utf8').split('\n').forEach(function (line) {
if (line) {
vorpal.execSync(line); // execute each line in the current environment
}
});
} catch (e) {
if (e.code === 'ENOENT') {
this.log('-cash: ' + args.file + ': No such file or directory');
} else if (e.code === 'EACCES') {
this.log('-cash: ' + args.file + ': Permission denied');
} else if (e.code === 'EISDIR') {
this.log('-cash: source: ' + args.file + ': is a directory');
} else {
/* istanbul ignore next */
this.log('-cash: source: unable to read ' + args.file);
}
return 1;
}
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return source;
}
vorpal.api.source = source;
vorpal.command('source [file] [params...]').alias('.').parse(preparser).action(function (args, callback) {
args.options = args.options || {};
args.options.vorpal = vorpal;
return interfacer.call(this, {
command: source,
args: args,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/tail.js
================================================
'use strict';
var fs = require('fs');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var interfacer = require('./../util/interfacer');
var expand = require('./../util/expand');
var unixPath = require('./../util/converter.path').unix;
var tail = {
exec: function exec(args, options) {
options = options || {};
var lines = options.lines ? Math.abs(options.lines) : 10;
if (!Number.isInteger(lines)) {
this.log('tail: ' + options.lines + ': invalid number of lines');
return 0;
}
var files = args;
files = files === undefined ? [] : files;
files = typeof files === 'string' ? String(files).split(' ') : files;
files = files.filter(function (file) {
return String(file).trim() !== '';
});
files = expand(files);
var out = '';
for (var i = 0; i < files.length; i++) {
var fileFound = false;
var isFile = false;
try {
fs.accessSync(files[i], fs.F_OK);
fileFound = true;
} catch (e) {
out += 'tail: cannot open ' + unixPath(files[i]) + ' for reading: No such file or directory\n';
}
if (fileFound) {
isFile = fs.statSync(files[i]).isFile();
}
if (isFile) {
var name = unixPath(files[i]);
var content = fs.readFileSync(files[i], 'utf8').trim().split('\n');
var verbose = files.length > 1 && !options.silent || options.verbose;
if (verbose) {
out += '==> ' + name + ' <==\n';
}
var sliced = content.slice(content.length - lines, content.length);
out += sliced.join('\n') + '\n';
}
}
out = out.replace(/\n$/, '');
if (out.trim() !== '') {
this.log(out);
}
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return tail;
}
vorpal.api.tail = tail;
vorpal.command('tail [files...]').option('-n, --lines <number>', 'Output the last N lines, instead of the last 10').option('-q, --silent', 'Suppresses printing of headers when multiple files are being examined.').option('-v, --verbose', 'Always output headers giving file names.').autocomplete(fsAutocomplete()).action(function (args, callback) {
args.options = args.options || {};
return interfacer.call(this, {
command: tail,
args: args.files,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/touch.js
================================================
'use strict';
var fs = require('fs-extra');
var fsAutocomplete = require('vorpal-autocomplete-fs');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
require('./../lib/sugar');
var touch = {
/**
* Main command execution.
*
* @param {Object} args
* @return {Object} { status, stdout }
* @api public
*/
exec: function exec(files, options) {
var self = this;
files = files || ['.'];
files = !Array.isArray(files) ? [files] : files;
options = options || {};
// If any version of --no-create is passed, change it to false.
options.create = options.create === true ? false : options.create;
// If --time is passed, ensure a valid param is called in
// and map it to -a or -m, as this is the equivalent of these.
// Throw an error if nothing valid passed.
if (options.time) {
var a = ['access', 'atime', 'use'];
var m = ['modify', 'mtime'];
var opt = a.indexOf(options.time) > -1 ? 'a' : m.indexOf(options.time) > -1 ? 'm' : undefined;
if (!opt) {
var error = 'touch: invalid argument "' + options.time + '" for "--time"\n' + 'Valid arguments are:\n' + ' - "atime", "access", "use"\n' + ' - "mtime", "modify"\n' + 'Try \'touch --help\' for more information.';
// I think this is the stupidest thing
// I've ever written.
try {
throw new Error(error);
} catch (e) {
return touch.error.call(self, e);
}
} else {
options[opt] = true;
}
}
try {
var err = false;
for (var i = 0; i < files.length; ++i) {
try {
touch.file(files[i], options);
} catch (e) {
err = e;
break;
}
}
if (err) {
return touch.error.call(self, err);
}
return 0;
} catch (e) {
return touch.error.call(self, e);
}
},
/**
* Returns touch stderr and response codes
* for errors.
*
* @param {Error} e
* @return {Object} { status, stdout }
* @api private
*/
error: function error(e) {
this.log(e.message);
return 2;
},
/**
* Handler for a single file using touch.
*
* @param {String} path
* @param {Object} options
* @api private
*/
file: function file(path, options) {
try {
try {
fs.lstatSync(path);
} catch (e) {
// If the file doesn't exist and
// the user doesn't want to create it,
// we have no purpose in life. Goodbye.
if (options.create === false) {
throw new Error(e);
} else {
fs.closeSync(fs.openSync(path, 'wx'));
}
}
var stat = fs.statSync(path);
var dateToSet = options.date ? Date.create(options.date) : new Date();
if (String(dateToSet) === 'Invalid Date') {
throw new Error('touch: invalid date format ' + options.date);
}
// If -m, keep access time current.
var atime = options.m === true ? new Date(stat.atime) : dateToSet;
// If -a, keep mod time to current.
var mtime = options.a === true ? new Date(stat.mtime) : dateToSet;
if (options.reference !== undefined) {
var reference = void 0;
try {
reference = fs.statSync(options.reference);
} catch (e) {
throw new Error('touch: failed to get attributes of ' + options.reference + ': No such file or directory');
}
atime = options.m === true ? atime : reference.atime;
mtime = options.a === true ? mtime : reference.mtime;
}
fs.utimesSync(path, atime, mtime);
fs.utimesSync(path, atime, mtime);
} catch (e) {
throw new Error(e);
}
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return touch;
}
vorpal.api.touch = touch;
vorpal.command('touch <files...>').parse(preparser).option('-a', 'change only the access time').option('-c, --no-create', 'do not create any files').option('-d, --date [STRING]', 'parse STRING and use it instead of current time').option('-m', 'change only the modification time').option('-r, --reference [FILE]', 'use this file\'s times instead of current time').option('--time [WORD]', 'change the specified time: WORD is access, atime, or use: equivalent to -a WORD is modify or mtime: equivalent to -m').autocomplete(fsAutocomplete()).action(function (args, callback) {
return interfacer.call(this, {
command: touch,
args: args.files || [],
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/true.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var _true = {
exec: function exec() {
// Always return 0
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return _true;
}
vorpal.api.true = _true;
vorpal.command('true').action(function (args, callback) {
return interfacer.call(this, {
command: _true,
callback: callback
});
});
};
================================================
FILE: dist/commands/unalias.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var unalias = {
exec: function exec(args, options) {
var _this = this;
args = args;
options = options || {};
var vorpal = options.vorpal;
if (!vorpal) {
/* istanbul ignore next */
throw new Error('Unalias is not programatically supported.');
}
vorpal._aliases = vorpal._aliases || [];
if (typeof args === 'string' || args instanceof String) {
args = String(args).split(' ');
args = args.filter(function (str) {
return String(str).trim() !== '';
});
}
// Validate no input with help.
if ((args === undefined || args.length < 1 || args === '') && !options.a) {
this.log('unalias: usage: unalias [-a] name [name ...]');
return 1;
}
// Pull list of aliases
var all = void 0;
try {
all = JSON.parse(vorpal.localStorage.getItem('aliases') || []);
} catch (e) {
/* istanbul ignore next */
all = [];
/* istanbul ignore next */
vorpal.localStorage.removeItem('aliases');
}
if (options.a) {
args = all;
}
// Remove each alias in the list.
var _loop = function _loop(i) {
var key = args[i];
var item = vorpal.localStorage.getItem('alias|' + key);
if (item !== undefined && item !== null) {
vorpal.localStorage.removeItem('alias|' + key);
} else {
_this.log('-cash: unalias: ' + key + ': not found');
}
all = all.filter(function (str) {
return !(str === key);
});
};
for (var i = 0; i < args.length; ++i) {
_loop(i);
}
// Rebuild alias lists.
var aliases = {};
/* istanbul ignore next */
for (var _i = 0; _i < all.length; ++_i) {
var item = vorpal.localStorage.getItem('alias|' + all[_i]);
if (item !== undefined && item !== null) {
aliases[all[_i]] = item;
}
}
vorpal._aliases = aliases;
vorpal.localStorage.setItem('aliases', JSON.stringify(all));
return 0;
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return unalias;
}
vorpal.api.unalias = unalias;
vorpal.command('unalias [name...]').parse(preparser).option('-a', 'remove all alias definitions').action(function (args, callback) {
args.options = args.options || {};
args.options.vorpal = vorpal;
return interfacer.call(this, {
command: unalias,
args: args.name,
options: args.options,
callback: callback
});
});
};
================================================
FILE: dist/commands/which.js
================================================
'use strict';
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var which = {
exec: function exec(args, options) {
options = options || {};
var command = (args instanceof Array ? args : [args]).join(' ');
if (command.length <= 0) {
return 0;
}
try {
this.log(require('which').sync(command));
return 0;
} catch (error) {
this.log(error);
return 1;
}
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return which;
}
vorpal.api.which = which;
vorpal.command('which [command]').parse(preparser).action(function (args, callback) {
return interfacer.call(this, {
command: which,
args: args.command,
options: {},
callback: callback
});
});
};
================================================
FILE: dist/delimiter.js
================================================
'use strict';
var os = require('os');
var username = require('username');
var userHome = require('user-home');
var isWindows = process.platform === 'win32';
var pathConverter = require('./util/converter.path');
module.exports = {
refresh: function refresh(vorpal, cb) {
cb = cb || function () {};
username().then(function (username) {
var user = username;
var host = String(os.hostname()).split('.')[0];
var home = pathConverter.unix(userHome);
var cwd = pathConverter.unix(process.cwd());
cwd = cwd.replace(home, '~');
var delimiter = user + '@' + host + ':' + cwd + '$';
// If we're on linux-based systems, color
// the prompt so we don't get confused.
if (!isWindows) {
delimiter = '\u001b[32m' + delimiter + '\u001b[39m';
}
vorpal.delimiter(delimiter);
cb(null);
}).catch(function (err) {
return cb(err);
});
},
getHomeDir: function getHomeDir() {
return userHome;
}
};
================================================
FILE: dist/help/alias.js
================================================
"use strict";
module.exports = "\nUsage: alias [OPTION] [name[=value] ...]\nDefine or display aliases.\n\nWithout arguments, `alias' prints the list of aliases in the reusable\nform `alias NAME=VALUE' on standard output.\n\nOtherwise, an alias is defined for each NAME whose VALUE is given.\nA trailing space in VALUE causes the next word to be checked for\nalias substitution when the alias is expanded.\n\n -p print all defined aliases in a reusable format\n --help display this help and exit\n\nReport alias bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/cat.js
================================================
"use strict";
module.exports = "\nUsage: cat [OPTION]... [FILE]...\nConcatenate FILE(s), or standard input, to standard output.\n\n -A, --show-all equivalent to -vET\n -b, --number-nonblank number nonempty output lines, overrides -n\n -e equivalent to -vE\n -E, --show-ends display $ at end of each line\n -n, --number number all output lines\n -s, --squeeze-blank suppress repeated empty output lines\n -t equivalent to -vT\n -T, --show-tabs display TAB characters as ^I\n -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB\n --help display this help and exit\n\nWith no FILE, or when FILE is -, read standard input.\n\nExamples:\n cat f - g Output f's contents, then standard input, then g's contents.\n cat Copy standard input to standard output.\n\nReport cat bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/cd.js
================================================
"use strict";
module.exports = "\nUsage: cd [DIR]...\nChange the cash working directory.\n\nChange the current directory to DIR. The default DIR is the value of the\nHOME shell variable.\n\nReport cd bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/clear.js
================================================
"use strict";
module.exports = "\nUsage: clear\nClear the terminal screen\n\n --help display this help and exit\n\nClear ignores any command-line parameters that may be present.\n\nReport clear bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/cp.js
================================================
"use strict";
module.exports = "\nUsage: cp [OPTION]... [-T] SOURCE DEST\n or: cp [OPTION]... SOURCE... DIRECTORY\nCopy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\n -f, --force if an existing destination file cannot be\n opened, remove it and try again (this option\n is ignored when the -n option is also used)\n -n, --no-clobber do not overwrite an existing file (overrides\n a previous -i option)\n -R, -r, --recursive copy directories recursively\n --help display this help and exit\n\nReport cp bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/echo.js
================================================
"use strict";
module.exports = "\nUsage: echo [OPTION]... [ARG ...]\nWrite arguments to the standard output.\n\nDisplay the ARGs, separated by a single space character and followed by a\nnewline, on the standard output.\n\n -e enable interpretation of the following backslash escapes\n -e explicitly suppress interpretation of backslash escapes\n --help display this help and exit\n\n `echo' interprets the following backslash-escaped characters:\n \b backspace\n c suppress further output\n \n new line\n \r carriage return\n \t horizontal tab\n \\ backslash\n\nReport echo bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/export.js
================================================
"use strict";
module.exports = "\nUsage: export [OPTION] [name[=value]]\nExport variables into the environment\n\nWithout arguments, `export' prints the list of environnmental variables in the\nform `declare -x NAME=\"VALUE\"' on standard output. This is the same as the\nbehavior if `-p' is given.\n\nOtherwise, the variable is exported to the environment. If the variable has\nalready been defined in the environment (ex. `PATH'), then this will either\nredefine its value or do nothing (if no value is passed in). If the variable is\nnot already in the environment, it will be added with the `VALUE' given\n(defaults to the empty string).\n\n -p print all exported variables in a reusable format\n --help display this help and exit\n\nReport export bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/false.js
================================================
"use strict";
module.exports = "\nUsage: false [OPTION]\nDo nothing, unsuccessfully\n\nThis command simply exits with status 1 (failure).\n\n --help display this help and exit\n\nReport false bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/grep.js
================================================
"use strict";
module.exports = "\nUsage: grep [OPTION]... PATTERN [FILE]...\nSearch for PATTERN in each FILE or standard input.\nPATTERN is, by default, a basic regular expression (BRE).\nExample: grep -i 'hello world' menu.h main.c\n\niwsvmbnHhqr\n\nRegexp selection and interpretation:\n -i, --ignore-case ignore case distinctions\n -w, --word-regexp force PATTERN to match only whole words\n\nMiscellaneous:\n -s, --no-messages suppress error messages\n -v, --invert-match select non-matching lines\n --help display this help and exit\n\nOutput control:\n -n, --line-number print line number with output lines\n -H, --with-filename print the file name for each match\n -h, --no-filename suppress the file name prefix on output\n -q, --quiet, --silent suppress all normal output\n -r, --recursive like --directories=recurse\n --include <FILE_PATTERN> search only files that match FILE_PATTERN\n\nWhen FILE is -, read standard input. With no FILE, read . if a command-line\n-r is given, - otherwise. If fewer than two FILEs are given, assume -h.\nExit status is 0 if any line is selected, 1 otherwise;\nif any error occurs and -q is not given, the exit status is 2.\n\nReport grep bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/head.js
================================================
"use strict";
module.exports = "\nUsage: head [OPTION]... [FILE]...\nPrint the first 10 lines of each FILE to standard output.\nWith more than one FILE, precede each with a header giving the file name.\nWith no FILE, or when FILE is -, read standard input.\n\n -n, --lines <number> output the last N lines, instead of the last 10\n -q, --silent suppresses printing of headers when multiple files\n are being examined\n -v, --verbose always output headers giving file names\n --help display this help and exit\n\nReport head bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/kill.js
================================================
"use strict";
module.exports = "\nUsage: kill [OPTION] pid | jobspec ... or kill -l [sigspec]\nSend a signal to a job.\n\nSend the processes identified by PID or JOBSPEC the signal named by\nSIGSPEC or SIGNUM. If neither SIGSPEC nor SIGNUM is present, then\nSIGTERM is assumed.\n\n -s sig SIG is a signal name\n -n sig SIG is a signal number\n -l [sigspec] list the signal names; if arguments follow `-l' they\n are assumed to be signal numbers for which names\n should be listed\n --help display this help and exit\n\nExit status:\n 0 if OK,\n 1 if an invalid option is given or an error occurs.\n\nReport kill bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/ls.js
================================================
"use strict";
module.exports = "\nUsage: ls [OPTION]... [FILE]...\nList information about the FILEs (the current directory by default).\nSort entries alphabetically if none of -tSU nor --sort is specified.\n\n -a, --all do not ignore entries starting with .\n -A, --almost-all do not list implied . and ..\n -d, --directory list directory entries instead of contents,\n and do not dereference symbolic links\n -f do not sort, enable -aU, disable -ls --color\n -F, --classify append indicator (one of */=>@|) to entries\n -h, --human-readable with -l, print sizes in human readable format\n -i, --inode print the index number of each file\n -l use a long listing format\n -q, --hide-control-chars print ? instead of non graphic characters\n -r, --reverse reverse order while sorting\n -R, --recursive list subdirectories recursively\n -S sort by file size\n -t sort by modification time, newest first\n -U do not sort; list entries in directory order\n -w, --width=COLS assume screen width instead of current value\n -x list entries by lines instead of by columns\n -1 list one file per line\n --help display this help and exit\n\nExit status:\n 0 if OK,\n 1 if minor problems (e.g., cannot access subdirectory),\n 2 if serious trouble (e.g., cannot access command-line argument).\n\nReport ls bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/mkdir.js
================================================
"use strict";
module.exports = "\nUsage: mkdir [OPTION]... DIRECTORY...\nCreate the DIRECTORY(ies), if they do not already exist.\n\n -p, --parents no error if existing, make parent directories as needed\n -v, --verbose print a message for each created directory\n --help display this help and exit\n\nReport mkdir bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/mv.js
================================================
"use strict";
module.exports = "\nUsage: mv [OPTION]... [-T] SOURCE DEST\n or: mv [OPTION]... SOURCE... DIRECTORY\n or: mv [OPTION]... -t DIRECTORY SOURCE...\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\n -f, --force do not prompt before overwriting\n -n, --no-clobber do not overwrite an existing file\n --striptrailingslashes remove any trailing slashes from each SOURCE\n argument\n -v, --verbose explain what is being done\n --help display this help and exit\n\nIf you specify -f and -n, only -f takes effect.\n\nReport mv bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/pwd.js
================================================
"use strict";
module.exports = "\nUsage: pwd [-LP]\nPrint the name of the current working directory.\n\n --help display this help and exit\n\nExit status:\n 0 if OK,\n 1 if an invalid option is given or the current directory\n cannot be read.\n\nReport pwd bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/rm.js
================================================
"use strict";
module.exports = "\nUsage: rm [OPTION]... FILE...\nRemove (unlink) the FILE(s).\n\n -f, --force ignore nonexistent files and arguments, never prompt\n -r, -R, --recursive remove directories and their contents recursively\n --help display this help and exit\n\nBy default, rm does not remove directories. Use the --recursive (-r or -R)\noption to remove each listed directory, too, along with all of its contents.\n\nTo remove a file whose name starts with a '-', for example '-foo',\nuse one of these commands:\n rm -- -foo\n rm ./-foo\n\nNote that if you use rm to remove a file, it might be possible to recover\nsome of its contents, given sufficient expertise and/or time.\n\nReport rm bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/sort.js
================================================
"use strict";
module.exports = "\nUsage: sort [OPTION]... [FILE]...\nWrite sorted concatenation of all FILE(s) to standard output.\n\nOrdering options:\n -M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'\n -h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)\n -n, --numeric-sort compare according to string numerical value\n -R, --random-sort sort by random hash of keys\n -r, --reverse reverse the result of comparisons\n\nOther options:\n -c, --check,\n --check=diagnose-first check for sorted input; do not sort\n -o, --output=FILE write result to FILE instead of standard output\n --help display this help and exit\n\nWith no FILE, or when FILE is -, read standard input.\n\nReport sort bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/source.js
================================================
"use strict";
module.exports = "\nUsage: source FILENAME [ARGUMENTS...]\n or: . FILENAME [ARGUMENTS...]\nRead and execute commands from the filename argument in the current shell.\n\nWhen a script is run using source, it runs within the existing shell and any\nchange of directory or modified variables or aliases will persist after the\nscript completes. Scripts may contain any commands that cash supports.\n\n --help display this help and exit\n\nReport source bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/tail.js
================================================
"use strict";
module.exports = "\nUsage: tail [OPTION]... [FILE]...\nDisplay the last part of a file.\n\nPrint the last 10 lines of each FILE to standard output. With more\nthan one FILE, precede each with a header giving the file name.\n\n -n, --lines <number> output the last N lines, instead of the last 10\n -q, --silent suppresses printing of headers when multiple files\n are being examined\n -v, --verbose always output headers giving file names\n --help display this help and exit\n\nReport tail bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/touch.js
================================================
"use strict";
module.exports = "\nUsage: touch [OPTION]... FILE...\nUpdate the access and modification times of each FILE to the current time.\n\nA FILE argument that does not exist is created empty, unless -c is\nsupplied.\n\n -a change only the access time\n -c, --no-create do not create any files\n -d, --date <STRING> parse STRING and use it instead of current time\n -m change only the modification time\n -r, --reference <FILE> use this file's times instead of current time\n --time <WORD> change the specified time:\n WORD is access, atime, or use: equivalent to -a\n WORD is modify or mtime: equivalent to -m\n --help display this help and exit\n\nReport touch bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/true.js
================================================
"use strict";
module.exports = "\nUsage: true [OPTION]\nDo nothing, successfully\n\nThis command simply exits with status 0 (success).\n\n --help display this help and exit\n\nReport true bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/unalias.js
================================================
"use strict";
module.exports = "\nUsage: unalias [OPTION] name ...\nRemove each name from the list of defined aliases.\n\n -a remove all alias definitions\n --help display this help and exit\n\nExit status:\n 0 if OK,\n 1 if a name is not an existing alias.\n\nReport unalias bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help/which.js
================================================
"use strict";
module.exports = "\nUsage: which COMMAND\nLook for COMMAND in $PATH.\n\n --help display this help and exit\n\nReport which bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: dist/help.js
================================================
'use strict';
var pad = require('./util/pad');
var commands = ['alias [-p] [name=[value]]', 'cat [-AbeEnstTv] [files ...]', 'cd [dir]', 'clear', 'cp [-fnr] source ... dest', 'echo [-eE] [arg ...]', 'export [-p][id=[value]]', 'false', 'grep [-bHhinqsvw] [-m max] [--silent] [--include pattern] pattern [files ...]', 'head [-nqv] <files ...>', 'kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l', 'less [files ...]', 'ls [-aAdFhilQrRStUwx1] [paths ...]', 'mkdir [-pv] [directories ...]', 'mv [-fnv] source ... dest', 'pwd [files ...]', 'rm [-frR] [files ...]', 'sort [-chMnrR] [-o file] [files ...]', 'source filename [arguments...]', 'tail [options] <files ...>', 'touch [-acm] [-d date] [-r ref] [--time word] file ...', 'true', 'unalias [-a] name [names ...]', 'which [command]'];
function chop(str, len) {
var res = String(str).slice(0, len - 2);
res = res.length === len - 2 ? res + '>' : res;
return res;
}
module.exports = function () {
var version = require('./../package.json').version;
var result = '';
result += 'Cash, version ' + version + '\n';
result += 'These shell commands are defined internally. Type `help\' to see this list.\n';
result += 'Type `help name\' to find out more about the function `name\'.\n';
result += 'Use `info cash\' to find out more about the shell in general.\n';
result += '\n';
var half = Math.floor(commands.length / 2);
var width = Math.floor((process.stdout.columns - 3) / 2);
var lhalf = Math.ceil(commands.length / 2);
var padding = commands.length % 2 === 1 ? 1 : 0;
for (var i = 0; i < lhalf; ++i) {
var colA = pad(chop(commands[i], width), width);
var colB = pad(chop(commands[half + i + padding] || '', width), width);
var line = i === lhalf - 1 ? '' : '\n';
result += ' ' + colA + ' ' + colB + line;
}
return result;
};
================================================
FILE: dist/index.js
================================================
'use strict';
var os = require('os');
var Vorpal = require('vorpal');
var commands = require('./../commands.json');
var help = require('./help');
var interfacer = require('./util/interfacer');
var delimiter = require('./delimiter.js');
var path = require('path');
var fs = require('fs');
var minimist = require('minimist');
var cmds = void 0;
var app = {
commands: commands.commands,
importedCommands: commands.importedCommands,
vorpal: new Vorpal(),
_cwd: process.cwd(),
_fatal: false,
export: function _export(str, cbk) {
// Is this a tagged template literal?
var tmpl = Array.isArray(str) && Array.isArray(str.raw);
cbk = tmpl && cbk || function () {};
var options = {
fatal: app._fatal || false
};
// Hook stdin, execute the command and
// then return it all.
var intercept = require('./util/intercept');
var out = '';
var unhook = intercept(function (str) {
out += str + '\n';
return '';
});
var commands = void 0;
if (tmpl) {
// Render into a single string, inserting interpolated values.
var interpVals = [].concat(Array.prototype.slice.call(arguments)).slice(1);
var interpStr = str[0];
for (var i = 0, l = interpVals.length; i < l; i++) {
/* istanbul ignore next */
interpStr += '' + interpVals[i] + str[i + 1];
}
// Split into lines. Remove blank lines and comments (start with #)
commands = interpStr.split(/\r\n|\r|\n/).filter(function (command) {
return !/^\s*(?:#|$)/.test(command);
});
} else {
commands = [str];
}
commands.forEach(function (command) {
app.vorpal.execSync(command, options);
});
unhook();
return String(out).replace(/\n$/, '');
},
load: function load() {
var self = this;
self.vorpal.api = {};
this.commands.forEach(function (cmd) {
if (self.importedCommands.indexOf(cmd) > -1) {
return;
}
try {
(function () {
var mod = require('./commands/' + cmd + '.js');
var help = void 0;
try {
help = require('./help/' + cmd + '.js');
help = String(help).replace(/^\n|\n$/g, '');
} catch (e) {
// .. whatever
}
self.vorpal.use(mod, {
parent: self
});
var cmdObj = self.vorpal.find(cmd);
if (cmdObj && help) {
/* istanbul ignore next */
cmdObj.help(function (args, cb) {
cb(help);
});
}
})();
} catch (e) {
/* istanbul ignore next */
self.vorpal.log('Error loading command ' + cmd + ': ', e);
}
});
this.importedCommands.forEach(function (cmd) {
try {
var mod = require('vorpal-' + cmd);
self.vorpal.use(mod, {
parent: self
});
} catch (e) {
/* istanbul ignore next */
self.vorpal.log('Error loading command ' + cmd + ': ', e);
}
});
// If we're running Windows, register
// process spawning for Windows child processes.
// If on Linux, just does registers the .catch command.
var windows = require('./windows');
windows.registerCommands(self);
var _loop = function _loop(cmd) {
if (app.vorpal.api.hasOwnProperty(cmd)) {
app.export[cmd] = function (args, options, callback) {
callback = callback || function () {};
options = options || {};
options.vorpal = app.vorpal;
return interfacer.call(this, {
command: app.vorpal.api[cmd],
args: args,
options: options,
callback: callback,
async: app.vorpal.api[cmd].async || false,
silent: true
});
};
}
};
for (var cmd in app.vorpal.api) {
_loop(cmd);
}
self.vorpal.localEnv = Object.create(process.env);
var argv = minimist(process.argv.slice(2));
/* istanbul ignore next */
if (typeof argv.c !== 'undefined' && typeof argv.c !== 'string') {
console.error('cash: -c: option requires an argument');
process.exit(2);
} else if (typeof argv.c === 'string' || argv._.length > 0) {
for (var k = 0; k < argv._.length; k++) {
self.vorpal.localEnv.k = argv._[k];
}
// If -c is used, use that string, otherwise use the script-name instead
var script = argv.c || 'source ' + argv._[0];
app.vorpal.execSync(script);
process.exit(0);
}
// Otherwise, start an interactive shell
self.vorpal.localEnv[0] = 'cash';
app.vorpal.history('cash').localStorage('cash').help(help);
app.vorpal.find('exit').action(function () {
/* istanbul ignore next */
process.exit();
});
// Load aliases
var all = void 0;
try {
all = JSON.parse(app.vorpal.localStorage.getItem('aliases') || []);
} catch (e) {
/* istanbul ignore next */
all = [];
/* istanbul ignore next */
app.vorpal.localStorage.removeItem('aliases');
}
var aliases = {};
/* istanbul ignore next */
for (var i = 0; i < all.length; ++i) {
var item = app.vorpal.localStorage.getItem('alias|' + all[i]);
if (item !== undefined && item !== null) {
aliases[all[i]] = item;
}
}
app.vorpal._aliases = aliases;
// Override SIGINT to be ignored,
// and if the user is insistent, give
// a helpful message. The purpose of this
// is to give a full shell feel, not an
// application running over the shell.
// Skip this on linux, as its mainly
// for dev testing.
/* istanbul ignore next */
if (os.platform().indexOf('win') > -1) {
(function () {
var counter = 0;
setInterval(function () {
counter = counter > 0 ? 0 : counter;
}, 3000);
app.vorpal.sigint(function () {
counter++;
app.vorpal.ui.submit('');
if (counter > 5) {
app.vorpal.log('(to quit Cash, use the "exit" command)');
counter -= 10000;
}
return;
});
})();
}
// Load .cashrc upon startup
var locations = ['.cashrc'];
if (process.platform === 'win32') {
/* istanbul ignore next */
locations.push('_cashrc');
}
locations = locations.map(function (str) {
return path.join(delimiter.getHomeDir(), str);
});
for (var _i = 0; _i < locations.length; ++_i) {
try {
/* istanbul ignore if */
if (!fs.statSync(locations[_i]).isDirectory()) {
app.vorpal.execSync('source ' + locations[_i]);
break;
}
} catch (e) {
// File doesn't exist, so just don't load defaults
}
}
app.export.vorpal = app.vorpal;
Object.assign(app.export, cmds);
return this;
}
};
cmds = {
/* istanbul ignore next */
show: function show() {
/* istanbul ignore next */
app.vorpal.show();
}
};
app.load();
module.exports = app.export;
================================================
FILE: dist/lib/sugar.js
================================================
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
/*
* Sugar Library v1.4.1
*
* Freely distributable and licensed under the MIT-style license.
* Copyright (c) 2014 Andrew Plummer
* http://sugarjs.com/
*
* ---------------------------- */
/* istanbul ignore next */
(function () {
function aa(a) {
return function () {
return a;
};
}
/* istanbul ignore next */
var m = Object,
p = Array,
q = RegExp,
r = Date,
s = String,
t = Number,
u = Math,
ba = "undefined" !== typeof global ? global : this,
v = m.prototype.toString,
da = m.prototype.hasOwnProperty,
ea = m.defineProperty && m.defineProperties,
fa = "function" === typeof q(),
ga = !("0" in new s("a")),
ia = {},
ja = /^\[object Date|Array|String|Number|RegExp|Boolean|Arguments\]$/,
w = "Boolean Number String Array Date RegExp Function".split(" "),
la = ka("boolean", w[0]),
y = ka("number", w[1]),
z = ka("string", w[2]),
A = ma(w[3]),
C = ma(w[4]),
D = ma(w[5]),
F = ma(w[6]);
/* istanbul ignore next */
function ma(a) {
var b = "Array" === a && p.isArray || function (b, d) {
return (d || v.call(b)) === "[object " + a + "]";
};return ia[a] = b;
}function ka(a, b) {
function c(c) {
return G(c) ? v.call(c) === "[object " + b + "]" : (typeof c === "undefined" ? "undefined" : _typeof(c)) === a;
}return ia[b] = c;
}
function na(a) {
a.SugarMethods || (oa(a, "SugarMethods", {}), H(a, !1, !0, { extend: function extend(b, c, d) {
H(a, !1 !== d, c, b);
}, sugarRestore: function sugarRestore() {
return pa(this, a, arguments, function (a, c, d) {
oa(a, c, d.method);
});
}, sugarRevert: function sugarRevert() {
return pa(this, a, arguments, function (a, c, d) {
d.existed ? oa(a, c, d.original) : delete a[c];
});
} }));
}function H(a, b, c, d) {
var e = b ? a.prototype : a;na(a);I(d, function (d, f) {
var h = e[d],
l = J(e, d);F(c) && h && (f = qa(h, f, c));!1 === c && h || oa(e, d, f);a.SugarMethods[d] = { method: f, existed: l, original: h, instance: b };
});
}
function K(a, b, c, d, e) {
var g = {};d = z(d) ? d.split(",") : d;d.forEach(function (a, b) {
e(g, a, b);
});H(a, b, c, g);
}function pa(a, b, c, d) {
var e = 0 === c.length,
g = L(c),
f = !1;I(b.SugarMethods, function (b, c) {
if (e || -1 !== g.indexOf(b)) f = !0, d(c.instance ? a.prototype : a, b, c);
});return f;
}function qa(a, b, c) {
return function (d) {
return c.apply(this, arguments) ? b.apply(this, arguments) : a.apply(this, arguments);
};
}function oa(a, b, c) {
ea ? m.defineProperty(a, b, { value: c, configurable: !0, enumerable: !1, writable: !0 }) : a[b] = c;
}
function L(a, b, c) {
var d = [];c = c || 0;var e;for (e = a.length; c < e; c++) {
d.push(a[c]), b && b.call(a, a[c], c);
}return d;
}function sa(a, b, c) {
var d = a[c || 0];A(d) && (a = d, c = 0);L(a, b, c);
}function ta(a) {
if (!a || !a.call) throw new TypeError("Callback is not callable");
}function M(a) {
return void 0 !== a;
}function N(a) {
return void 0 === a;
}function J(a, b) {
return !!a && da.call(a, b);
}function G(a) {
return !!a && ("object" === (typeof a === "undefined" ? "undefined" : _typeof(a)) || fa && D(a));
}function ua(a) {
var b = typeof a === "undefined" ? "undefined" : _typeof(a);return null == a || "string" === b || "number" === b || "boolean" === b;
}
function va(a, b) {
b = b || v.call(a);try {
if (a && a.constructor && !J(a, "constructor") && !J(a.constructor.prototype, "isPrototypeOf")) return !1;
} catch (c) {
return !1;
}return !!a && "[object Object]" === b && "hasOwnProperty" in a;
}function I(a, b) {
for (var c in a) {
if (J(a, c) && !1 === b.call(a, c, a[c], a)) break;
}
}function wa(a, b) {
for (var c = 0; c < a; c++) {
b(c);
}
}function xa(a, b) {
I(b, function (c) {
a[c] = b[c];
});return a;
}function ya(a) {
ua(a) && (a = m(a));if (ga && z(a)) for (var b = a, c = 0, d; d = b.charAt(c);) {
b[c++] = d;
}return a;
}function O(a) {
xa(this, ya(a));
}
O.prototype.constructor = m;var P = u.abs,
za = u.pow,
Aa = u.ceil,
Q = u.floor,
R = u.round,
Ca = u.min,
S = u.max;function Da(a, b, c) {
var d = za(10, P(b || 0));c = c || R;0 > b && (d = 1 / d);return c(a * d) / d;
}var Ea = 48,
Fa = 57,
Ga = 65296,
Ha = 65305,
Ia = ".",
Ja = "",
Ka = {},
La;function Ma() {
return "\t\n\u000b\f\r \u2028\u2029 ";
}function Na(a, b) {
var c = "";for (a = a.toString(); 0 < b;) {
if (b & 1 && (c += a), b >>= 1) a += a;
}return c;
}
function Oa(a, b) {
var c, d;c = a.replace(La, function (a) {
a = Ka[a];a === Ia && (d = !0);return a;
});return d ? parseFloat(c) : parseInt(c, b || 10);
}function T(a, b, c, d) {
d = P(a).toString(d || 10);d = Na("0", b - d.replace(/\.\d+/, "").length) + d;if (c || 0 > a) d = (0 > a ? "-" : "+") + d;return d;
}function Pa(a) {
if (11 <= a && 13 >= a) return "th";switch (a % 10) {case 1:
return "st";case 2:
return "nd";case 3:
return "rd";default:
return "th";}
}
function Qa(a, b) {
function c(a, c) {
if (a || -1 < b.indexOf(c)) d += c;
}var d = "";b = b || "";c(a.multiline, "m");c(a.ignoreCase, "i");c(a.global, "g");c(a.u, "y");return d;
}function Ra(a) {
z(a) || (a = s(a));return a.replace(/([\\/\'*+?|()\[\]{}.^$])/g, "\\$1");
}function U(a, b) {
return a["get" + (a._utc ? "UTC" : "") + b]();
}function Sa(a, b, c) {
return a["set" + (a._utc && "ISOWeek" != b ? "UTC" : "") + b](c);
}
function Ta(a, b) {
var c = typeof a === "undefined" ? "undefined" : _typeof(a),
d,
e,
g,
f,
h,
l,
n;if ("string" === c) return a;g = v.call(a);d = va(a, g);e = A(a, g);if (null != a && d || e) {
b || (b = []);if (1 < b.length) for (l = b.length; l--;) {
if (b[l] === a) return "CYC";
}b.push(a);d = a.valueOf() + s(a.constructor);f = e ? a : m.keys(a).sort();l = 0;for (n = f.length; l < n; l++) {
h = e ? l : f[l], d += h + Ta(a[h], b);
}b.pop();
} else d = -Infinity === 1 / a ? "-0" : s(a && a.valueOf ? a.valueOf() : a);return c + g + d;
}function Ua(a, b) {
return a === b ? 0 !== a || 1 / a === 1 / b : Va(a) && Va(b) ? Ta(a) === Ta(b) : !1;
}
function Va(a) {
var b = v.call(a);return ja.test(b) || va(a, b);
}function Wa(a, b, c) {
var d,
e = a.length,
g = b.length,
f = !1 !== b[g - 1];if (!(g > (f ? 1 : 2))) return Xa(a, e, b[0], f, c);d = [];L(b, function (b) {
if (la(b)) return !1;d.push(Xa(a, e, b, f, c));
});return d;
}function Xa(a, b, c, d, e) {
d && (c %= b, 0 > c && (c = b + c));return e ? a.charAt(c) : a[c];
}function Ya(a, b) {
K(b, !0, !1, a, function (a, b) {
a[b + ("equal" === b ? "s" : "")] = function () {
return m[b].apply(null, [this].concat(L(arguments)));
};
});
}na(m);I(w, function (a, b) {
na(ba[b]);
});var Za, $a;
for ($a = 0; 9 >= $a; $a++) {
Za = s.fromCharCode($a + Ga), Ja += Za, Ka[Za] = s.fromCharCode($a + Ea);
}Ka[","] = "";Ka["."] = Ia;Ka[Ia] = Ia;La = q("[" + Ja + ".," + Ia + "]", "g");
"use strict";H(m, !1, !1, { keys: function keys(a) {
var b = [];if (!G(a) && !D(a) && !F(a)) throw new TypeError("Object required");I(a, function (a) {
b.push(a);
});return b;
} });
function ab(a, b, c, d) {
var e = a.length,
g = -1 == d,
f = g ? e - 1 : 0;c = isNaN(c) ? f : parseInt(c >> 0);0 > c && (c = e + c);if (!g && 0 > c || g && c >= e) c = f;for (; g && 0 <= c || !g && c < e;) {
if (a[c] === b) return c;c += d;
}return -1;
}function bb(a, b, c, d) {
var e = a.length,
g = 0,
f = M(c);ta(b);if (0 != e || f) f || (c = a[d ? e - 1 : g], g++);else throw new TypeError("Reduce called on empty array with no initial value");for (; g < e;) {
f = d ? e - g - 1 : g, f in a && (c = b(c, a[f], f, a)), g++;
}return c;
}function cb(a) {
if (0 === a.length) throw new TypeError("First argument must be defined");
}H(p, !1, !1, { isArray: function isArray(a) {
return A(a);
} });
H(p, !0, !1, { every: function every(a, b) {
var c = this.length,
d = 0;for (cb(arguments); d < c;) {
if (d in this && !a.call(b, this[d], d, this)) return !1;d++;
}return !0;
}, some: function some(a, b) {
var c = this.length,
d = 0;for (cb(arguments); d < c;) {
if (d in this && a.call(b, this[d], d, this)) return !0;d++;
}return !1;
}, map: function map(a, b) {
b = arguments[1];var c = this.length,
d = 0,
e = Array(c);for (cb(arguments); d < c;) {
d in this && (e[d] = a.call(b, this[d], d, this)), d++;
}return e;
}, filter: function filter(a) {
var b = arguments[1],
c = this.length,
d = 0,
e = [];for (cb(arguments); d < c;) {
d in this && a.call(b, this[d], d, this) && e.push(this[d]), d++;
}return e;
}, indexOf: function indexOf(a, b) {
return z(this) ? this.indexOf(a, b) : ab(this, a, b, 1);
}, lastIndexOf: function lastIndexOf(a, b) {
return z(this) ? this.lastIndexOf(a, b) : ab(this, a, b, -1);
}, forEach: function forEach(a, b) {
var c = this.length,
d = 0;for (ta(a); d < c;) {
d in this && a.call(b, this[d], d, this), d++;
}
}, reduce: function reduce(a, b) {
return bb(this, a, b);
}, reduceRight: function reduceRight(a, b) {
return bb(this, a, b, !0);
} });
H(Function, !0, !1, { bind: function bind(a) {
var b = this,
c = L(arguments, null, 1),
d;if (!F(this)) throw new TypeError("Function.prototype.bind called on a non-function");d = function d() {
return b.apply(b.prototype && this instanceof b ? this : a, c.concat(L(arguments)));
};d.prototype = this.prototype;return d;
} });H(r, !1, !1, { now: function now() {
return new r().getTime();
} });
(function () {
var a = Ma().match(/^\s+$/);try {
s.prototype.trim.call([1]);
} catch (b) {
a = !1;
}H(s, !0, !a, { trim: function trim() {
return this.toString().trimLeft().trimRight();
}, trimLeft: function trimLeft() {
return this.replace(q("^[" + Ma() + "]+"), "");
}, trimRight: function trimRight() {
return this.replace(q("[" + Ma() + "]+$"), "");
} });
})();
(function () {
var a = new r(r.UTC(1999, 11, 31)),
a = a.toISOString && "1999-12-31T00:00:00.000Z" === a.toISOString();K(r, !0, !a, "toISOString,toJSON", function (a, c) {
a[c] = function () {
return T(this.getUTCFullYear(), 4) + "-" + T(this.getUTCMonth() + 1, 2) + "-" + T(this.getUTCDate(), 2) + "T" + T(this.getUTCHours(), 2) + ":" + T(this.getUTCMinutes(), 2) + ":" + T(this.getUTCSeconds(), 2) + "." + T(this.getUTCMilliseconds(), 3) + "Z";
};
});
})();
"use strict";
var W,
Ib,
Jb = "ampm hour minute second ampm utc offset_sign offset_hours offset_minutes ampm".split(" "),
Kb = "({t})?\\s*(\\d{1,2}(?:[,.]\\d+)?)(?:{h}([0-5]\\d(?:[,.]\\d+)?)?{m}(?::?([0-5]\\d(?:[,.]\\d+)?){s})?\\s*(?:({t})|(Z)|(?:([+-])(\\d{2,2})(?::?(\\d{2,2}))?)?)?|\\s*({t}))",
Lb = {},
Mb,
Nb,
Ob,
Pb = [],
Qb = {},
X = { yyyy: function yyyy(a) {
return U(a, "FullYear");
}, yy: function yy(a) {
return U(a, "FullYear") % 100;
}, ord: function ord(a) {
a = U(a, "Date");return a + Pa(a);
}, tz: function tz(a) {
return a.getUTCOffset();
}, isotz: function isotz(a) {
return a.getUTCOffset(!0);
},
Z: function Z(a) {
return a.getUTCOffset();
}, ZZ: function ZZ(a) {
return a.getUTCOffset().replace(/(\d{2})$/, ":$1");
} },
Rb = [{ name: "year", method: "FullYear", k: !0, b: function b(a) {
return 864E5 * (365 + (a ? a.isLeapYear() ? 1 : 0 : 0.25));
} }, { name: "month", error: 0.919, method: "Month", k: !0, b: function b(a, _b) {
var c = 30.4375,
d;a && (d = a.daysInMonth(), _b <= d.days() && (c = d));return 864E5 * c;
} }, { name: "week", method: "ISOWeek", b: aa(6048E5) }, { name: "day", error: 0.958, method: "Date", k: !0, b: aa(864E5) }, { name: "hour", method: "Hours", b: aa(36E5) }, { name: "minute",
method: "Minutes", b: aa(6E4) }, { name: "second", method: "Seconds", b: aa(1E3) }, { name: "millisecond", method: "Milliseconds", b: aa(1) }],
Sb = {};function Tb(a) {
xa(this, a);this.g = Pb.concat();
}
Tb.prototype = { getMonth: function getMonth(a) {
return y(a) ? a - 1 : this.months.indexOf(a) % 12;
}, getWeekday: function getWeekday(a) {
return this.weekdays.indexOf(a) % 7;
}, addFormat: function addFormat(a, b, c, d, e) {
var g = c || [],
f = this,
h;a = a.replace(/\s+/g, "[,. ]*");a = a.replace(/\{([^,]+?)\}/g, function (a, b) {
var d,
e,
h,
B = b.match(/\?$/);h = b.match(/^(\d+)\??$/);var k = b.match(/(\d)(?:-(\d))?/),
E = b.replace(/[^a-z]+$/, "");h ? d = f.tokens[h[1]] : f[E] ? d = f[E] : f[E + "s"] && (d = f[E + "s"], k && (e = [], d.forEach(function (a, b) {
var c = b % (f.units ? 8 : d.length);c >= k[1] && c <= (k[2] || k[1]) && e.push(a);
}), d = e), d = Ub(d));h ? h = "(?:" + d + ")" : (c || g.push(E), h = "(" + d + ")");B && (h += "?");return h;
});b ? (b = Vb(f, e), e = ["t", "[\\s\\u3000]"].concat(f.timeMarker), h = a.match(/\\d\{\d,\d\}\)+\??$/), Wb(f, "(?:" + b + ")[,\\s\\u3000]+?" + a, Jb.concat(g), d), Wb(f, a + "(?:[,\\s]*(?:" + e.join("|") + (h ? "+" : "*") + ")" + b + ")?", g.concat(Jb), d)) : Wb(f, a, g, d);
} };
function Xb(a, b, c) {
var d,
e,
g = b[0],
f = b[1],
h = b[2];b = a[c] || a.relative;if (F(b)) return b.call(a, g, f, h, c);e = a.units[8 * (a.plural && 1 < g ? 1 : 0) + f] || a.units[f];a.capitalizeUnit && (e = Yb(e));d = a.modifiers.filter(function (a) {
return "sign" == a.name && a.value == (0 < h ? 1 : -1);
})[0];return b.replace(/\{(.*?)\}/g, function (a, b) {
switch (b) {case "num":
return g;case "unit":
return e;case "sign":
return d.src;}
});
}function Zb(a, b) {
b = b || a.code;return "en" === b || "en-US" === b ? !0 : a.variant;
}
function $b(a, b) {
return b.replace(q(a.num, "g"), function (b) {
return ac(a, b) || "";
});
}function ac(a, b) {
var c;return y(b) ? b : b && -1 !== (c = a.numbers.indexOf(b)) ? (c + 1) % 10 : 1;
}function Y(a, b) {
var c;z(a) || (a = "");c = Sb[a] || Sb[a.slice(0, 2)];if (!1 === b && !c) throw new TypeError("Invalid locale.");return c || Ib;
}
function bc(a, b) {
function c(a) {
var b = h[a];z(b) ? h[a] = b.split(",") : b || (h[a] = []);
}function d(a, b) {
a = a.split("+").map(function (a) {
return a.replace(/(.+):(.+)$/, function (a, b, c) {
return c.split("|").map(function (a) {
return b + a;
}).join("|");
});
}).join("|");a.split("|").forEach(b);
}function e(a, b, c) {
var e = [];h[a].forEach(function (a, f) {
b && (a += "+" + a.slice(0, 3));d(a, function (a, b) {
e[b * c + f] = a.toLowerCase();
});
});h[a] = e;
}function g(a, b, c) {
a = "\\d{" + a + "," + b + "}";c && (a += "|(?:" + Ub(h.numbers) + ")+");return a;
}function f(a, b) {
h[a] = h[a] || b;
}var h, l;h = new Tb(b);c("modifiers");"months weekdays units numbers articles tokens timeMarker ampm timeSuffixes dateParse timeParse".split(" ").forEach(c);l = !h.monthSuffix;e("months", l, 12);e("weekdays", l, 7);e("units", !1, 8);e("numbers", !1, 10);f("code", a);f("date", g(1, 2, h.digitDate));f("year", "'\\d{2}|" + g(4, 4));f("num", function () {
var a = ["-?\\d+"].concat(h.articles);h.numbers && (a = a.concat(h.numbers));return Ub(a);
}());(function () {
var a = [];h.i = {};h.modifiers.push({ name: "day", src: "yesterday", value: -1 });
h.modifiers.push({ name: "day", src: "today", value: 0 });h.modifiers.push({ name: "day", src: "tomorrow", value: 1 });h.modifiers.forEach(function (b) {
var c = b.name;d(b.src, function (d) {
var e = h[c];h.i[d] = b;a.push({ name: c, src: d, value: b.value });h[c] = e ? e + "|" + d : d;
});
});h.day += "|" + Ub(h.weekdays);h.modifiers = a;
})();h.monthSuffix && (h.month = g(1, 2), h.months = "1 2 3 4 5 6 7 8 9 10 11 12".split(" ").map(function (a) {
return a + h.monthSuffix;
}));h.full_month = g(1, 2) + "|" + Ub(h.months);0 < h.timeSuffixes.length && h.addFormat(Vb(h), !1, Jb);
h.addFormat("{day}", !0);h.addFormat("{month}" + (h.monthSuffix || ""));h.addFormat("{year}" + (h.yearSuffix || ""));h.timeParse.forEach(function (a) {
h.addFormat(a, !0);
});h.dateParse.forEach(function (a) {
h.addFormat(a);
});return Sb[a] = h;
}function Wb(a, b, c, d) {
a.g.unshift({ r: d, locale: a, q: q("^" + b + "$", "i"), to: c });
}function Yb(a) {
return a.slice(0, 1).toUpperCase() + a.slice(1);
}function Ub(a) {
return a.filter(function (a) {
return !!a;
}).join("|");
}function cc() {
var a = r.SugarNewDate;return a ? a() : new r();
}
function dc(a, b) {
var c;if (G(a[0])) return a;if (y(a[0]) && !y(a[1])) return [a[0]];if (z(a[0]) && b) return [ec(a[0]), a[1]];c = {};Nb.forEach(function (b, e) {
c[b.name] = a[e];
});return [c];
}function ec(a) {
var b,
c = {};if (a = a.match(/^(\d+)?\s?(\w+?)s?$/i)) N(b) && (b = parseInt(a[1]) || 1), c[a[2].toLowerCase()] = b;return c;
}function fc(a, b, c) {
var d;N(c) && (c = Ob.length);for (b = b || 0; b < c && (d = Ob[b], !1 !== a(d.name, d, b)); b++) {}
}
function gc(a, b) {
var c = {},
d,
e;b.forEach(function (b, f) {
d = a[f + 1];N(d) || "" === d || ("year" === b && (c.t = d.replace(/'/, "")), e = parseFloat(d.replace(/'/, "").replace(/,/, ".")), c[b] = isNaN(e) ? d.toLowerCase() : e);
});return c;
}function hc(a) {
a = a.trim().replace(/^just (?=now)|\.+$/i, "");return ic(a);
}
function ic(a) {
return a.replace(Mb, function (a, c, d) {
var e = 0,
g = 1,
f,
h;if (c) return a;d.split("").reverse().forEach(function (a) {
a = Lb[a];var b = 9 < a;b ? (f && (e += g), g *= a / (h || 1), h = a) : (!1 === f && (g *= 10), e += g * a);f = b;
});f && (e += g);return e;
});
}
function jc(a, b, c, d) {
function e(a) {
vb.push(a);
}function g() {
vb.forEach(function (a) {
a.call();
});
}function f() {
var a = n.getWeekday();n.setWeekday(7 * (k.num - 1) + (a > Ba ? Ba + 7 : Ba));
}function h() {
var a = B.i[k.edge];fc(function (a) {
if (M(k[a])) return E = a, !1;
}, 4);if ("year" === E) k.e = "month";else if ("month" === E || "week" === E) k.e = "day";n[(0 > a.value ? "endOf" : "beginningOf") + Yb(E)]();-2 === a.value && n.reset();
}function l() {
var a;fc(function (b, c, d) {
"day" === b && (b = "date");if (M(k[b])) {
if (d >= wb) return n.setTime(NaN), !1;a = a || {};a[b] = k[b];
delete k[b];
}
});a && e(function () {
n.set(a, !0);
});
}var n, x, ha, vb, B, k, E, wb, Ba, ra, ca;n = cc();vb = [];n.utc(d);C(a) ? n.utc(a.isUTC()).setTime(a.getTime()) : y(a) ? n.setTime(a) : G(a) ? (n.set(a, !0), k = a) : z(a) && (ha = Y(b), a = hc(a), ha && I(ha.o ? [ha.o].concat(ha.g) : ha.g, function (c, d) {
var g = a.match(d.q);if (g) {
B = d.locale;k = gc(g, d.to);B.o = d;k.utc && n.utc();if (k.timestamp) return k = k.timestamp, !1;d.r && !z(k.month) && (z(k.date) || Zb(ha, b)) && (ca = k.month, k.month = k.date, k.date = ca);k.year && 2 === k.t.length && (k.year = 100 * R(U(cc(), "FullYear") / 100) - 100 * R(k.year / 100) + k.year);k.month && (k.month = B.getMonth(k.month), k.shift && !k.unit && (k.unit = B.units[7]));k.weekday && k.date ? delete k.weekday : k.weekday && (k.weekday = B.getWeekday(k.weekday), k.shift && !k.unit && (k.unit = B.units[5]));k.day && (ca = B.i[k.day]) ? (k.day = ca.value, n.reset(), x = !0) : k.day && -1 < (Ba = B.getWeekday(k.day)) && (delete k.day, k.num && k.month ? (e(f), k.day = 1) : k.weekday = Ba);k.date && !y(k.date) && (k.date = $b(B, k.date));k.ampm && k.ampm === B.ampm[1] && 12 > k.hour ? k.hour += 12 : k.ampm === B.ampm[0] && 12 === k.hour && (k.hour = 0);if ("offset_hours" in k || "offset_minutes" in k) n.utc(), k.offset_minutes = k.offset_minutes || 0, k.offset_minutes += 60 * k.offset_hours, "-" === k.offset_sign && (k.offset_minutes *= -1), k.minute -= k.offset_minutes;k.unit && (x = !0, ra = ac(B, k.num), wb = B.units.indexOf(k.unit) % 8, E = W.units[wb], l(), k.shift && (ra *= (ca = B.i[k.shift]) ? ca.value : 0), k.sign && (ca = B.i[k.sign]) && (ra *= ca.value), M(k.weekday) && (n.set({ weekday: k.weekday }, !0), delete k.weekday), k[E] = (k[E] || 0) + ra);k.edge && e(h);"-" === k.year_sign && (k.year *= -1);fc(function (a, b, c) {
b = k[a];var d = b % 1;d && (k[Ob[c - 1].name] = R(d * ("second" === a ? 1E3 : 60)), k[a] = Q(b));
}, 1, 4);return !1;
}
}), k ? x ? n.advance(k) : (n._utc && n.reset(), kc(n, k, !0, !1, c)) : ("now" !== a && (n = new r(a)), d && n.addMinutes(-n.getTimezoneOffset())), g(), n.utc(!1));return { c: n, set: k };
}function lc(a) {
var b,
c = P(a),
d = c,
e = 0;fc(function (a, f, h) {
b = Q(Da(c / f.b(), 1));1 <= b && (d = b, e = h);
}, 1);return [d, e, a];
}
function mc(a) {
var b = lc(a.millisecondsFromNow());if (6 === b[1] || 5 === b[1] && 4 === b[0] && a.daysFromNow() >= cc().daysInMonth()) b[0] = P(a.monthsFromNow()), b[1] = 6;return b;
}function nc(a, b, c) {
function d(a, c) {
var d = U(a, "Month");return Y(c).months[d + 12 * b];
}Z(a, d, c);Z(Yb(a), d, c, 1);
}function Z(a, b, c, d) {
X[a] = function (a, g) {
var f = b(a, g);c && (f = f.slice(0, c));d && (f = f.slice(0, d).toUpperCase() + f.slice(d));return f;
};
}
function oc(a, b, c) {
X[a] = b;X[a + a] = function (a, c) {
return T(b(a, c), 2);
};c && (X[a + a + a] = function (a, c) {
return T(b(a, c), 3);
}, X[a + a + a + a] = function (a, c) {
return T(b(a, c), 4);
});
}function pc(a) {
var b = a.match(/(\{\w+\})|[^{}]+/g);Qb[a] = b.map(function (a) {
a.replace(/\{(\w+)\}/, function (b, e) {
a = X[e] || e;return e;
});return a;
});
}
function qc(a, b, c, d) {
var e;if (!a.isValid()) return "Invalid Date";Date[b] ? b = Date[b] : F(b) && (e = mc(a), b = b.apply(a, e.concat(Y(d))));if (!b && c) return e = e || mc(a), 0 === e[1] && (e[1] = 1, e[0] = 1), a = Y(d), Xb(a, e, 0 < e[2] ? "future" : "past");b = b || "long";if ("short" === b || "long" === b || "full" === b) b = Y(d)[b];Qb[b] || pc(b);var g, f;e = "";b = Qb[b];g = 0;for (c = b.length; g < c; g++) {
f = b[g], e += F(f) ? f(a, d) : f;
}return e;
}
function rc(a, b, c, d, e) {
var g,
f,
h,
l = 0,
n = 0,
x = 0;g = jc(b, c, null, e);0 < d && (n = x = d, f = !0);if (!g.c.isValid()) return !1;if (g.set && g.set.e) {
Rb.forEach(function (b) {
b.name === g.set.e && (l = b.b(g.c, a - g.c) - 1);
});b = Yb(g.set.e);if (g.set.edge || g.set.shift) g.c["beginningOf" + b]();"month" === g.set.e && (h = g.c.clone()["endOf" + b]().getTime());!f && g.set.sign && "millisecond" != g.set.e && (n = 50, x = -50);
}f = a.getTime();b = g.c.getTime();h = sc(a, b, h || b + l);return f >= b - n && f <= h + x;
}
function sc(a, b, c) {
b = new r(b);a = new r(c).utc(a.isUTC());23 !== U(a, "Hours") && (b = b.getTimezoneOffset(), a = a.getTimezoneOffset(), b !== a && (c += (a - b).minutes()));return c;
}
function kc(a, b, c, d, e) {
function g(a) {
return M(b[a]) ? b[a] : b[a + "s"];
}function f(a) {
return M(g(a));
}var h;if (y(b) && d) b = { milliseconds: b };else if (y(b)) return a.setTime(b), a;M(b.date) && (b.day = b.date);fc(function (d, e, g) {
var l = "day" === d;if (f(d) || l && f("weekday")) return b.e = d, h = +g, !1;!c || "week" === d || l && f("week") || Sa(a, e.method, l ? 1 : 0);
});Rb.forEach(function (c) {
var e = c.name;c = c.method;var h;h = g(e);N(h) || (d ? ("week" === e && (h = (b.day || 0) + 7 * h, c = "Date"), h = h * d + U(a, c)) : "month" === e && f("day") && Sa(a, "Date", 15), Sa(a, c, h), d && "month" === e && (e = h, 0 > e && (e = e % 12 + 12), e % 12 != U(a, "Month") && Sa(a, "Date", 0)));
});d || f("day") || !f("weekday") || a.setWeekday(g("weekday"));var l;a: {
switch (e) {case -1:
l = a > cc();break a;case 1:
l = a < cc();break a;}l = void 0;
}l && fc(function (b, c) {
if ((c.k || "week" === b && f("weekday")) && !(f(b) || "day" === b && f("weekday"))) return a[c.j](e), !1;
}, h + 1);return a;
}
function Vb(a, b) {
var c = Kb,
d = { h: 0, m: 1, s: 2 },
e;a = a || W;return c.replace(/{([a-z])}/g, function (c, f) {
var h = [],
l = "h" === f,
n = l && !b;if ("t" === f) return a.ampm.join("|");l && h.push(":");(e = a.timeSuffixes[d[f]]) && h.push(e + "\\s*");return 0 === h.length ? "" : "(?:" + h.join("|") + ")" + (n ? "" : "?");
});
}function tc(a, b, c) {
var d, e;y(a[1]) ? d = dc(a)[0] : (d = a[0], e = a[1]);return jc(d, e, b, c).c;
}
H(r, !1, !0, { create: function create() {
return tc(arguments);
}, past: function past() {
return tc(arguments, -1);
}, future: function future() {
return tc(arguments, 1);
}, addLocale: function addLocale(a, b) {
return bc(a, b);
}, setLocale: function setLocale(a) {
var b = Y(a, !1);Ib = b;a && a != b.code && (b.code = a);return b;
}, getLocale: function getLocale(a) {
return a ? Y(a, !1) : Ib;
}, addFormat: function addFormat(a, b, c) {
Wb(Y(c), a, b);
} });
H(r, !0, !0, { set: function set() {
var a = dc(arguments);return kc(this, a[0], a[1]);
}, setWeekday: function setWeekday(a) {
if (!N(a)) return Sa(this, "Date", U(this, "Date") + a - U(this, "Day"));
}, setISOWeek: function setISOWeek(a) {
var b = U(this, "Day") || 7;if (!N(a)) return this.set({ month: 0, date: 4 }), this.set({ weekday: 1 }), 1 < a && this.addWeeks(a - 1), 1 !== b && this.advance({ days: b - 1 }), this.getTime();
}, getISOWeek: function getISOWeek() {
var a;a = this.clone();var b = U(a, "Day") || 7;a.addDays(4 - b).reset();return 1 + Q(a.daysSince(a.clone().beginningOfYear()) / 7);
}, beginningOfISOWeek: function beginningOfISOWeek() {
var a = this.getDay();0 === a ? a = -6 : 1 !== a && (a = 1);this.setWeekday(a);return this.reset();
}, endOfISOWeek: function endOfISOWeek() {
0 !== this.getDay() && this.setWeekday(7);return this.endOfDay();
}, getUTCOffset: function getUTCOffset(a) {
var b = this._utc ? 0 : this.getTimezoneOffset(),
c = !0 === a ? ":" : "";return !b && a ? "Z" : T(Q(-b / 60), 2, !0) + c + T(P(b % 60), 2);
}, utc: function utc(a) {
oa(this, "_utc", !0 === a || 0 === arguments.length);return this;
}, isUTC: function isUTC() {
return !!this._utc || 0 === this.getTimezoneOffset();
}, advance: function advance() {
var a = dc(arguments, !0);return kc(this, a[0], a[1], 1);
}, rewind: function rewind() {
var a = dc(arguments, !0);return kc(this, a[0], a[1], -1);
}, isValid: function isValid() {
return !isNaN(this.getTime());
}, isAfter: function isAfter(a, b) {
return this.getTime() > r.create(a).getTime() - (b || 0);
}, isBefore: function isBefore(a, b) {
return this.getTime() < r.create(a).getTime() + (b || 0);
}, isBetween: function isBetween(a, b, c) {
var d = this.getTime();a = r.create(a).getTime();var e = r.create(b).getTime();b = Ca(a, e);a = S(a, e);c = c || 0;return b - c < d && a + c > d;
}, isLeapYear: function isLeapYear() {
var a = U(this, "FullYear");return 0 === a % 4 && 0 !== a % 100 || 0 === a % 400;
},
daysInMonth: function daysInMonth() {
return 32 - U(new r(U(this, "FullYear"), U(this, "Month"), 32), "Date");
}, format: function format(a, b) {
return qc(this, a, !1, b);
}, relative: function relative(a, b) {
z(a) && (b = a, a = null);return qc(this, a, !0, b);
}, is: function is(a, b, c) {
var d, e;if (this.isValid()) {
if (z(a)) switch (a = a.trim().toLowerCase(), e = this.clone().utc(c), !0) {case "future" === a:
return this.getTime() > cc().getTime();case "past" === a:
return this.getTime() < cc().getTime();case "weekday" === a:
return 0 < U(e, "Day") && 6 > U(e, "Day");case "weekend" === a:
return 0 === U(e, "Day") || 6 === U(e, "Day");case -1 < (d = W.weekdays.indexOf(a) % 7):
return U(e, "Day") === d;case -1 < (d = W.months.indexOf(a) % 12):
return U(e, "Month") === d;}return rc(this, a, null, b, c);
}
}, reset: function reset(a) {
var b = {},
c;a = a || "hours";"date" === a && (a = "days");c = Rb.some(function (b) {
return a === b.name || a === b.name + "s";
});b[a] = a.match(/^days?/) ? 1 : 0;return c ? this.set(b, !0) : this;
}, clone: function clone() {
var a = new r(this.getTime());a.utc(!!this._utc);return a;
} });
H(r, !0, !0, { iso: function iso() {
return this.toISOString();
}, getWeekday: r.prototype.getDay, getUTCWeekday: r.prototype.getUTCDay });function uc(a, b) {
function c() {
return R(this * b);
}function d() {
return tc(arguments)[a.j](this);
}function e() {
return tc(arguments)[a.j](-this);
}var g = a.name,
f = {};f[g] = c;f[g + "s"] = c;f[g + "Before"] = e;f[g + "sBefore"] = e;f[g + "Ago"] = e;f[g + "sAgo"] = e;f[g + "After"] = d;f[g + "sAfter"] = d;f[g + "FromNow"] = d;f[g + "sFromNow"] = d;t.extend(f);
}H(t, !0, !0, { duration: function duration(a) {
a = Y(a);return Xb(a, lc(this), "duration");
} });
W = Ib = r.addLocale("en", { plural: !0, timeMarker: "at", ampm: "am,pm", months: "January,February,March,April,May,June,July,August,September,October,November,December", weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday", units: "millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s", numbers: "one,two,three,four,five,six,seven,eight,nine,ten", articles: "a,an,the", tokens: "the,st|nd|rd|th,of", "short": "{Month} {d}, {yyyy}", "long": "{Month} {d}, {yyyy} {h}:{mm}{tt}", full: "{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}",
past: "{num} {unit} {sign}", future: "{num} {unit} {sign}", duration: "{num} {unit}", modifiers: [{ name: "sign", src: "ago|before", value: -1 }, { name: "sign", src: "from now|after|from|in|later", value: 1 }, { name: "edge", src: "last day", value: -2 }, { name: "edge", src: "end", value: -1 }, { name: "edge", src: "first day|beginning", value: 1 }, { name: "shift", src: "last", value: -1 }, { name: "shift", src: "the|this", value: 0 }, { name: "shift", src: "next", value: 1 }], dateParse: ["{month} {year}", "{shift} {unit=5-7}", "{0?} {date}{1}", "{0?} {edge} of {shift?} {unit=4-7?}{month?}{year?}"],
timeParse: "{num} {unit} {sign};{sign} {num} {unit};{0} {num}{1} {day} of {month} {year?};{weekday?} {month} {date}{1?} {year?};{date} {month} {year};{date} {month};{shift} {weekday};{shift} week {weekday};{weekday} {2?} {shift} week;{num} {unit=4-5} {sign} {day};{0?} {date}{1} of {month};{0?}{month?} {date?}{1?} of {shift} {unit=6-7}".split(";") });Ob = Rb.concat().reverse();Nb = Rb.concat();Nb.splice(2, 1);
K(r, !0, !0, Rb, function (a, b, c) {
function d(a) {
a /= f;var c = a % 1,
d = b.error || 0.999;c && P(c % 1) > d && (a = R(a));return 0 > a ? Aa(a) : Q(a);
}var e = b.name,
g = Yb(e),
f = b.b(),
h,
l;b.j = "add" + g + "s";h = function h(a, b) {
return d(this.getTime() - r.create(a, b).getTime());
};l = function l(a, b) {
return d(r.create(a, b).getTime() - this.getTime());
};a[e + "sAgo"] = l;a[e + "sUntil"] = l;a[e + "sSince"] = h;a[e + "sFromNow"] = h;a[b.j] = function (a, b) {
var c = {};c[e] = a;return this.advance(c, b);
};uc(b, f);3 > c && ["Last", "This", "Next"].forEach(function (b) {
a["is" + b + g] = function () {
return rc(this, b + " " + e, "en");
};
});4 > c && (a["beginningOf" + g] = function () {
var a = {};switch (e) {case "year":
a.year = U(this, "FullYear");break;case "month":
a.month = U(this, "Month");break;case "day":
a.day = U(this, "Date");break;case "week":
a.weekday = 0;}return this.set(a, !0);
}, a["endOf" + g] = function () {
var a = { hours: 23, minutes: 59, seconds: 59, milliseconds: 999 };switch (e) {case "year":
a.month = 11;a.day = 31;break;case "month":
a.day = this.daysInMonth();break;case "week":
a.weekday = 6;}return this.set(a, !0);
});
});
W.addFormat("([+-])?(\\d{4,4})[-.]?{full_month}[-.]?(\\d{1,2})?", !0, ["year_sign", "year", "month", "date"], !1, !0);W.addFormat("(\\d{1,2})[-.\\/]{full_month}(?:[-.\\/](\\d{2,4}))?", !0, ["date", "month", "year"], !0);W.addFormat("{full_month}[-.](\\d{4,4})", !1, ["month", "year"]);W.addFormat("\\/Date\\((\\d+(?:[+-]\\d{4,4})?)\\)\\/", !1, ["timestamp"]);W.addFormat(Vb(W), !1, Jb);Pb = W.g.slice(0, 7).reverse();W.g = W.g.slice(7).concat(Pb);oc("f", function (a) {
return U(a, "Milliseconds");
}, !0);
oc("s", function (a) {
return U(a, "Seconds");
});oc("m", function (a) {
return U(a, "Minutes");
});oc("h", function (a) {
return U(a, "Hours") % 12 || 12;
});oc("H", function (a) {
return U(a, "Hours");
});oc("d", function (a) {
return U(a, "Date");
});oc("M", function (a) {
return U(a, "Month") + 1;
});(function () {
function a(a, c) {
var d = U(a, "Hours");return Y(c).ampm[Q(d / 12)] || "";
}Z("t", a, 1);Z("tt", a);Z("T", a, 1, 1);Z("TT", a, null, 2);
})();
/* istanbul ignore next */
(function () {
function a(a, c) {
var d = U(a, "Day");return Y(c).weekdays[d];
}Z("dow", a, 3);Z("Dow", a, 3, 1);Z("weekday", a);Z("Weekday", a, null, 1);
})();nc("mon", 0, 3);nc("month", 0);nc("month2", 1);nc("month3", 2);X.ms = X.f;X.milliseconds = X.f;X.seconds = X.s;X.minutes = X.m;X.hours = X.h;X["24hr"] = X.H;X["12hr"] = X.h;X.date = X.d;X.day = X.d;X.year = X.yyyy;K(r, !0, !0, "short,long,full", function (a, b) {
a[b] = function (a) {
return qc(this, b, !1, a);
};
});
"〇一二三四五六七八九十百千万".split("").forEach(function (a, b) {
9 < b && (b = za(10, b - 9));Lb[a] = b;
});xa(Lb, Ka);Mb = q("([期週周])?([〇一二三四五六七八九十百千万" + Ja + "]+)(?!昨)", "g");
/* istanbul ignore next */
(function () {
var a = W.weekdays.slice(0, 7),
b = W.months.slice(0, 12);K(r, !0, !0, "today yesterday tomorrow weekday weekend future past".split(" ").concat(a).concat(b), function (a, b) {
a["is" + Yb(b)] = function (a) {
return this.is(b, 0, a);
};
});
})();r.utc || (r.utc = { create: function create() {
return tc(arguments, 0, !0);
}, past: function past() {
return tc(arguments, -1, !0);
}, future: function future() {
return tc(arguments, 1, !0);
} });
H(r, !1, !0, { RFC1123: "{Dow}, {dd} {Mon} {yyyy} {HH}:{mm}:{ss} {tz}", RFC1036: "{Weekday}, {dd}-{Mon}-{yy} {HH}:{mm}:{ss} {tz}", ISO8601_DATE: "{yyyy}-{MM}-{dd}", ISO8601_DATETIME: "{yyyy}-{MM}-{dd}T{HH}:{mm}:{ss}.{fff}{isotz}" });
})();
================================================
FILE: dist/preparser.js
================================================
'use strict';
// Replace out env variables.
var parseEnvVariables = function parseEnvVariables(input) {
var referenceRegex = /\${([a-zA-Z_][a-zA-Z0-9_]*)}|\$([a-zA-Z_][a-zA-Z0-9_]*)/g;
return input.replace(referenceRegex, function (varRef, capture1, capture2, capture3) {
var varName = capture1 || capture2 || capture3;
// Return the value of the variable, or the empty string if not there
return process.env.hasOwnProperty(varName) ? process.env[varName] : '';
});
};
var preparser = function preparser(input) {
input = parseEnvVariables(input);
return input;
};
module.exports = preparser;
================================================
FILE: dist/util/colorFile.js
================================================
'use strict';
var strip = require('./stripAnsi');
var chalk = {};
var map = { cyan: 36, red: 31, magenta: 35 };
Object.keys(map).forEach(function (key, value) {
chalk[key] = function (str) {
return '\u001b[' + value + 'm' + str + '\u001b[39m';
};
});
/**
* Wraps file strings in ANSI colors
* based on their extension.
*
* @param {file} str
* @return {String}
* @api public
*/
module.exports = function (file) {
var audio = ['aac', 'au', 'flac', 'mid', 'midi', 'mka', 'mp3', 'mpc', 'ogg', 'ra', 'wav', 'axa', 'oga', 'spx', 'xspf'];
var archive = ['tar', 'tgz', 'arj', 'taz', 'lzh', 'lzma', 'tlz', 'txz', 'zip', 'z', 'Z', 'dz', 'gz', 'lz', 'xz', 'bz2', 'bz', 'tbz', 'tbz2', 'tz', 'deb', 'rpm', 'jar', 'rar', 'ace', 'zoo', 'cpio', '7z', 'rz'];
var images = ['jpg', 'jpeg', 'gif', 'bmp', 'pbm', 'pgm', 'ppm', 'tga', 'xbm', 'xpm', 'tif', 'tiff', 'png', 'svg', 'svgz', 'mng', 'pcx', 'mov', 'mpg', 'mpeg', 'm2v', 'mkv', 'ogm', 'mp4', 'm4v', 'mp4v', 'vob', 'qt', 'nuv', 'wmv', 'asf', 'rm', 'rmvb', 'flc', 'avi', 'fli', 'flv', 'gl', 'dl', 'xcf', 'xwd', 'yuv', 'cgm', 'emf', 'axv', 'anx', 'ogv', 'ogx'];
var extension = String(file).toLowerCase().trim().split('.');
extension = extension[extension.length - 1];
var colored = strip(file);
colored = audio.indexOf(extension) > -1 ? chalk.cyan(file) : archive.indexOf(extension) > -1 ? chalk.red(file) : images.indexOf(extension) > -1 ? chalk.magenta(file) : colored;
return colored;
};
================================================
FILE: dist/util/columnify.js
================================================
'use strict';
var strip = require('./stripAnsi');
var pad = require('./pad');
/**
* Formats an array to display in a TTY
* in a pretty fashion.
*
* @param {Array} arr
* @return {String}
* @api public
*/
module.exports = function (arr, options) {
arr = arr || [];
options = options || {};
var bk = JSON.parse(JSON.stringify(arr));
var width = options.width && !isNaN(options.width) ? options.width : process.stdout.columns;
var longest = strip(bk.sort(function (a, b) {
return strip(b).length - strip(a).length;
})[0] || '').length + 2;
var fullWidth = strip(arr.join('')).length;
var fitsOneLine = fullWidth + arr.length * 2 <= width;
var cols = Math.floor(width / longest);
cols = cols < 1 ? 1 : cols;
if (fitsOneLine) {
return arr.join(' ');
}
var col = 0;
var lines = [];
var line = '';
for (var i = 0; i < arr.length; ++i) {
if (col < cols) {
col++;
} else {
if (String(strip(line)).trim() !== '') {
lines.push(line);
}
line = '';
col = 1;
}
if (cols === 1) {
// If we have files so damn
// long that we wrap, don't pad
// the lines.
line += arr[i];
} else {
// Pad the lines based on the
// longest word.
/* istanbul ignore next */
line += pad(arr[i], longest, ' ');
}
}
if (line !== '') {
lines.push(line);
}
return lines.join('\n');
};
================================================
FILE: dist/util/converter.date.js
================================================
'use strict';
/**
* Date conversion utilities
*/
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function pad(num, padding) {
padding = padding || '0';
num = parseFloat(num);
if (num < 10) {
return '' + padding + num;
}
return num;
}
module.exports = {
unix: function unix(dt) {
var date = dt;
var day = pad(date.getDate(), ' ');
var month = months[date.getMonth()];
var hour = pad(date.getHours());
var min = pad(date.getMinutes());
var hourMin = hour + ':' + min;
day = day.length === 1 ? ' ' + day : day;
date = month + ' ' + day + ' ' + hourMin;
return date;
}
};
================================================
FILE: dist/util/converter.path.js
================================================
'use strict';
var path = require('path');
/**
* Path conversion utilities
*/
module.exports = {
unix: function unix(str) {
var input = path.normalize(str);
input = input.replace(/\\/g, '\/');
var parts = input.split(':');
var drive = parts.shift();
var isLetter = drive.length === 1 && drive.match(/[a-z]/i);
var result = isLetter ? drive + parts.join(':') : input;
return result;
}
};
================================================
FILE: dist/util/converter.permissions.js
================================================
'use strict';
/**
* Permission conversion utilities
*/
module.exports = {
listing: {
0: '---',
1: '--x',
2: '-w-',
3: '-wx',
4: 'r--',
5: 'r-x',
6: 'rw-',
7: 'rwx'
},
modeToRWX: function modeToRWX(mode) {
var octal = this.modeToOctal(mode);
var rwx = this.octalToRWX(octal);
return rwx;
},
modeToOctal: function modeToOctal(mode) {
var octal = '0' + (mode & 511).toString(8);
return octal;
},
octalToRWX: function octalToRWX(octal) {
if (!octal) {
return undefined;
}
var list = this.listing;
var a = list[String(octal).charAt(1)];
var b = list[String(octal).charAt(2)];
var c = list[String(octal).charAt(3)];
return a + b + c;
}
};
================================================
FILE: dist/util/expand.js
================================================
'use strict';
var glob = require('glob');
/**
* Expands wildcard files, etc. out
* into their full paths.
*
* @param {Array} list
* @return {Array}
* @api public
*/
module.exports = function (list) {
var total = list.length;
var files = [];
if (list.length < 1) {
return [];
}
for (var i = 0; i < total; ++i) {
var res = glob.sync(list[i], {});
files[i] = res.length > 0 ? res : list[i];
}
var out = [];
for (var _i = 0; _i < files.length; ++_i) {
out = Array.isArray(files[_i]) ? out.concat(files[_i]) : out.concat([files[_i]]);
}
return out;
};
================================================
FILE: dist/util/fetch.js
================================================
'use strict';
var fs = require('fs');
var path = require('path');
var expand = require('./expand');
/**
* Reads the contents of an array of
* files and returns the array.
*
* @param {Array} files
* @param {String} stdin
* @param {Object} options
* @return {Array}
* @api public
*/
module.exports = function (files, stdin, options) {
files = files || [];
stdin = stdin !== undefined ? stdin : [];
var f = expand(files);
if (!(f.length === 0 && files.length > 0)) {
files = f;
}
for (var i = 0; i < files.length; ++i) {
try {
var stat = fs.statSync(files[i]);
if (stat.isDirectory()) {
files[i] = options.onDirectory(files[i]);
} else {
files[i] = String(fs.readFileSync(path.normalize(files[i]), 'utf8'));
}
} catch (e) {
files[i] = options.onInvalidFile(files[i]);
}
}
var agg = files.length < 1 ? stdin : files;
var final = [];
for (var _i = 0; _i < agg.length; ++_i) {
if (agg[_i] !== undefined) {
final.push(agg[_i]);
}
}
return final;
};
================================================
FILE: dist/util/fileFromPath.js
================================================
'use strict';
/**
* Parses a path and returns just the file
*
* @param {path} str
* @return {String}
* @api public
*/
module.exports = function (path) {
var fileShort = String(path).split('/');
fileShort = fileShort[fileShort.length - 1];
fileShort = fileShort.split('\\');
fileShort = fileShort[fileShort.length - 1];
return fileShort;
};
================================================
FILE: dist/util/intercept.js
================================================
'use strict';
/**
* Intercepts stdout, passes thru callback
* also pass console.error thru stdout so it goes to callback too
* (stdout.write and stderr.write are both refs to the same stream.write function)
* returns an unhook() function, call when done intercepting
*
* @param {Function} callback
* @return {Function}
*/
module.exports = function (callback) {
var oldStdoutWrite = process.stdout.write;
var oldConsoleError = console.error;
process.stdout.write = function (write) {
return function (string) {
var args = Array.from(arguments);
args[0] = interceptor(string);
write.apply(process.stdout, args);
};
}(process.stdout.write);
console.error = function () {
return function () {
var args = Array.from(arguments);
args.unshift('\x1b[31m[ERROR]\x1b[0m');
console.log.apply(console.log, args);
};
}(console.error);
function interceptor(string) {
// only intercept the string
var result = callback(string);
if (typeof result === 'string') {
string = result.replace(/\n$/, '') + (result && /\n$/.test(string) ? '\n' : '');
}
return string;
}
// puts back to original
return function unhook() {
process.stdout.write = oldStdoutWrite;
console.error = oldConsoleError;
};
};
================================================
FILE: dist/util/interfacer.js
================================================
'use strict';
/**
* Simple binding interface between
* each command's function and the caller
* of the command, whether by `cash.command`
* or by being invoked by Vorpal.
* This exists to abstract complexity
* and create a standard in interfacing
* commands acorss muliple execution paths.
*
* @param {Object} opt
* @api public
*/
module.exports = function (opt) {
var self = this;
var stdout = '';
opt.options = opt.options || {};
opt.callback = opt.callback || function () {};
opt.command = opt.command || {
exec: function exec() {}
};
var logger = {
log: function log(out) {
stdout += out + '\n';
if (opt.silent !== true) {
// process.stdout.write(out) // to do - handle newline problem.
self.log(out);
}
}
};
function onResult(result) {
result = result === undefined ? 0 : result;
opt.callback(null, stdout);
return stdout;
}
if (opt.async === true) {
return opt.command.exec.call(logger, opt.args, opt.options, onResult);
}
return onResult(opt.command.exec.call(logger, opt.args, opt.options));
};
================================================
FILE: dist/util/lpad.js
================================================
'use strict';
var strip = require('./stripAnsi');
/**
* Pads to the left hand.
*
* @param {String} str
* @param {Integer} width
* @param {String} delimiter
* @return {String}
* @api public
*/
module.exports = function (str, width, delimiter) {
width = Math.floor(width);
delimiter = delimiter || ' ';
var len = Math.max(0, width - strip(str).length);
return Array(len + 1).join(delimiter) + str;
};
================================================
FILE: dist/util/pad.js
================================================
'use strict';
var strip = require('./stripAnsi');
/**
* Pads a value with with space or
* a specified delimiter to match a
* given width.
*
* @param {String} str
* @param {Integer} width
* @param {String} delimiter
* @return {String}
* @api public
*/
module.exports = function (str, width, delimiter) {
width = Math.floor(width);
delimiter = delimiter || ' ';
var len = Math.max(0, width - strip(str).length);
return str + Array(len + 1).join(delimiter);
};
================================================
FILE: dist/util/stripAnsi.js
================================================
'use strict';
/**
* Removes all ansi characters.
*
* @param {String} str
* @return {String}
* @api public
*/
module.exports = function (str) {
var ansiRegex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
};
================================================
FILE: dist/util/unlinkSync.js
================================================
'use strict';
var fs = require('fs');
/**
* Normalizes _unlinkSync() across
* platforms to match Unix behavior, i.e.
* file can be unlinked even its it's
* read only.
* See https://github.com/joyent/node/issues/3006
*
* @param {String} file
* @api public
*/
module.exports = function (file) {
try {
fs.unlinkSync(file);
} catch (e) {
// Try to override file permission
/* istanbul ignore if */
if (e.code === 'EPERM') {
fs.chmodSync(file, '0666');
fs.unlinkSync(file);
} else {
/* istanbul ignore next */
throw e;
}
}
};
================================================
FILE: dist/util/walkDir.js
================================================
'use strict';
var fs = require('fs');
var path = require('path');
/**
* Walks a single directory calling
* a callback function for each file or
* folder, returning the path and results
* of fs.statSync.
*
* @param {String} currentDirPath
* @param {Function} callback
* @param {Function} errorCallback
* @api public
*/
module.exports = function (currentDirPath, callback, errorCallback) {
/**
* @param {String} path
* @param {Function} cbk
* @param {Function} ecbk
*/
function readFile(path, cbk, ecbk) {
try {
var stat = fs.statSync(path);
if (stat.isFile() || stat.isDirectory()) {
cbk(path, stat);
}
} catch (e) {
ecbk(path, e);
}
}
try {
var dirs = fs.readdirSync(currentDirPath);
dirs.forEach(function (name) {
var filePath = path.join(currentDirPath, name);
readFile(filePath, callback, errorCallback);
});
} catch (e) {
if (e.code === 'ENOTDIR') {
readFile(currentDirPath, callback, errorCallback);
} else {
errorCallback(currentDirPath, e);
}
}
};
================================================
FILE: dist/util/walkDirRecursive.js
================================================
'use strict';
var fs = require('fs');
var path = require('path');
/**
* Recursively walks through and executes
* a callback function for each directory found.
*
* @param {String} currentDirPath
* @param {Function} callback
* @api public
*/
module.exports = function (currentDirPath, callback) {
fs.readdirSync(currentDirPath).forEach(function (name) {
var filePath = path.join(currentDirPath, name);
var stat = fs.statSync(filePath);
if (stat.isDirectory()) {
callback(filePath, stat);
module.exports(filePath, callback);
}
});
};
================================================
FILE: dist/windows.js
================================================
'use strict';
var os = require('os');
var windows = os.platform() === 'win32';
var exclusions = require('./../commands.json').windowsExclusions;
module.exports = {
registerCommands: function registerCommands(self) {
self.vorpal.catch('[words...]', 'Catches content').parse(function (input) {
// Look for aliases and translate them.
// Makes cash.alias and cash.unalias work.
var parts = String(input).split(' ');
var first = parts.shift();
var out = input;
var translation = self.vorpal._aliases[first];
if (self.vorpal._aliases && translation) {
/* istanbul ignore next */
out = translation + ' ' + parts.join(' ');
}
return out;
}).autocomplete(function () {
/* istanbul ignore next */
return self.vorpal.commands.map(function (c) {
return c._name;
});
}).action(function (args, cb) {
cb = cb || function () {};
var spawn = require('child_process').spawn;
var slf = this;
var words = args.words.join(' ');
var argus = void 0;
var cmd = void 0;
// Only register commands if on Windows.
/* istanbul ignore next */
if (windows) {
var excluded = false;
for (var i = 0; i < exclusions.length; ++i) {
if (String(words.slice(0, exclusions[i].length)).toLowerCase() === exclusions[i].toLowerCase()) {
excluded = true;
cmd = undefined;
argus = undefined;
}
}
if (!excluded) {
var parts = words.split(' ');
cmd = parts.shift();
argus = parts;
argus = argus.length === 1 && argus[0] === '' ? [] : argus;
}
}
// Accommodate tests for Linux.
if (words === 'cash-test') {
cmd = 'echo';
argus = ['hi'];
}
if (cmd === undefined || argus === undefined) {
slf.help();
cb();
return;
}
argus.unshift(cmd);
argus.unshift('/C');
var proc = void 0;
var out = '';
try {
proc = spawn('cmd', argus);
} catch (e) {
/* istanbul ignore next */
slf.log(e);
}
var closed = false;
// Properly print stdout as it's fed,
// waiting for line breaks before sending
// it to Vorpal.
function print() {
var parts = String(out).split('\n');
/* istanbul ignore next */
if (parts.length > 1) {
out = parts.pop();
var logging = String(parts.join('\n')).replace(/\r\r/g, '\r');
slf.log(logging);
}
/* istanbul ignore next */
if (closed === false) {
setTimeout(function () {
print();
}, 50);
}
}
print();
// See if we get a Windows help on an
// invalid command and instead throw
// Cash help.
var windowsHelpFlag = false;
var windowsCommandReject = 'is not recognized as an internal or external command';
/* istanbul ignore next */
proc.stdout.on('data', function (data) {
out += data.toString('utf8');
});
/* istanbul ignore next */
proc.stderr.on('data', function (data) {
var str = data.toString('utf8');
if (windows && str.indexOf(windowsCommandReject) > -1) {
windowsHelpFlag = true;
return;
}
out += str;
});
proc.on('close', function () {
closed = true;
if (String(out).trim() !== '') {
slf.log(String(out).replace(/\r\r/g, '\r'));
out = '';
}
if (windowsHelpFlag) {
slf.help();
}
/* istanbul ignore next */
setTimeout(function () {
cb();
}, 150);
});
proc.on('error', function (data) {
out += data.toString('utf8');
});
});
}
};
================================================
FILE: gulpfile.js
================================================
'use strict';
const $ = require('shelljs');
const babel = require('gulp-babel');
const changed = require('gulp-changed');
const eslint = require('gulp-eslint');
const fs = require('fs');
const gulp = require('gulp');
gulp.task('lint', function () {
return gulp.src(['src/*.js', './*.js', './bin/*.js'])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('babel', function () {
const bab = babel();
gulp.src('src/**/*.js')
.pipe(changed('dist'))
.pipe(bab)
.pipe(gulp.dest('dist'));
return;
});
gulp.task('build', function () {
const commands = require('./commands.json');
for (let i = 0; i < commands.commands.length; ++i) {
const command = commands.commands[i];
const content = `#!/usr/bin/env node\nrequire('./parser')(process.argv, '${command}');\n`;
fs.writeFileSync(`./bin/${command}.js`, content);
}
});
function getJSON(name) {
const dir = `./packages/${name}`;
let json;
try {
json = fs.readFileSync(`${dir}/package.json`, {encoding: 'utf8', force: true});
json = JSON.parse(json);
} catch (e) {
$.cp('-f', `./packages/template.package.json`, `${dir}/package.json`);
return getJSON(name);
}
return json;
}
function writeJSON(name, json) {
const dir = `./packages/${name}`;
fs.writeFileSync(`${dir}/package.json`, `${JSON.stringify(json, null, ' ')}\n`);
}
gulp.task('packages', function () {
const commands = require('./commands.json');
let related = '';
related += `- [cash](https://github.com/dthree/cash) - Main project\n`;
related += `- [cash-global](https://npmjs.com/package/cash-global) - Globally install all commands\n`;
related += `- [vorpal](https://github.com/dthree/vorpal) - Cash is built on Vorpal\n\n`;
related += `#### Individual commands\n\n`;
for (const name in commands.packages) {
if (commands.packages.hasOwnProperty(name)) {
related += `- [cash-${name}](https://npmjs.com/package/cash-${name})\n`;
}
}
related = related.replace(/\n$/g, '');
for (const name in commands.packages) {
if (commands.packages.hasOwnProperty(name)) {
const pkg = commands.packages[name];
const deps = pkg.dependencies;
const files = pkg.files;
const dir = `./packages/${name}`;
$.rm('-rf', `${dir}/dist`);
$.mkdir('-p', `${dir}/dist/help`);
$.mkdir('-p', `${dir}/dist/lib`);
$.mkdir('-p', `${dir}/dist/commands`);
$.mkdir('-p', `${dir}/dist/util`);
$.mkdir('-p', `${dir}/bin`);
const json = getJSON(name);
const jsonMain = require('./package.json');
json.dependencies = {};
json.devDependencies = {};
const preparser = `./dist/preparser.js`;
const main = `./dist/commands/${name}.js`;
const help = `./dist/help/${name}.js`;
const bin = `./bin/${name}.js`;
$.cp('-f', main, `${dir}/${main}`);
$.cp('-f', bin, `${dir}/${bin}`);
$.cp('-f', help, `${dir}/${help}`);
$.cp('-f', preparser, `${dir}/${preparser}`);
$.cp('-f', './bin/parser.js', `${dir}/bin/parser.js`);
$.cp('-f', `./packages/template.README.md`, `${dir}/README.md`);
let readme = String($.cat(`${dir}/README.md`));
readme = readme.replace(/\{package\-name\}/g, `cash-${name}`);
readme = readme.replace(/\{command\-name\}/g, `${name}`);
readme = readme.replace(/\{related\}/g, related);
new $.ShellString(readme).to(`${dir}/README.md`);
for (let i = 0; i < files.length; ++i) {
$.cp('-f', files[i], `${dir}/${files[i]}`);
}
for (let i = 0; i < deps.length; ++i) {
json.dependencies[deps[i]] = jsonMain.dependencies[deps[i]];
if (json.dependencies[deps[i]] === undefined) {
throw new Error(`Sub-module dependency for "${name}" does not exist in the main package.json file.`);
}
}
json.files = ['dist', 'bin'];
json.dependencies.vorpal = jsonMain.dependencies.vorpal;
json.name = `cash-${name}`;
json.description = `Cross-platform implementation of the Unix '${name}' command.`;
json.main = main;
json.bin = json.bin || {};
json.bin[name] = bin;
writeJSON(name, json);
}
}
if ($.test('-e', './../cash-global/commands.json')) {
$.cp('./commands.json', './../cash-global/commands.json');
}
});
gulp.task('watch', function () {
gulp.watch('src/**/*.js', ['babel', 'build', 'packages']);
gulp.watch('commands.json', ['babel', 'build', 'packages']);
gulp.watch('test/**/*.js', ['babel', 'build', 'packages']);
});
gulp.task('default', ['babel', 'watch', 'build', 'packages']);
gulp.task('builder', ['babel', 'build', 'packages']);
================================================
FILE: package.json
================================================
{
"name": "cash",
"version": "0.8.0",
"description": "Cross-platform Linux commands in pure ES6.",
"main": "./dist/index.js",
"scripts": {
"test": "gulp builder; ./node_modules/istanbul/lib/cli.js cover --root './dist' -x './dist/lib/sugar.js' _mocha -- -R spec && npm run lint",
"test-win": "mocha",
"lint": "xo ./src/*.js ./src/**/*.js ./test/*.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dthree/cash.git"
},
"keywords": [
"terminal",
"emulator",
"cygwin",
"cli",
"windows",
"linux",
"unix",
"posix",
"shell",
"shelljs",
"bash",
"cash",
"$",
"tty",
"util",
"vorpal",
"vorpal.js"
],
"author": "dthree",
"license": "MIT",
"bugs": {
"url": "https://github.com/dthree/cash/issues"
},
"homepage": "https://github.com/dthree/cash#readme",
"devDependencies": {
"babel-core": "^6.5.2",
"babel-preset-es2015": "^6.5.0",
"coveralls": "^2.11.6",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.2",
"gulp-changed": "^1.3.0",
"gulp-eslint": "^2.0.0",
"istanbul": "^0.4.2",
"mocha": "^2.2.5",
"shelljs": "^0.7.0",
"should": "^7.0.3",
"webpack": "^1.12.13",
"xo": "^0.12.1"
},
"bin": {
"$": "./bin/cash.js",
"cash": "./bin/cash.js"
},
"dependencies": {
"array-shuffle": "^1.0.0",
"chalk": "^1.1.0",
"filesize": "^3.1.3",
"fkill": "^4.0.0",
"fs-extra": "^0.26.7",
"glob": "^7.0.3",
"lodash": "^4.0.0",
"minimist": "^1.2.0",
"user-home": "^2.0.0",
"username": "^2.1.0",
"vorpal": "^1.10.8",
"vorpal-autocomplete-fs": "0.0.3",
"vorpal-grep": "^0.1.2",
"vorpal-less": "0.0.13",
"which": "^1.2.4"
},
"engines": {
"node": ">= 4",
"iojs": ">= 1.0.0"
},
"files": [
"commands.json",
"dist",
"bin"
],
"xo": {
"envs": [
"node",
"mocha"
],
"space": true,
"esnext": true,
"rules": {
"prefer-arrow-callback": 0,
"no-loop-func": 0,
"no-nested-ternary": 0,
"no-constant-condition": 0,
"no-use-extend-native/no-use-extend-native": 0,
"no-negated-condition": 0,
"no-inner-declarations": 0,
"prefer-reflect": 0,
"wrap-iife": 0,
"no-unused-expressions": 0,
"global-require": 0
}
}
}
================================================
FILE: packages/cat/README.md
================================================
# cash-cat
---
This is a cross-platform, 100% ES6 implementation of the Unix `cat` command.
```bash
npm install cash-cat -g
```
This will install `cat` globally in your system path.
For help on the command, type:
```bash
> cat --help
```
## More
This module is part of [Cash](https://github.com/dthree/cash), a project providing cross-platform implementations of all major Unix-based commands in pure Javascript.
## Related
- [cash](https://github.com/dthree/cash) - Main project
- [cash-global](https://npmjs.com/package/cash-global) - Globally install all commands
- [vorpal](https://github.com/dthree/vorpal) - Cash is built on Vorpal
#### Individual commands
- [cash-cat](https://npmjs.com/package/cash-cat)
- [cash-cp](https://npmjs.com/package/cash-cp)
- [cash-false](https://npmjs.com/package/cash-false)
- [cash-head](https://npmjs.com/package/cash-head)
- [cash-kill](https://npmjs.com/package/cash-kill)
- [cash-ls](https://npmjs.com/package/cash-ls)
- [cash-mkdir](https://npmjs.com/package/cash-mkdir)
- [cash-mv](https://npmjs.com/package/cash-mv)
- [cash-pwd](https://npmjs.com/package/cash-pwd)
- [cash-sort](https://npmjs.com/package/cash-sort)
- [cash-tail](https://npmjs.com/package/cash-tail)
- [cash-touch](https://npmjs.com/package/cash-touch)
- [cash-true](https://npmjs.com/package/cash-true)
- [cash-rm](https://npmjs.com/package/cash-rm)
- [cash-which](https://npmjs.com/package/cash-which)
## License
MIT © [David Caccavella](https://github.com/dthree)
================================================
FILE: packages/cat/bin/cat.js
================================================
#!/usr/bin/env node
require('./parser')(process.argv, 'cat');
================================================
FILE: packages/cat/bin/parser.js
================================================
'use strict';
module.exports = function (args, command) {
args.splice(0, 2);
var pipes = (args.indexOf('|') > -1);
if (args.length === 0) {
// If we don't have to parse arguments, do
// the quickest load: just the raw js file
// of the command and nothing else.
var cmd = require('./../dist/commands/' + command)();
cmd.exec.call(console, {options: {}}, {});
} else if (pipes === false) {
// If we need to parse args for this
// command only, pull up vorpal and just load
// that one command.
var vorpal = require('vorpal')();
vorpal.api = {};
require('./../dist/commands/' + command)(vorpal);
args = args.join(' ');
// If we passed in a help request, load in
// the help file.
if (args.indexOf('help') > -1 || args.indexOf('?') > -1) {
let help;
try {
help = require('./../dist/help/' + command + '.js');
help = String(help).replace(/^\n|\n$/g, '');
} catch (e) {}
let cmdObj = vorpal.find(command);
if (cmdObj && help) {
cmdObj.help(function (argus, cb) {
cb(help);
})
}
}
vorpal.exec(command + ' ' + args);
} else {
// If we get into piping other commands,
// we need to go full bore and load the
// entire cash library.
// I guess we could technically parse all
// of the passed args, look for applicable
// commands and only load those, but that's
// some messy work for something that might
// not matter. If you're reading this and
// have deemed it matters, do a PR.
var cash = require('./../dist/index');
cash.vorpal.exec(command + ' ' + args.join(' '));
}
};
================================================
FILE: packages/cat/dist/commands/cat.js
================================================
'use strict';
var fsAutocomplete = require('vorpal-autocomplete-fs');
var fetch = require('./../util/fetch');
var interfacer = require('./../util/interfacer');
var preparser = require('./../preparser');
var lpad = require('./../util/lpad');
var strip = require('./../util/stripAnsi');
var cat = {
exec: function exec(args, options) {
var self = this;
// Input normalization
if (args === undefined) {
args = {
files: []
};
} else if (typeof args === 'string' || args instanceof String) {
args = {
files: [args]
};
} else if (Array.isArray(args)) {
args = {
files: args
};
}
options = options || {};
// -A handler
if (options.showall) {
options.shownonprinting = true;
options.showends = true;
options.showtabs = true;
}
// -e handler
if (options.e) {
options.shownonprinting = true;
options.showends = true;
}
// -t handler
if (options.t) {
options.shownonprinting = true;
options.showtabs = true;
}
var stdout = '';
try {
var stdin = fetch(args.files, args.stdin, {
onDirectory: function onDirectory(name) {
return 'cat: ' + name + ': Is a directory';
},
onInvalidFile: function onInvalidFile(name) {
return 'cat: ' + name + ': No such file or directory';
}
});
var ctr = 0;
for (var i = 0; i < stdin.length; ++i) {
// If -s, squeeze double blank lines to a
// single line.
if (options.squeezeblank) {
stdin[i] = stdin[i].replace(/\n\n\s*\n/g, '\n\n');
}
if (options.showtabs) {
stdin[i] = stdin[i].replace(/\t/g, '^I');
}
// Get rid of trailing line break because
// node logging does it anyway.
stdin[i] = stdin[i].replace(/\s$/, '');
var parts = String(stdin[i]).split('\n');
for (var j = 0; j < parts.length; ++j) {
var blank = strip(parts[j]).trim() === '';
// If -b, number every non-blank line
// If -n, number every line
var numbered = !blank && options.numbernonblank || options.number && !options.numbernonblank;
if (numbered) {
ctr++;
}
var numStr = numbered ? lpad(String(ctr), 6, ' ') + ' ' : '';
// If -E, append a $ to each line end.
var dollarStr = options.showends ? '$' : '';
var line = numStr + parts[j] + dollarStr;
stdout += line + '\n';
}
}
if (stdout.length > 0) {
self.log(stdout.slice(0, stdout.length - 1));
}
return 0;
} catch (e) {
/* istanbul ignore next */
self.log(e.stack);
/* istanbul ignore next */
return 1;
}
}
};
module.exports = function (vorpal) {
if (vorpal === undefined) {
return cat;
}
vorpal.api.cat = cat;
vorpal.command('cat [files...]').parse(preparser).option('-A, --show-all', 'equivalent to -vET').option('-b, --number-nonblank', 'number nonempty output lines, overrides -n').option('-e', 'equivalent to -vE').option('-E, --show-ends', 'display $ at end of each line').option('-n, --number', 'number all output lines').option('-s, --squeeze-blank', 'suppress repeated empty output lines').option('-t', 'equivalent to -vT').option('-T, --show-tabs', 'display TAB characters as ^I').option('-v, --show-nonprinting', 'use ^ and M- notation, except for LFD and TAB') // this doesn't work yet...
.autocomplete(fsAutocomplete()).action(function (args, cb) {
args.options = args.options || {};
return interfacer.call(this, {
command: cat,
args: args,
options: args.options,
callback: cb
});
});
};
================================================
FILE: packages/cat/dist/help/cat.js
================================================
"use strict";
module.exports = "\nUsage: cat [OPTION]... [FILE]...\nConcatenate FILE(s), or standard input, to standard output.\n\n -A, --show-all equivalent to -vET\n -b, --number-nonblank number nonempty output lines, overrides -n\n -e equivalent to -vE\n -E, --show-ends display $ at end of each line\n -n, --number number all output lines\n -s, --squeeze-blank suppress repeated empty output lines\n -t equivalent to -vT\n -T, --show-tabs display TAB characters as ^I\n -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB\n --help display this help and exit\n\nWith no FILE, or when FILE is -, read standard input.\n\nExamples:\n cat f - g Output f's contents, then standard input, then g's contents.\n cat Copy standard input to standard output.\n\nReport cat bugs to <https://github.com/dthree/cash>\nCash home page: <http://cash.js.org/>\n";
================================================
FILE: packages/cat/dist/preparser.js
================================================
'use strict';
// Replace out env variables.
var parseEnvVariables = function parseEnvVariables(input) {
var referenceRegex = /\${([a-zA-Z_][a-zA-Z0-9_]*)}|\$([a-zA-Z_][a-zA-Z0-9_]*)/g;
return input.replace(referenceRegex, function (varRef, capture1, capture2, capture3) {
var varName = capture1 || capture2 || capture3;
// Return the value of the variable, or the empty string if not there
return process.env.hasOwnProperty(varName) ? process.env[varName] : '';
});
};
var preparser = function preparser(input) {
input = parseEnvVariables(input);
return input;
};
module.exports = preparser;
================================================
FILE: packages/cat/d
gitextract_hiy2al8k/
├── .babelrc
├── .eslintignore
├── .gitignore
├── .istanbul.yml
├── .travis.yml
├── LICENSE
├── README.md
├── appveyor.yml
├── bin/
│ ├── alias.js
│ ├── cash.js
│ ├── cat.js
│ ├── cd.js
│ ├── clear.js
│ ├── cp.js
│ ├── echo.js
│ ├── export.js
│ ├── false.js
│ ├── grep.js
│ ├── head.js
│ ├── kill.js
│ ├── less.js
│ ├── ls.js
│ ├── mkdir.js
│ ├── mv.js
│ ├── parser.js
│ ├── pwd.js
│ ├── rm.js
│ ├── sort.js
│ ├── source.js
│ ├── tail.js
│ ├── touch.js
│ ├── true.js
│ ├── unalias.js
│ └── which.js
├── commands.json
├── dist/
│ ├── commands/
│ │ ├── alias.js
│ │ ├── boilerplate.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── less.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── delimiter.js
│ ├── help/
│ │ ├── alias.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── help.js
│ ├── index.js
│ ├── lib/
│ │ └── sugar.js
│ ├── preparser.js
│ ├── util/
│ │ ├── colorFile.js
│ │ ├── columnify.js
│ │ ├── converter.date.js
│ │ ├── converter.path.js
│ │ ├── converter.permissions.js
│ │ ├── expand.js
│ │ ├── fetch.js
│ │ ├── fileFromPath.js
│ │ ├── intercept.js
│ │ ├── interfacer.js
│ │ ├── lpad.js
│ │ ├── pad.js
│ │ ├── stripAnsi.js
│ │ ├── unlinkSync.js
│ │ ├── walkDir.js
│ │ └── walkDirRecursive.js
│ └── windows.js
├── gulpfile.js
├── package.json
├── packages/
│ ├── cat/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── cat.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── cat.js
│ │ │ ├── help/
│ │ │ │ └── cat.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ ├── fetch.js
│ │ │ ├── interfacer.js
│ │ │ ├── lpad.js
│ │ │ └── stripAnsi.js
│ │ └── package.json
│ ├── cp/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── cp.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── cp.js
│ │ │ ├── help/
│ │ │ │ └── cp.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── false/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── false.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── false.js
│ │ │ ├── help/
│ │ │ │ └── false.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── head/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── head.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── head.js
│ │ │ ├── help/
│ │ │ │ └── head.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── kill/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── kill.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── kill.js
│ │ │ ├── help/
│ │ │ │ └── kill.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── ls/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── ls.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── ls.js
│ │ │ ├── help/
│ │ │ │ └── ls.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── colorFile.js
│ │ │ ├── columnify.js
│ │ │ ├── converter.date.js
│ │ │ ├── converter.permissions.js
│ │ │ ├── expand.js
│ │ │ ├── fileFromPath.js
│ │ │ ├── interfacer.js
│ │ │ ├── lpad.js
│ │ │ ├── pad.js
│ │ │ ├── stripAnsi.js
│ │ │ ├── walkDir.js
│ │ │ └── walkDirRecursive.js
│ │ └── package.json
│ ├── mkdir/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── mkdir.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── mkdir.js
│ │ │ ├── help/
│ │ │ │ └── mkdir.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── mv/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── mv.js
│ │ │ └── parser.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── mv.js
│ │ │ ├── help/
│ │ │ │ └── mv.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── pwd/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── pwd.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── pwd.js
│ │ │ ├── help/
│ │ │ │ └── pwd.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── rm/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── rm.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── rm.js
│ │ │ ├── help/
│ │ │ │ └── rm.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ ├── interfacer.js
│ │ │ └── unlinkSync.js
│ │ └── package.json
│ ├── sort/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── sort.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── sort.js
│ │ │ ├── help/
│ │ │ │ └── sort.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── expand.js
│ │ │ ├── fetch.js
│ │ │ ├── interfacer.js
│ │ │ └── stripAnsi.js
│ │ └── package.json
│ ├── tail/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── tail.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── tail.js
│ │ │ ├── help/
│ │ │ │ └── tail.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ ├── converter.path.js
│ │ │ ├── expand.js
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── template.README.md
│ ├── template.package.json
│ ├── touch/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── touch.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── touch.js
│ │ │ ├── help/
│ │ │ │ └── touch.js
│ │ │ ├── lib/
│ │ │ │ └── sugar.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ ├── true/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── parser.js
│ │ │ └── true.js
│ │ ├── dist/
│ │ │ ├── commands/
│ │ │ │ └── true.js
│ │ │ ├── help/
│ │ │ │ └── true.js
│ │ │ ├── preparser.js
│ │ │ └── util/
│ │ │ └── interfacer.js
│ │ └── package.json
│ └── which/
│ ├── README.md
│ ├── bin/
│ │ ├── parser.js
│ │ └── which.js
│ ├── dist/
│ │ ├── commands/
│ │ │ └── which.js
│ │ ├── help/
│ │ │ └── which.js
│ │ ├── preparser.js
│ │ └── util/
│ │ └── interfacer.js
│ └── package.json
├── src/
│ ├── commands/
│ │ ├── alias.js
│ │ ├── boilerplate.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── less.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── delimiter.js
│ ├── help/
│ │ ├── alias.js
│ │ ├── cat.js
│ │ ├── cd.js
│ │ ├── clear.js
│ │ ├── cp.js
│ │ ├── echo.js
│ │ ├── export.js
│ │ ├── false.js
│ │ ├── grep.js
│ │ ├── head.js
│ │ ├── kill.js
│ │ ├── ls.js
│ │ ├── mkdir.js
│ │ ├── mv.js
│ │ ├── pwd.js
│ │ ├── rm.js
│ │ ├── sort.js
│ │ ├── source.js
│ │ ├── tail.js
│ │ ├── touch.js
│ │ ├── true.js
│ │ ├── unalias.js
│ │ └── which.js
│ ├── help.js
│ ├── index.js
│ ├── lib/
│ │ └── sugar.js
│ ├── preparser.js
│ ├── util/
│ │ ├── colorFile.js
│ │ ├── columnify.js
│ │ ├── converter.date.js
│ │ ├── converter.path.js
│ │ ├── converter.permissions.js
│ │ ├── expand.js
│ │ ├── fetch.js
│ │ ├── fileFromPath.js
│ │ ├── intercept.js
│ │ ├── interfacer.js
│ │ ├── lpad.js
│ │ ├── pad.js
│ │ ├── stripAnsi.js
│ │ ├── unlinkSync.js
│ │ ├── walkDir.js
│ │ └── walkDirRecursive.js
│ └── windows.js
└── test/
├── alias.js
├── cat.js
├── cd.js
├── clear.js
├── cp.js
├── echo.js
├── export.js
├── head.js
├── help.js
├── index.js
├── kill.js
├── ls.js
├── mkdir.js
├── mv.js
├── preparser.js
├── pwd.js
├── rm.js
├── sort.js
├── source.js
├── tail.js
├── touch.js
├── true.js
├── unalias.js
├── util/
│ ├── playground.js
│ └── util.js
├── vorpal.js
├── which.js
└── windows.js
SYMBOL INDEX (344 symbols across 79 files)
FILE: dist/commands/cp.js
function cpdirSyncRecursive (line 115) | function cpdirSyncRecursive(sourceDir, destDir, options) {
function copyFileSync (line 150) | function copyFileSync(src, dest) {
FILE: dist/commands/kill.js
function log (line 31) | function log(str) {
FILE: dist/commands/ls.js
function pushFile (line 163) | function pushFile(file, data) {
FILE: dist/commands/mkdir.js
function mkdirSyncRecursive (line 56) | function mkdirSyncRecursive(dir, options) {
FILE: dist/commands/rm.js
function rmdirSyncRecursive (line 66) | function rmdirSyncRecursive(dir, force, removeEmptyDir) {
function isWriteable (line 145) | function isWriteable(file) {
FILE: dist/commands/sort.js
function log (line 63) | function log(stdout) {
function parseHumanReadableNumbers (line 200) | function parseHumanReadableNumbers(nbr) {
function parseMonths (line 235) | function parseMonths(str) {
FILE: dist/help.js
function chop (line 7) | function chop(str, len) {
FILE: dist/lib/sugar.js
function aa (line 15) | function aa(a) {
function ma (line 45) | function ma(a) {
function ka (line 49) | function ka(a, b) {
function na (line 54) | function na(a) {
function H (line 66) | function H(a, b, c, d) {
function K (line 72) | function K(a, b, c, d, e) {
function pa (line 76) | function pa(a, b, c, d) {
function qa (line 82) | function qa(a, b, c) {
function oa (line 86) | function oa(a, b, c) {
function L (line 89) | function L(a, b, c) {
function sa (line 93) | function sa(a, b, c) {
function ta (line 95) | function ta(a) {
function M (line 97) | function M(a) {
function N (line 99) | function N(a) {
function J (line 101) | function J(a, b) {
function G (line 103) | function G(a) {
function ua (line 105) | function ua(a) {
function va (line 108) | function va(a, b) {
function I (line 114) | function I(a, b) {
function wa (line 118) | function wa(a, b) {
function xa (line 122) | function xa(a, b) {
function ya (line 126) | function ya(a) {
function O (line 130) | function O(a) {
function Da (line 139) | function Da(a, b, c) {
function Ma (line 148) | function Ma() {
function Na (line 150) | function Na(a, b) {
function Oa (line 155) | function Oa(a, b) {
function T (line 159) | function T(a, b, c, d) {
function Pa (line 161) | function Pa(a) {
function Qa (line 168) | function Qa(a, b) {
function Ra (line 172) | function Ra(a) {
function U (line 174) | function U(a, b) {
function Sa (line 176) | function Sa(a, b, c) {
function Ta (line 179) | function Ta(a, b) {
function Ua (line 194) | function Ua(a, b) {
function Va (line 197) | function Va(a) {
function Wa (line 199) | function Wa(a, b, c) {
function Xa (line 206) | function Xa(a, b, c, d, e) {
function Ya (line 208) | function Ya(a, b) {
function ab (line 225) | function ab(a, b, c, d) {
function bb (line 231) | function bb(a, b, c, d) {
function cb (line 237) | function cb(a) {
function Tb (line 343) | function Tb(a) {
function Xb (line 363) | function Xb(a, b, c) {
function Zb (line 376) | function Zb(a, b) {
function $b (line 379) | function $b(a, b) {
function ac (line 383) | function ac(a, b) {
function Y (line 385) | function Y(a, b) {
function bc (line 388) | function bc(a, b) {
function Wb (line 426) | function Wb(a, b, c, d) {
function Yb (line 428) | function Yb(a) {
function Ub (line 430) | function Ub(a) {
function cc (line 434) | function cc() {
function dc (line 437) | function dc(a, b) {
function ec (line 441) | function ec(a) {
function fc (line 444) | function fc(a, b, c) {
function gc (line 447) | function gc(a, b) {
function hc (line 453) | function hc(a) {
function ic (line 456) | function ic(a) {
function jc (line 466) | function jc(a, b, c, d) {
function lc (line 495) | function lc(a) {
function mc (line 503) | function mc(a) {
function nc (line 505) | function nc(a, b, c) {
function Z (line 509) | function Z(a, b, c, d) {
function oc (line 514) | function oc(a, b, c) {
function pc (line 522) | function pc(a) {
function qc (line 529) | function qc(a, b, c, d) {
function rc (line 534) | function rc(a, b, c, d, e) {
function sc (line 546) | function sc(a, b, c) {
function kc (line 549) | function kc(a, b, c, d, e) {
function Vb (line 566) | function Vb(a, b) {
function tc (line 574) | function tc(a, b, c) {
function uc (line 652) | function uc(a, b) {
function d (line 668) | function d(a) {
function a (line 714) | function a(a, c) {
function a (line 720) | function a(a, c) {
FILE: dist/util/converter.date.js
function pad (line 9) | function pad(num, padding) {
FILE: dist/util/intercept.js
function interceptor (line 32) | function interceptor(string) {
FILE: dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: dist/util/walkDir.js
function readFile (line 23) | function readFile(path, cbk, ecbk) {
FILE: dist/windows.js
function print (line 84) | function print() {
FILE: gulpfile.js
function getJSON (line 33) | function getJSON(name) {
function writeJSON (line 46) | function writeJSON(name, json) {
FILE: packages/cat/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/cp/dist/commands/cp.js
function cpdirSyncRecursive (line 115) | function cpdirSyncRecursive(sourceDir, destDir, options) {
function copyFileSync (line 150) | function copyFileSync(src, dest) {
FILE: packages/cp/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/false/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/head/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/kill/dist/commands/kill.js
function log (line 31) | function log(str) {
FILE: packages/kill/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/ls/dist/commands/ls.js
function pushFile (line 163) | function pushFile(file, data) {
FILE: packages/ls/dist/util/converter.date.js
function pad (line 9) | function pad(num, padding) {
FILE: packages/ls/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/ls/dist/util/walkDir.js
function readFile (line 23) | function readFile(path, cbk, ecbk) {
FILE: packages/mkdir/dist/commands/mkdir.js
function mkdirSyncRecursive (line 56) | function mkdirSyncRecursive(dir, options) {
FILE: packages/mkdir/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/mv/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/pwd/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/rm/dist/commands/rm.js
function rmdirSyncRecursive (line 66) | function rmdirSyncRecursive(dir, force, removeEmptyDir) {
function isWriteable (line 145) | function isWriteable(file) {
FILE: packages/rm/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/sort/dist/commands/sort.js
function log (line 63) | function log(stdout) {
function parseHumanReadableNumbers (line 200) | function parseHumanReadableNumbers(nbr) {
function parseMonths (line 235) | function parseMonths(str) {
FILE: packages/sort/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/tail/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/touch/dist/lib/sugar.js
function aa (line 15) | function aa(a) {
function ma (line 45) | function ma(a) {
function ka (line 49) | function ka(a, b) {
function na (line 54) | function na(a) {
function H (line 66) | function H(a, b, c, d) {
function K (line 72) | function K(a, b, c, d, e) {
function pa (line 76) | function pa(a, b, c, d) {
function qa (line 82) | function qa(a, b, c) {
function oa (line 86) | function oa(a, b, c) {
function L (line 89) | function L(a, b, c) {
function sa (line 93) | function sa(a, b, c) {
function ta (line 95) | function ta(a) {
function M (line 97) | function M(a) {
function N (line 99) | function N(a) {
function J (line 101) | function J(a, b) {
function G (line 103) | function G(a) {
function ua (line 105) | function ua(a) {
function va (line 108) | function va(a, b) {
function I (line 114) | function I(a, b) {
function wa (line 118) | function wa(a, b) {
function xa (line 122) | function xa(a, b) {
function ya (line 126) | function ya(a) {
function O (line 130) | function O(a) {
function Da (line 139) | function Da(a, b, c) {
function Ma (line 148) | function Ma() {
function Na (line 150) | function Na(a, b) {
function Oa (line 155) | function Oa(a, b) {
function T (line 159) | function T(a, b, c, d) {
function Pa (line 161) | function Pa(a) {
function Qa (line 168) | function Qa(a, b) {
function Ra (line 172) | function Ra(a) {
function U (line 174) | function U(a, b) {
function Sa (line 176) | function Sa(a, b, c) {
function Ta (line 179) | function Ta(a, b) {
function Ua (line 194) | function Ua(a, b) {
function Va (line 197) | function Va(a) {
function Wa (line 199) | function Wa(a, b, c) {
function Xa (line 206) | function Xa(a, b, c, d, e) {
function Ya (line 208) | function Ya(a, b) {
function ab (line 225) | function ab(a, b, c, d) {
function bb (line 231) | function bb(a, b, c, d) {
function cb (line 237) | function cb(a) {
function Tb (line 343) | function Tb(a) {
function Xb (line 363) | function Xb(a, b, c) {
function Zb (line 376) | function Zb(a, b) {
function $b (line 379) | function $b(a, b) {
function ac (line 383) | function ac(a, b) {
function Y (line 385) | function Y(a, b) {
function bc (line 388) | function bc(a, b) {
function Wb (line 426) | function Wb(a, b, c, d) {
function Yb (line 428) | function Yb(a) {
function Ub (line 430) | function Ub(a) {
function cc (line 434) | function cc() {
function dc (line 437) | function dc(a, b) {
function ec (line 441) | function ec(a) {
function fc (line 444) | function fc(a, b, c) {
function gc (line 447) | function gc(a, b) {
function hc (line 453) | function hc(a) {
function ic (line 456) | function ic(a) {
function jc (line 466) | function jc(a, b, c, d) {
function lc (line 495) | function lc(a) {
function mc (line 503) | function mc(a) {
function nc (line 505) | function nc(a, b, c) {
function Z (line 509) | function Z(a, b, c, d) {
function oc (line 514) | function oc(a, b, c) {
function pc (line 522) | function pc(a) {
function qc (line 529) | function qc(a, b, c, d) {
function rc (line 534) | function rc(a, b, c, d, e) {
function sc (line 546) | function sc(a, b, c) {
function kc (line 549) | function kc(a, b, c, d, e) {
function Vb (line 566) | function Vb(a, b) {
function tc (line 574) | function tc(a, b, c) {
function uc (line 652) | function uc(a, b) {
function d (line 668) | function d(a) {
function a (line 714) | function a(a, c) {
function a (line 720) | function a(a, c) {
FILE: packages/touch/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/true/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: packages/which/dist/util/interfacer.js
function onResult (line 35) | function onResult(result) {
FILE: src/commands/alias.js
method exec (line 8) | exec(args, options) {
FILE: src/commands/boilerplate.js
method exec (line 23) | exec(args, options) {
FILE: src/commands/cat.js
method exec (line 13) | exec(args, options) {
FILE: src/commands/cd.js
method exec (line 11) | exec(dir, options) {
method error (line 32) | error(e, dir) {
FILE: src/commands/clear.js
method exec (line 6) | exec() {
FILE: src/commands/cp.js
method exec (line 14) | exec(args, options) {
function cpdirSyncRecursive (line 114) | function cpdirSyncRecursive(sourceDir, destDir, options) {
function copyFileSync (line 149) | function copyFileSync(src, dest) {
FILE: src/commands/echo.js
method exec (line 8) | exec(arg, options) {
method error (line 57) | error(e) {
FILE: src/commands/export.js
method exec (line 8) | exec(args, options) {
FILE: src/commands/false.js
method exec (line 6) | exec() {
FILE: src/commands/head.js
method exec (line 11) | exec(args, options) {
method readLines (line 62) | readLines(content, numberOfLines) {
FILE: src/commands/kill.js
method exec (line 22) | exec(args, options) {
FILE: src/commands/ls.js
method exec (line 37) | exec(paths, options) {
method preSortPaths (line 72) | preSortPaths(paths) {
method error (line 110) | error(path, e) {
method execDirRecursive (line 136) | execDirRecursive(path, options) {
method execDir (line 156) | execDir(path, options) {
method execLsOnFiles (line 179) | execLsOnFiles(path, rawFiles, options) {
method formatDetails (line 299) | formatDetails(files, totalSize, options) {
method formatAll (line 359) | formatAll(results, options, showName) {
FILE: src/commands/mkdir.js
method exec (line 12) | exec(args, options) {
function mkdirSyncRecursive (line 55) | function mkdirSyncRecursive(dir, options) {
FILE: src/commands/mv.js
method exec (line 13) | exec(args, options) {
FILE: src/commands/pwd.js
method exec (line 8) | exec() {
FILE: src/commands/rm.js
method exec (line 13) | exec(args, options) {
function rmdirSyncRecursive (line 69) | function rmdirSyncRecursive(dir, force, removeEmptyDir) {
function isWriteable (line 147) | function isWriteable(file) {
FILE: src/commands/sort.js
method exec (line 18) | exec(args, options) {
function parseHumanReadableNumbers (line 200) | function parseHumanReadableNumbers(nbr) {
function parseMonths (line 235) | function parseMonths(str) {
FILE: src/commands/source.js
method exec (line 11) | exec(args, options) {
FILE: src/commands/tail.js
method exec (line 12) | exec(args, options) {
FILE: src/commands/touch.js
method exec (line 20) | exec(files, options) {
method error (line 85) | error(e) {
method file (line 98) | file(path, options) {
FILE: src/commands/true.js
method exec (line 6) | exec() {
FILE: src/commands/unalias.js
method exec (line 8) | exec(args, options) {
FILE: src/commands/which.js
method exec (line 7) | exec(args, options) {
FILE: src/delimiter.js
method refresh (line 12) | refresh(vorpal, cb) {
method getHomeDir (line 31) | getHomeDir() {
FILE: src/help.js
function chop (line 32) | function chop(str, len) {
FILE: src/index.js
method export (line 28) | export(str, cbk) {
method load (line 66) | load() {
method show (line 239) | show() {
FILE: src/lib/sugar.js
function aa (line 10) | function aa(a){return function(){return a}}
function ma (line 14) | function ma(a){var b="Array"===a&&p.isArray||function(b,d){return(d||v.c...
function ka (line 14) | function ka(a,b){function c(c){return G(c)?v.call(c)==="[object "+b+"]":...
function na (line 15) | function na(a){a.SugarMethods||(oa(a,"SugarMethods",{}),H(a,!1,!0,{exten...
function H (line 15) | function H(a,b,c,d){var e=b?a.prototype:a;na(a);I(d,function(d,f){var h=...
function K (line 16) | function K(a,b,c,d,e){var g={};d=z(d)?d.split(","):d;d.forEach(function(...
function pa (line 16) | function pa(a,b,c,d){var e=0===c.length,g=L(c),f=!1;I(b.SugarMethods,fun...
function qa (line 16) | function qa(a,b,c){return function(d){return c.apply(this,arguments)?b.a...
function oa (line 16) | function oa(a,b,c){ea?m.defineProperty(a,b,{value:c,configurable:!0,enum...
function L (line 17) | function L(a,b,c){var d=[];c=c||0;var e;for(e=a.length;c<e;c++)d.push(a[...
function sa (line 17) | function sa(a,b,c){var d=a[c||0];A(d)&&(a=d,c=0);L(a,b,c)}
function ta (line 17) | function ta(a){if(!a||!a.call)throw new TypeError("Callback is not calla...
function M (line 17) | function M(a){return void 0!==a}
function N (line 17) | function N(a){return void 0===a}
function J (line 17) | function J(a,b){return!!a&&da.call(a,b)}
function G (line 17) | function G(a){return!!a&&("object"===typeof a||fa&&D(a))}
function ua (line 17) | function ua(a){var b=typeof a;return null==a||"string"===b||"number"===b...
function va (line 18) | function va(a,b){b=b||v.call(a);try{if(a&&a.constructor&&!J(a,"construct...
function I (line 18) | function I(a,b){for(var c in a)if(J(a,c)&&!1===b.call(a,c,a[c],a))break}
function wa (line 18) | function wa(a,b){for(var c=0;c<a;c++)b(c)}
function xa (line 18) | function xa(a,b){I(b,function(c){a[c]=b[c]});return a}
function ya (line 18) | function ya(a){ua(a)&&(a=m(a));if(ga&&z(a))for(var b=a,c=0,d;d=b.charAt(...
function O (line 18) | function O(a){xa(this,ya(a))}
function Da (line 19) | function Da(a,b,c){var d=za(10,P(b||0));c=c||R;0>b&&(d=1/d);return c(a*d...
function Ma (line 19) | function Ma(){return"\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u...
function Na (line 19) | function Na(a,b){var c="";for(a=a.toString();0<b;)if(b&1&&(c+=a),b>>=1)a...
function Oa (line 20) | function Oa(a,b){var c,d;c=a.replace(La,function(a){a=Ka[a];a===Ia&&(d=!...
function T (line 20) | function T(a,b,c,d){d=P(a).toString(d||10);d=Na("0",b-d.replace(/\.\d+/,...
function Pa (line 20) | function Pa(a){if(11<=a&&13>=a)return"th";switch(a%10){case 1:return"st"...
function Qa (line 21) | function Qa(a,b){function c(a,c){if(a||-1<b.indexOf(c))d+=c}var d="";b=b...
function Ra (line 21) | function Ra(a){z(a)||(a=s(a));return a.replace(/([\\/\'*+?|()\[\]{}.^$])...
function U (line 21) | function U(a,b){return a["get"+(a._utc?"UTC":"")+b]()}
function Sa (line 21) | function Sa(a,b,c){return a["set"+(a._utc&&"ISOWeek"!=b?"UTC":"")+b](c)}
function Ta (line 22) | function Ta(a,b){var c=typeof a,d,e,g,f,h,l,n;if("string"===c)return a;g...
function Ua (line 22) | function Ua(a,b){return a===b?0!==a||1/a===1/b:Va(a)&&Va(b)?Ta(a)===Ta(b...
function Va (line 23) | function Va(a){var b=v.call(a);return ja.test(b)||va(a,b)}
function Wa (line 23) | function Wa(a,b,c){var d,e=a.length,g=b.length,f=!1!==b[g-1];if(!(g>(f?1...
function Xa (line 23) | function Xa(a,b,c,d,e){d&&(c%=b,0>c&&(c=b+c));return e?a.charAt(c):a[c]}
function Ya (line 23) | function Ya(a,b){K(b,!0,!1,a,function(a,b){a[b+("equal"===b?"s":"")]=fun...
function ab (line 26) | function ab(a,b,c,d){var e=a.length,g=-1==d,f=g?e-1:0;c=isNaN(c)?f:parse...
function bb (line 26) | function bb(a,b,c,d){var e=a.length,g=0,f=M(c);ta(b);if(0!=e||f)f||(c=a[...
function cb (line 26) | function cb(a){if(0===a.length)throw new TypeError("First argument must ...
function Tb (line 35) | function Tb(a){xa(this,a);this.g=Pb.concat()}
function Xb (line 38) | function Xb(a,b,c){var d,e,g=b[0],f=b[1],h=b[2];b=a[c]||a.relative;if(F(...
function Zb (line 38) | function Zb(a,b){b=b||a.code;return"en"===b||"en-US"===b?!0:a.variant}
function $b (line 39) | function $b(a,b){return b.replace(q(a.num,"g"),function(b){return ac(a,b...
function ac (line 39) | function ac(a,b){var c;return y(b)?b:b&&-1!==(c=a.numbers.indexOf(b))?(c...
function Y (line 39) | function Y(a,b){var c;z(a)||(a="");c=Sb[a]||Sb[a.slice(0,2)];if(!1===b&&...
function bc (line 40) | function bc(a,b){function c(a){var b=h[a];z(b)?h[a]=b.split(","):b||(h[a...
function Wb (line 43) | function Wb(a,b,c,d){a.g.unshift({r:d,locale:a,q:q("^"+b+"$","i"),to:c})}
function Yb (line 43) | function Yb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}
function Ub (line 43) | function Ub(a){return a.filter(function(a){return!!a}).join("|")}
function cc (line 43) | function cc(){var a=r.SugarNewDate;return a?a():new r}
function dc (line 44) | function dc(a,b){var c;if(G(a[0]))return a;if(y(a[0])&&!y(a[1]))return[a...
function ec (line 44) | function ec(a){var b,c={};if(a=a.match(/^(\d+)?\s?(\w+?)s?$/i))N(b)&&(b=...
function fc (line 44) | function fc(a,b,c){var d;N(c)&&(c=Ob.length);for(b=b||0;b<c&&(d=Ob[b],!1...
function gc (line 45) | function gc(a,b){var c={},d,e;b.forEach(function(b,f){d=a[f+1];N(d)||""=...
function hc (line 45) | function hc(a){a=a.trim().replace(/^just (?=now)|\.+$/i,"");return ic(a)}
function ic (line 46) | function ic(a){return a.replace(Mb,function(a,c,d){var e=0,g=1,f,h;if(c)...
function jc (line 47) | function jc(a,b,c,d){function e(a){vb.push(a)}function g(){vb.forEach(fu...
function lc (line 51) | function lc(a){var b,c=P(a),d=c,e=0;fc(function(a,f,h){b=Q(Da(c/f.b(),1)...
function mc (line 52) | function mc(a){var b=lc(a.millisecondsFromNow());if(6===b[1]||5===b[1]&&...
function nc (line 52) | function nc(a,b,c){function d(a,c){var d=U(a,"Month");return Y(c).months...
function Z (line 52) | function Z(a,b,c,d){X[a]=function(a,g){var f=b(a,g);c&&(f=f.slice(0,c));...
function oc (line 53) | function oc(a,b,c){X[a]=b;X[a+a]=function(a,c){return T(b(a,c),2)};c&&(X...
function pc (line 53) | function pc(a){var b=a.match(/(\{\w+\})|[^{}]+/g);Qb[a]=b.map(function(a...
function qc (line 54) | function qc(a,b,c,d){var e;if(!a.isValid())return"Invalid Date";Date[b]?...
function rc (line 55) | function rc(a,b,c,d,e){var g,f,h,l=0,n=0,x=0;g=jc(b,c,null,e);0<d&&(n=x=...
function sc (line 56) | function sc(a,b,c){b=new r(b);a=(new r(c)).utc(a.isUTC());23!==U(a,"Hour...
function kc (line 57) | function kc(a,b,c,d,e){function g(a){return M(b[a])?b[a]:b[a+"s"]}functi...
function Vb (line 59) | function Vb(a,b){var c=Kb,d={h:0,m:1,s:2},e;a=a||W;return c.replace(/{([...
function tc (line 59) | function tc(a,b,c){var d,e;y(a[1])?d=dc(a)[0]:(d=a[0],e=a[1]);return jc(...
function uc (line 66) | function uc(a,b){function c(){return R(this*b)}function d(){return tc(ar...
function d (line 70) | function d(a){a/=f;var c=a%1,d=b.error||0.999;c&&P(c%1)>d&&(a=R(a));retu...
function a (line 73) | function a(a,c){var d=U(a,"Hours");return Y(c).ampm[Q(d/12)]||""}
function a (line 75) | function a(a,c){var d=U(a,"Day");return Y(c).weekdays[d]}
FILE: src/util/converter.date.js
function pad (line 9) | function pad(num, padding) {
method unix (line 20) | unix(dt) {
FILE: src/util/converter.path.js
method unix (line 11) | unix(str) {
FILE: src/util/converter.permissions.js
method modeToRWX (line 20) | modeToRWX(mode) {
method modeToOctal (line 26) | modeToOctal(mode) {
method octalToRWX (line 31) | octalToRWX(octal) {
FILE: src/util/intercept.js
function interceptor (line 32) | function interceptor(string) {
FILE: src/util/interfacer.js
method exec (line 21) | exec() {}
method log (line 24) | log(out) {
function onResult (line 33) | function onResult(result) {
FILE: src/util/walkDir.js
function readFile (line 23) | function readFile(path, cbk, ecbk) {
FILE: src/windows.js
method registerCommands (line 10) | registerCommands(self) {
FILE: test/alias.js
function clear (line 9) | function clear() {
FILE: test/cp.js
function burninate (line 8) | function burninate() {
function reset (line 19) | function reset() {
FILE: test/ls.js
function ls (line 23) | function ls(path, opts) {
FILE: test/mv.js
function burninate (line 8) | function burninate() {
function reset (line 17) | function reset() {
FILE: test/sort.js
function sort (line 8) | function sort(dir, opts) {
FILE: test/unalias.js
function clear (line 9) | function clear() {
FILE: test/util/util.js
method writeSampleDir (line 8) | writeSampleDir(cb) {
method deleteSampleDir (line 47) | deleteSampleDir() {
function double (line 52) | function double(str) {
Condensed preview — 353 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (642K chars).
[
{
"path": ".babelrc",
"chars": 27,
"preview": "{\n \"presets\": [\"es2015\"]\n}"
},
{
"path": ".eslintignore",
"chars": 16,
"preview": "src/lib/sugar.js"
},
{
"path": ".gitignore",
"chars": 614,
"preview": "*.log\r\n\r\n# Runtime data\r\npids\r\n*.pid\r\n*.seed\r\n\r\n*sublime*\r\n\r\n# Directory for instrumented libs generated by jscoverage/J"
},
{
"path": ".istanbul.yml",
"chars": 1406,
"preview": "verbose: false\r\ninstrumentation:\r\n root: .\r\n extensions:\r\n - .js\r\n default-excludes: true\r\n excludes:"
},
{
"path": ".travis.yml",
"chars": 208,
"preview": "sudo: false\r\nlanguage: node_js\r\nnode_js:\r\n - \"7\"\r\n - \"6\"\r\n - \"5\"\r\n - \"4\"\r\n - \"8\"\r\nafter_success: \"cat ./coverage/lc"
},
{
"path": "LICENSE",
"chars": 1109,
"preview": "(The MIT License)\r\n\r\nCopyright (c) 2015 DC <threedeecee@gmail.com>\r\n\r\nPermission is hereby granted, free of charge, to a"
},
{
"path": "README.md",
"chars": 7092,
"preview": "<h1 align=\"center\">\n\t<img width=\"284\" src=\"http://i.imgur.com/tKrIdAI.jpg\" alt=\"Cash\">\n\t<!--<img width=\"256\" src=\"http:/"
},
{
"path": "appveyor.yml",
"chars": 610,
"preview": "environment:\n matrix:\n - nodejs_version: '7'\n - nodejs_version: '6'\n - nodejs_version: '5'\n - nodejs_versio"
},
{
"path": "bin/alias.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'alias');\n"
},
{
"path": "bin/cash.js",
"chars": 182,
"preview": "#!/usr/bin/env node\n'use strict';\nvar cash = require('../dist/index');\nvar delimiter = require('./../dist/delimiter')\nde"
},
{
"path": "bin/cat.js",
"chars": 62,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'cat');\n"
},
{
"path": "bin/cd.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'cd');\n"
},
{
"path": "bin/clear.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'clear');\n"
},
{
"path": "bin/cp.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'cp');\n"
},
{
"path": "bin/echo.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'echo');\n"
},
{
"path": "bin/export.js",
"chars": 65,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'export');\n"
},
{
"path": "bin/false.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'false');\n"
},
{
"path": "bin/grep.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'grep');\n"
},
{
"path": "bin/head.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'head');\n"
},
{
"path": "bin/kill.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'kill');\n"
},
{
"path": "bin/less.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'less');\n"
},
{
"path": "bin/ls.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'ls');\n"
},
{
"path": "bin/mkdir.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'mkdir');\n"
},
{
"path": "bin/mv.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'mv');\n"
},
{
"path": "bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "bin/pwd.js",
"chars": 62,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'pwd');\n"
},
{
"path": "bin/rm.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'rm');\n"
},
{
"path": "bin/sort.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'sort');\n"
},
{
"path": "bin/source.js",
"chars": 65,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'source');\n"
},
{
"path": "bin/tail.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'tail');\n"
},
{
"path": "bin/touch.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'touch');\n"
},
{
"path": "bin/true.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'true');\n"
},
{
"path": "bin/unalias.js",
"chars": 66,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'unalias');\n"
},
{
"path": "bin/which.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'which');\n"
},
{
"path": "commands.json",
"chars": 4327,
"preview": "{\n \"commands\": [\n \"alias\",\n \"cat\",\n \"cd\",\n \"clear\",\n \"cp\",\n \"echo\",\n \"head\",\n \"export\",\n \"fa"
},
{
"path": "dist/commands/alias.js",
"chars": 2947,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\n\nvar alias ="
},
{
"path": "dist/commands/boilerplate.js",
"chars": 2697,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\n\n/**\n * This"
},
{
"path": "dist/commands/cat.js",
"chars": 3761,
"preview": "'use strict';\n\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\n\nvar fetch = require('./../util/fetch');\nvar inte"
},
{
"path": "dist/commands/cd.js",
"chars": 1481,
"preview": "'use strict';\n\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\nvar delimiter = require('./../delimiter');\n\nvar i"
},
{
"path": "dist/commands/clear.js",
"chars": 528,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\n\nvar clear = {\n exec: function exec() {\n this.log('"
},
{
"path": "dist/commands/cp.js",
"chars": 6006,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\nvar path = require('path'"
},
{
"path": "dist/commands/echo.js",
"chars": 2082,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\n\nvar echo = "
},
{
"path": "dist/commands/export.js",
"chars": 1948,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\n\nvar _export"
},
{
"path": "dist/commands/false.js",
"chars": 431,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\n\nvar _false = {\n exec: function exec() {\n // Always"
},
{
"path": "dist/commands/grep.js",
"chars": 55,
"preview": "'use strict';\n\nmodule.exports = require('vorpal-grep');"
},
{
"path": "dist/commands/head.js",
"chars": 3165,
"preview": "'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { retu"
},
{
"path": "dist/commands/kill.js",
"chars": 2640,
"preview": "'use strict';\n\nvar fkill = require('fkill');\nvar os = require('os');\n\nvar interfacer = require('./../util/interfacer');\n"
},
{
"path": "dist/commands/less.js",
"chars": 55,
"preview": "'use strict';\n\nmodule.exports = require('vorpal-less');"
},
{
"path": "dist/commands/ls.js",
"chars": 12511,
"preview": "'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { retu"
},
{
"path": "dist/commands/mkdir.js",
"chars": 2461,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\nvar fsAutocomplete = require('vorpal-autocomplete-fs'"
},
{
"path": "dist/commands/mv.js",
"chars": 3181,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\nvar path = require('path'"
},
{
"path": "dist/commands/pwd.js",
"chars": 587,
"preview": "'use strict';\n\nvar path = require('path');\n\nvar interfacer = require('./../util/interfacer');\n\nvar pwd = {\n exec: funct"
},
{
"path": "dist/commands/rm.js",
"chars": 5197,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\n\nvar expand = require('./"
},
{
"path": "dist/commands/sort.js",
"chars": 7791,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\n\nvar fetch = require('./."
},
{
"path": "dist/commands/source.js",
"chars": 2078,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\nvar fs = req"
},
{
"path": "dist/commands/tail.js",
"chars": 2381,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\n\nvar interfacer = require"
},
{
"path": "dist/commands/touch.js",
"chars": 4590,
"preview": "'use strict';\n\nvar fs = require('fs-extra');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\n\nvar interfacer = r"
},
{
"path": "dist/commands/true.js",
"chars": 425,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\n\nvar _true = {\n exec: function exec() {\n // Always "
},
{
"path": "dist/commands/unalias.js",
"chars": 2574,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\n\nvar unalias"
},
{
"path": "dist/commands/which.js",
"chars": 812,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\nvar preparser = require('./../preparser');\n\nvar which ="
},
{
"path": "dist/delimiter.js",
"chars": 990,
"preview": "'use strict';\n\nvar os = require('os');\nvar username = require('username');\nvar userHome = require('user-home');\n\nvar isW"
},
{
"path": "dist/help/alias.js",
"chars": 613,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: alias [OPTION] [name[=value] ...]\\nDefine or display aliases.\\n\\nWithout argum"
},
{
"path": "dist/help/cat.js",
"chars": 998,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: cat [OPTION]... [FILE]...\\nConcatenate FILE(s), or standard input, to standard"
},
{
"path": "dist/help/cd.js",
"chars": 285,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: cd [DIR]...\\nChange the cash working directory.\\n\\nChange the current director"
},
{
"path": "dist/help/clear.js",
"chars": 290,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: clear\\nClear the terminal screen\\n\\n --help display this help and "
},
{
"path": "dist/help/cp.js",
"chars": 708,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: cp [OPTION]... [-T] SOURCE DEST\\n or: cp [OPTION]... SOURCE... DIRECTORY\\nCo"
},
{
"path": "dist/help/echo.js",
"chars": 755,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: echo [OPTION]... [ARG ...]\\nWrite arguments to the standard output.\\n\\nDisplay"
},
{
"path": "dist/help/export.js",
"chars": 854,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: export [OPTION] [name[=value]]\\nExport variables into the environment\\n\\nWitho"
},
{
"path": "dist/help/false.js",
"chars": 283,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: false [OPTION]\\nDo nothing, unsuccessfully\\n\\nThis command simply exits with s"
},
{
"path": "dist/help/grep.js",
"chars": 1370,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: grep [OPTION]... PATTERN [FILE]...\\nSearch for PATTERN in each FILE or standar"
},
{
"path": "dist/help/head.js",
"chars": 700,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: head [OPTION]... [FILE]...\\nPrint the first 10 lines of each FILE to standard "
},
{
"path": "dist/help/kill.js",
"chars": 765,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: kill [OPTION] pid | jobspec ... or kill -l [sigspec]\\nSend a signal to a job.\\"
},
{
"path": "dist/help/ls.js",
"chars": 1729,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: ls [OPTION]... [FILE]...\\nList information about the FILEs (the current direct"
},
{
"path": "dist/help/mkdir.js",
"chars": 421,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: mkdir [OPTION]... DIRECTORY...\\nCreate the DIRECTORY(ies), if they do not alre"
},
{
"path": "dist/help/mv.js",
"chars": 737,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: mv [OPTION]... [-T] SOURCE DEST\\n or: mv [OPTION]... SOURCE... DIRECTORY\\n "
},
{
"path": "dist/help/pwd.js",
"chars": 364,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: pwd [-LP]\\nPrint the name of the current working directory.\\n\\n --help "
},
{
"path": "dist/help/rm.js",
"chars": 820,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: rm [OPTION]... FILE...\\nRemove (unlink) the FILE(s).\\n\\n -f, --force "
},
{
"path": "dist/help/sort.js",
"chars": 892,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: sort [OPTION]... [FILE]...\\nWrite sorted concatenation of all FILE(s) to stand"
},
{
"path": "dist/help/source.js",
"chars": 557,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: source FILENAME [ARGUMENTS...]\\n or: . FILENAME [ARGUMENTS...]\\nRead and exe"
},
{
"path": "dist/help/tail.js",
"chars": 680,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: tail [OPTION]... [FILE]...\\nDisplay the last part of a file.\\n\\nPrint the last"
},
{
"path": "dist/help/touch.js",
"chars": 897,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: touch [OPTION]... FILE...\\nUpdate the access and modification times of each FI"
},
{
"path": "dist/help/true.js",
"chars": 279,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: true [OPTION]\\nDo nothing, successfully\\n\\nThis command simply exits with stat"
},
{
"path": "dist/help/unalias.js",
"chars": 384,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: unalias [OPTION] name ...\\nRemove each name from the list of defined aliases.\\"
},
{
"path": "dist/help/which.js",
"chars": 244,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: which COMMAND\\nLook for COMMAND in $PATH.\\n\\n --help di"
},
{
"path": "dist/help.js",
"chars": 1847,
"preview": "'use strict';\n\nvar pad = require('./util/pad');\n\nvar commands = ['alias [-p] [name=[value]]', 'cat [-AbeEnstTv] [files ."
},
{
"path": "dist/index.js",
"chars": 7046,
"preview": "'use strict';\n\nvar os = require('os');\nvar Vorpal = require('vorpal');\n\nvar commands = require('./../commands.json');\nva"
},
{
"path": "dist/lib/sugar.js",
"chars": 36546,
"preview": "\"use strict\";\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { retu"
},
{
"path": "dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "dist/util/colorFile.js",
"chars": 1462,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\nvar chalk = {};\nvar map = { cyan: 36, red: 31, magenta: 35 };\nObject"
},
{
"path": "dist/util/columnify.js",
"chars": 1415,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\nvar pad = require('./pad');\n\n/**\n * Formats an array to display in a "
},
{
"path": "dist/util/converter.date.js",
"chars": 678,
"preview": "'use strict';\n\n/**\n * Date conversion utilities\n */\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug"
},
{
"path": "dist/util/converter.path.js",
"chars": 422,
"preview": "'use strict';\n\nvar path = require('path');\n\n/**\n * Path conversion utilities\n */\n\nmodule.exports = {\n unix: function un"
},
{
"path": "dist/util/converter.permissions.js",
"chars": 740,
"preview": "'use strict';\n\n/**\n * Permission conversion utilities\n */\n\nmodule.exports = {\n\n listing: {\n 0: '---',\n 1: '--x',\n"
},
{
"path": "dist/util/expand.js",
"chars": 592,
"preview": "'use strict';\n\nvar glob = require('glob');\n\n/**\n * Expands wildcard files, etc. out\n * into their full paths.\n *\n * @par"
},
{
"path": "dist/util/fetch.js",
"chars": 1058,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\n\nvar expand = require('./expand');\n\n/**\n * Reads the "
},
{
"path": "dist/util/fileFromPath.js",
"chars": 357,
"preview": "'use strict';\n\n/**\n * Parses a path and returns just the file\n *\n * @param {path} str\n * @return {String}\n * @api public"
},
{
"path": "dist/util/intercept.js",
"chars": 1296,
"preview": "'use strict';\n\n/**\n * Intercepts stdout, passes thru callback\n * also pass console.error thru stdout so it goes to callb"
},
{
"path": "dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "dist/util/lpad.js",
"chars": 417,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\n/**\n * Pads to the left hand.\n *\n * @param {String} str\n * @param {I"
},
{
"path": "dist/util/pad.js",
"chars": 478,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\n/**\n * Pads a value with with space or\n * a specified delimiter to m"
},
{
"path": "dist/util/stripAnsi.js",
"chars": 319,
"preview": "'use strict';\n\n/**\n * Removes all ansi characters.\n *\n * @param {String} str\n * @return {String}\n * @api public\n */\n\nmod"
},
{
"path": "dist/util/unlinkSync.js",
"chars": 586,
"preview": "'use strict';\n\nvar fs = require('fs');\n\n/**\n * Normalizes _unlinkSync() across\n * platforms to match Unix behavior, i.e."
},
{
"path": "dist/util/walkDir.js",
"chars": 1083,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\n\n/**\n * Walks a single directory calling\n * a callbac"
},
{
"path": "dist/util/walkDirRecursive.js",
"chars": 572,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\n\n/**\n * Recursively walks through and executes\n * a c"
},
{
"path": "dist/windows.js",
"chars": 3881,
"preview": "'use strict';\n\nvar os = require('os');\nvar windows = os.platform() === 'win32';\n\nvar exclusions = require('./../commands"
},
{
"path": "gulpfile.js",
"chars": 4631,
"preview": "'use strict';\n\nconst $ = require('shelljs');\nconst babel = require('gulp-babel');\nconst changed = require('gulp-changed'"
},
{
"path": "package.json",
"chars": 2353,
"preview": "{\n \"name\": \"cash\",\n \"version\": \"0.8.0\",\n \"description\": \"Cross-platform Linux commands in pure ES6.\",\n \"main\": \"./di"
},
{
"path": "packages/cat/README.md",
"chars": 1496,
"preview": "# cash-cat\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `cat` command.\n\n```bash\nnpm install cash"
},
{
"path": "packages/cat/bin/cat.js",
"chars": 62,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'cat');\n"
},
{
"path": "packages/cat/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/cat/dist/commands/cat.js",
"chars": 3761,
"preview": "'use strict';\n\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\n\nvar fetch = require('./../util/fetch');\nvar inte"
},
{
"path": "packages/cat/dist/help/cat.js",
"chars": 998,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: cat [OPTION]... [FILE]...\\nConcatenate FILE(s), or standard input, to standard"
},
{
"path": "packages/cat/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/cat/dist/util/expand.js",
"chars": 592,
"preview": "'use strict';\n\nvar glob = require('glob');\n\n/**\n * Expands wildcard files, etc. out\n * into their full paths.\n *\n * @par"
},
{
"path": "packages/cat/dist/util/fetch.js",
"chars": 1058,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\n\nvar expand = require('./expand');\n\n/**\n * Reads the "
},
{
"path": "packages/cat/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/cat/dist/util/lpad.js",
"chars": 417,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\n/**\n * Pads to the left hand.\n *\n * @param {String} str\n * @param {I"
},
{
"path": "packages/cat/dist/util/stripAnsi.js",
"chars": 319,
"preview": "'use strict';\n\n/**\n * Removes all ansi characters.\n *\n * @param {String} str\n * @return {String}\n * @api public\n */\n\nmod"
},
{
"path": "packages/cat/package.json",
"chars": 954,
"preview": "{\n \"name\": \"cash-cat\",\n \"version\": \"0.2.0\",\n \"description\": \"Cross-platform implementation of the Unix 'cat' command."
},
{
"path": "packages/cp/README.md",
"chars": 1491,
"preview": "# cash-cp\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `cp` command.\n\n```bash\nnpm install cash-c"
},
{
"path": "packages/cp/bin/cp.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'cp');\n"
},
{
"path": "packages/cp/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/cp/dist/commands/cp.js",
"chars": 6006,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\nvar path = require('path'"
},
{
"path": "packages/cp/dist/help/cp.js",
"chars": 708,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: cp [OPTION]... [-T] SOURCE DEST\\n or: cp [OPTION]... SOURCE... DIRECTORY\\nCo"
},
{
"path": "packages/cp/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/cp/dist/util/expand.js",
"chars": 592,
"preview": "'use strict';\n\nvar glob = require('glob');\n\n/**\n * Expands wildcard files, etc. out\n * into their full paths.\n *\n * @par"
},
{
"path": "packages/cp/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/cp/package.json",
"chars": 949,
"preview": "{\n \"name\": \"cash-cp\",\n \"version\": \"0.2.0\",\n \"description\": \"Cross-platform implementation of the Unix 'cp' command.\","
},
{
"path": "packages/false/README.md",
"chars": 1506,
"preview": "# cash-false\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `false` command.\n\n```bash\nnpm install "
},
{
"path": "packages/false/bin/false.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'false');\n"
},
{
"path": "packages/false/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/false/dist/commands/false.js",
"chars": 431,
"preview": "'use strict';\n\nvar interfacer = require('./../util/interfacer');\n\nvar _false = {\n exec: function exec() {\n // Always"
},
{
"path": "packages/false/dist/help/false.js",
"chars": 283,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: false [OPTION]\\nDo nothing, unsuccessfully\\n\\nThis command simply exits with s"
},
{
"path": "packages/false/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/false/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/false/package.json",
"chars": 873,
"preview": "{\n \"name\": \"cash-false\",\n \"version\": \"0.0.1\",\n \"description\": \"Cross-platform implementation of the Unix 'false' comm"
},
{
"path": "packages/head/README.md",
"chars": 1501,
"preview": "# cash-head\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `head` command.\n\n```bash\nnpm install ca"
},
{
"path": "packages/head/bin/head.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'head');\n"
},
{
"path": "packages/head/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/head/dist/commands/head.js",
"chars": 3165,
"preview": "'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { retu"
},
{
"path": "packages/head/dist/help/head.js",
"chars": 700,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: head [OPTION]... [FILE]...\\nPrint the first 10 lines of each FILE to standard "
},
{
"path": "packages/head/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/head/dist/util/expand.js",
"chars": 592,
"preview": "'use strict';\n\nvar glob = require('glob');\n\n/**\n * Expands wildcard files, etc. out\n * into their full paths.\n *\n * @par"
},
{
"path": "packages/head/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/head/package.json",
"chars": 929,
"preview": "{\n \"name\": \"cash-head\",\n \"version\": \"0.1.0\",\n \"description\": \"Cross-platform implementation of the Unix 'head' comman"
},
{
"path": "packages/kill/README.md",
"chars": 1501,
"preview": "# cash-kill\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `kill` command.\n\n```bash\nnpm install ca"
},
{
"path": "packages/kill/bin/kill.js",
"chars": 63,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'kill');\n"
},
{
"path": "packages/kill/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/kill/dist/commands/kill.js",
"chars": 2640,
"preview": "'use strict';\n\nvar fkill = require('fkill');\nvar os = require('os');\n\nvar interfacer = require('./../util/interfacer');\n"
},
{
"path": "packages/kill/dist/help/kill.js",
"chars": 765,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: kill [OPTION] pid | jobspec ... or kill -l [sigspec]\\nSend a signal to a job.\\"
},
{
"path": "packages/kill/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/kill/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/kill/package.json",
"chars": 921,
"preview": "{\n \"name\": \"cash-kill\",\n \"version\": \"0.2.0\",\n \"description\": \"Cross-platform implementation of the Unix 'kill' comman"
},
{
"path": "packages/ls/README.md",
"chars": 1491,
"preview": "# cash-ls\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `ls` command.\n\n```bash\nnpm install cash-l"
},
{
"path": "packages/ls/bin/ls.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'ls');\n"
},
{
"path": "packages/ls/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/ls/dist/commands/ls.js",
"chars": 12511,
"preview": "'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { retu"
},
{
"path": "packages/ls/dist/help/ls.js",
"chars": 1729,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: ls [OPTION]... [FILE]...\\nList information about the FILEs (the current direct"
},
{
"path": "packages/ls/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/ls/dist/util/colorFile.js",
"chars": 1462,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\nvar chalk = {};\nvar map = { cyan: 36, red: 31, magenta: 35 };\nObject"
},
{
"path": "packages/ls/dist/util/columnify.js",
"chars": 1415,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\nvar pad = require('./pad');\n\n/**\n * Formats an array to display in a "
},
{
"path": "packages/ls/dist/util/converter.date.js",
"chars": 678,
"preview": "'use strict';\n\n/**\n * Date conversion utilities\n */\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug"
},
{
"path": "packages/ls/dist/util/converter.permissions.js",
"chars": 740,
"preview": "'use strict';\n\n/**\n * Permission conversion utilities\n */\n\nmodule.exports = {\n\n listing: {\n 0: '---',\n 1: '--x',\n"
},
{
"path": "packages/ls/dist/util/expand.js",
"chars": 592,
"preview": "'use strict';\n\nvar glob = require('glob');\n\n/**\n * Expands wildcard files, etc. out\n * into their full paths.\n *\n * @par"
},
{
"path": "packages/ls/dist/util/fileFromPath.js",
"chars": 357,
"preview": "'use strict';\n\n/**\n * Parses a path and returns just the file\n *\n * @param {path} str\n * @return {String}\n * @api public"
},
{
"path": "packages/ls/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/ls/dist/util/lpad.js",
"chars": 417,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\n/**\n * Pads to the left hand.\n *\n * @param {String} str\n * @param {I"
},
{
"path": "packages/ls/dist/util/pad.js",
"chars": 478,
"preview": "'use strict';\n\nvar strip = require('./stripAnsi');\n\n/**\n * Pads a value with with space or\n * a specified delimiter to m"
},
{
"path": "packages/ls/dist/util/stripAnsi.js",
"chars": 319,
"preview": "'use strict';\n\n/**\n * Removes all ansi characters.\n *\n * @param {String} str\n * @return {String}\n * @api public\n */\n\nmod"
},
{
"path": "packages/ls/dist/util/walkDir.js",
"chars": 1083,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\n\n/**\n * Walks a single directory calling\n * a callbac"
},
{
"path": "packages/ls/dist/util/walkDirRecursive.js",
"chars": 572,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\n\n/**\n * Recursively walks through and executes\n * a c"
},
{
"path": "packages/ls/package.json",
"chars": 998,
"preview": "{\n \"name\": \"cash-ls\",\n \"version\": \"0.2.0\",\n \"description\": \"Cross-platform implementation of the Unix 'ls' command.\","
},
{
"path": "packages/mkdir/README.md",
"chars": 1506,
"preview": "# cash-mkdir\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `mkdir` command.\n\n```bash\nnpm install "
},
{
"path": "packages/mkdir/bin/mkdir.js",
"chars": 64,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'mkdir');\n"
},
{
"path": "packages/mkdir/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/mkdir/dist/commands/mkdir.js",
"chars": 2461,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\nvar fsAutocomplete = require('vorpal-autocomplete-fs'"
},
{
"path": "packages/mkdir/dist/help/mkdir.js",
"chars": 421,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: mkdir [OPTION]... DIRECTORY...\\nCreate the DIRECTORY(ies), if they do not alre"
},
{
"path": "packages/mkdir/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/mkdir/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/mkdir/package.json",
"chars": 918,
"preview": "{\n \"name\": \"cash-mkdir\",\n \"version\": \"0.2.0\",\n \"description\": \"Cross-platform implementation of the Unix 'mkdir' comm"
},
{
"path": "packages/mv/README.md",
"chars": 1491,
"preview": "# cash-mv\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `mv` command.\n\n```bash\nnpm install cash-m"
},
{
"path": "packages/mv/bin/mv.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'mv');\n"
},
{
"path": "packages/mv/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/mv/dist/commands/mv.js",
"chars": 3181,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar fsAutocomplete = require('vorpal-autocomplete-fs');\nvar path = require('path'"
},
{
"path": "packages/mv/dist/help/mv.js",
"chars": 737,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: mv [OPTION]... [-T] SOURCE DEST\\n or: mv [OPTION]... SOURCE... DIRECTORY\\n "
},
{
"path": "packages/mv/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/mv/dist/util/expand.js",
"chars": 592,
"preview": "'use strict';\n\nvar glob = require('glob');\n\n/**\n * Expands wildcard files, etc. out\n * into their full paths.\n *\n * @par"
},
{
"path": "packages/mv/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/mv/package.json",
"chars": 949,
"preview": "{\n \"name\": \"cash-mv\",\n \"version\": \"0.2.0\",\n \"description\": \"Cross-platform implementation of the Unix 'mv' command.\","
},
{
"path": "packages/pwd/README.md",
"chars": 1496,
"preview": "# cash-pwd\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `pwd` command.\n\n```bash\nnpm install cash"
},
{
"path": "packages/pwd/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/pwd/bin/pwd.js",
"chars": 62,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'pwd');\n"
},
{
"path": "packages/pwd/dist/commands/pwd.js",
"chars": 587,
"preview": "'use strict';\n\nvar path = require('path');\n\nvar interfacer = require('./../util/interfacer');\n\nvar pwd = {\n exec: funct"
},
{
"path": "packages/pwd/dist/help/pwd.js",
"chars": 364,
"preview": "\"use strict\";\n\nmodule.exports = \"\\nUsage: pwd [-LP]\\nPrint the name of the current working directory.\\n\\n --help "
},
{
"path": "packages/pwd/dist/preparser.js",
"chars": 618,
"preview": "'use strict';\n\n// Replace out env variables.\n\nvar parseEnvVariables = function parseEnvVariables(input) {\n var referenc"
},
{
"path": "packages/pwd/dist/util/interfacer.js",
"chars": 1106,
"preview": "'use strict';\n\n/**\n * Simple binding interface between\n * each command's function and the caller\n * of the command, whet"
},
{
"path": "packages/pwd/package.json",
"chars": 869,
"preview": "{\n \"name\": \"cash-pwd\",\n \"version\": \"0.1.0\",\n \"description\": \"Cross-platform implementation of the Unix 'pwd' command."
},
{
"path": "packages/rm/README.md",
"chars": 1491,
"preview": "# cash-rm\n\n---\n\n\nThis is a cross-platform, 100% ES6 implementation of the Unix `rm` command.\n\n```bash\nnpm install cash-r"
},
{
"path": "packages/rm/bin/parser.js",
"chars": 1673,
"preview": "'use strict';\n\nmodule.exports = function (args, command) {\n args.splice(0, 2);\n var pipes = (args.indexOf('|') > -1);\n"
},
{
"path": "packages/rm/bin/rm.js",
"chars": 61,
"preview": "#!/usr/bin/env node\nrequire('./parser')(process.argv, 'rm');\n"
}
]
// ... and 153 more files (download for full content)
About this extraction
This page contains the full source code of the dthree/cash GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 353 files (583.5 KB), approximately 179.9k tokens, and a symbol index with 344 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.