https://github.com/typicode/shoutjs
Make your ShellJS commands explicit and get a beautiful output
https://github.com/typicode/shoutjs
Last synced: 9 months ago
JSON representation
Make your ShellJS commands explicit and get a beautiful output
- Host: GitHub
- URL: https://github.com/typicode/shoutjs
- Owner: typicode
- License: mit
- Created: 2013-11-08T15:05:55.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-18T13:23:21.000Z (about 12 years ago)
- Last Synced: 2025-04-30T20:26:53.173Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 30
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ShoutJS
Make your ShellJS commands explicit and get a beautiful output.
## Example
Get this:

With this:
```javascript
var shout = require('shoutjs');
shout.mkdir('bleach');
shout.to('bleach/ichigo', 'Bankai!');
shout.rm('-rf', 'bleach');
```
## Commands
Supported ShellJS commands are: `cp`, `rm`, `mv`, `mkdir`, `to`.
ShoutJS only wraps ShellJS commands which change the filesystem.
For usage information, you can go here [ShellJS](https://github.com/arturadib/shelljs).
There's only ```to``` which differs from ShellJS:
```javascript
var shell = require('shelljs/global'),
shout = require('shoutjs');
'Bankai!'.to('file'); // ShellJS
shout.to('file', 'Bankai!'); // ShoutJS
```
## Theming
ShoutJS supports theming through [Logan](http://typicode.github.com/logan).
So it's possible to customize ShoutJS output pretty much the way you want.
Here is the default theme:
```javascript
// Default theme
shout.logan.set({
cp : [' copy % to %', 'cyan . cyan .'],
rm : [' remove % ', 'red '],
mv : [' move % to %', 'cyan . cyan .'],
mkdir : [' create % ', 'cyan '],
to : [' create % ', 'cyan '],
exec : [' exec % ', 'blue . ']
});
```
To override it:
```javascript
// A bit more old fashioned theme...
shout.logan.set({
cp : ['cp % %', 'grey'],
rm : ['rm % ', 'grey'],
// ...
});
```
## Adding new messages
In many cases, you may want to log more than ShellJS commands for your users.
The recommanded way is to use [Logan](http://typicode.github.com/logan).
Here's an example:
```javascript
var shout = require('shoutjs'),
logan = require('logan');
logan.set({
info: [' info %', 'yellow']
});
logan.info('starting script...');
shout.rm('file.txt');
logan.info('done');
```
## Configuration
You can disable ShoutJS output using ```logan.silent``` option.
```javascript
shout.logan.silent = true;
shout.to('ichigo.txt', 'Bankai!'); // No output
```
## Issues
Have a bug or missing a new command introduced in ShellJS? Please create an issue here on GitHub!
## Themes
If you've created a theme for ShellJS feel free to drop me a message [@typicode](https://github.com/typicode).