New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cssbeautify-cli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssbeautify-cli - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

css.css

4

lib/cssbeautify-cli.js

@@ -53,2 +53,4 @@ #!/usr/bin/env node

.string('o')
.alias('s', 'stdin')
.describe('s', 'use stdin')
.alias('v', 'version')

@@ -197,3 +199,3 @@ .describe('v', 'Display program version')

});
} else if (! this.argv.f) {
} else if (! this.argv.f && ! this.argv.s) {
this.setExit(CssbeautifyCli.ERRORS.file, 1);

@@ -200,0 +202,0 @@ } else {

{
"name": "cssbeautify-cli",
"description": "CLI for cssbeautify",
"version": "0.3.0",
"version": "0.4.0",
"author": {

@@ -27,3 +27,3 @@ "name": "Igor Shevchenko",

"engines": {
"node": "*"
"node": ">=0.10.0"
},

@@ -37,2 +37,3 @@ "keywords": [

"dependencies": {
"concat-stream": "^1.4.6",
"cssbeautify": "~0.3.0",

@@ -39,0 +40,0 @@ "optimist": "~0.6.0"

@@ -1,2 +0,2 @@

[![Dependency Status](https://gemnasium.com/Saunalol/cssbeautify-cli.png)](https://gemnasium.com/Saunalol/cssbeautify-cli)[![Build Status](https://travis-ci.org/Saunalol/cssbeautify-cli.png?branch=master)](https://travis-ci.org/Saunalol/cssbeautify-cli)
[![NPM version](https://badge.fury.io/js/cssbeautify-cli.png)](http://badge.fury.io/js/cssbeautify-cli)[![Dependency Status](https://gemnasium.com/Saunalol/cssbeautify-cli.png)](https://gemnasium.com/Saunalol/cssbeautify-cli)[![Build Status](https://travis-ci.org/Saunalol/cssbeautify-cli.png?branch=master)](https://travis-ci.org/Saunalol/cssbeautify-cli)
# CSS Beautify CLI #

@@ -8,21 +8,20 @@

`npm install -g cssbeautify-cli`
npm install -g cssbeautify-cli
## Usage ##
`cssbeautify-bin [options] -f filename`
cssbeautify-bin [options] -f filename
Options:
```
-a, --autosemicolon insert a semicolon after the last ruleset [default: false]
-c, --config json config file to use
-f, --file file to beautify
-h, --help show this help message
-i, --indent string used for the indentation of the declaration (spaces, tabs or number of spaces) [default: " "]
-o, --openbrace the placement of open curly brace, either end-of-line or separate-line [default: "end-of-line"]
-v, --version Display program version
-a, --autosemicolon insert a semicolon after the last ruleset [default: false]
-c, --config json config file to use
-f, --file file to beautify
-h, --help show this help message
-i, --indent string used for the indentation of the declaration (spaces, tabs or number of spaces) [default: " "]
-o, --openbrace the placement of open curly brace, either end-of-line or separate-line [default: "end-of-line"]
-s, --stdin use stdin
-v, --version Display program version
```
__Note:__ Options from config override command line options.
__Examples__

@@ -35,12 +34,16 @@ ```

__Notes__
- Options from config override command line options
- `optimist` introduces strange behaviour in some cases, e.g.
it's impossible to pass empty `indent` option in the following form: `-i ''`,
but these solutions work just fine: `-i0`, `--indent ''`, `--indent=''`, `--indent=0`
- The behaviour of boolean `-a` option is quite strange sometimes, check `test/autosemicolon.js` for
details
- file option is used if both file and stdin options are passed
It seems to me that `optimist` introduces strange behaviour in some cases, e.g.
it's mpossible to pass empty `indent` option in the following form: `-i ''`,
but following solutions work just fine: `-i0`, `--indent ''`, `--indent=''`, `--indent=0`.
Also the behaviour of boolean `-a` option is quite strange sometimes, check `test/autosemicolon.js` for
details.
## Versions
**0.4.0**
* `-s` (`--stdin`) option added
* node 0.8 support dropped
## Versions
**0.3.0**

@@ -53,6 +56,6 @@ * `-c` (`--config`) option added

**0.2.0**
* file is now passed in -f (--file) option
* file is now passed in `-f` (`--file`) option
**0.1.0**
* options -a (--autosemicolon), -h (--help), -i (--indent), -o (--openbrace), -v (--version)
* options `-a` (`--autosemicolon`), `-h` (`--help`), `-i` (`--indent`), `-o` (`--openbrace`), `-v` (`--version`)
* file is passed as anonymous option
var CssbeautifyCli = require('../lib/cssbeautify-cli'),
cssbeautifyCli,
fakeCommand = './bin/cssbeautify',
filename = 'test.css';

@@ -7,13 +8,13 @@

([
['node', 'lol', '-f', filename, '-a', 'true'],
['node', 'lol', '-f', filename, '-a', '1'],
['node', 'lol', '-f', filename, '--autosemicolon', 'true'],
['node', 'lol', '-f', filename, '--autosemicolon', '1'],
['node', 'lol', '-f', filename, '-a'],
['node', 'lol', '-f', filename, '--autosemicolon'],
['node', fakeCommand, '-f', filename, '-a', 'true'],
['node', fakeCommand, '-f', filename, '-a', '1'],
['node', fakeCommand, '-f', filename, '--autosemicolon', 'true'],
['node', fakeCommand, '-f', filename, '--autosemicolon', '1'],
['node', fakeCommand, '-f', filename, '-a'],
['node', fakeCommand, '-f', filename, '--autosemicolon'],
// it's strange parsing of 'boolean' by optimist, isn't it?
['node', 'lol', '-f', filename, '-a', '0'],
['node', 'lol', '-f', filename, '-a', 'xxx'],
['node', 'lol', '-f', filename, '--autosemicolon', '0'],
['node', 'lol', '-f', filename, '--autosemicolon', 'xxx'],
['node', fakeCommand, '-f', filename, '-a', '0'],
['node', fakeCommand, '-f', filename, '-a', 'xxx'],
['node', fakeCommand, '-f', filename, '--autosemicolon', '0'],
['node', fakeCommand, '-f', filename, '--autosemicolon', 'xxx'],

@@ -37,6 +38,6 @@ ]).forEach(function (argv) {

([
['node', 'lol', '-f', filename, '-a', 'false'],
['node', 'lol', '-f', filename, '--autosemicolon', 'false'],
['node', 'lol', '-f', filename, '--no-a'],
['node', 'lol', '-f', filename, '--no-autosemicolon']
['node', fakeCommand, '-f', filename, '-a', 'false'],
['node', fakeCommand, '-f', filename, '--autosemicolon', 'false'],
['node', fakeCommand, '-f', filename, '--no-a'],
['node', fakeCommand, '-f', filename, '--no-autosemicolon']
]).forEach(function (argv) {

@@ -58,7 +59,7 @@ process.argv = argv;

exports.a_wrong = function (test) {
process.argv = ['node', 'lol', '-f', filename, '-a', 'xxx'];
process.argv = ['node', fakeCommand, '-f', filename, '-a', 'xxx'];
([
['node', 'lol', '-f', filename, '--autosemicolon=true'],
['node', 'lol', '-f', filename, '--autosemicolon=false']
['node', fakeCommand, '-f', filename, '--autosemicolon=true'],
['node', fakeCommand, '-f', filename, '--autosemicolon=false']
]).forEach(function (argv) {

@@ -80,7 +81,7 @@ process.argv = argv;

exports.autosemicolon_wrong = function (test) {
process.argv = ['node', 'lol', '-f', filename, '--autosemicolon', 'xxx'];
process.argv = ['node', fakeCommand, '-f', filename, '--autosemicolon', 'xxx'];
([
['node', 'lol', '-f', filename, '--autosemicolon=true'],
['node', 'lol', '-f', filename, '--autosemicolon=false']
['node', fakeCommand, '-f', filename, '--autosemicolon=true'],
['node', fakeCommand, '-f', filename, '--autosemicolon=false']
]).forEach(function (argv) {

@@ -102,7 +103,7 @@ process.argv = argv;

exports['autosemicolon=_wrong'] = function (test) {
process.argv = ['node', 'lol', '-f', filename, '--autosemicolon=xxx'];
process.argv = ['node', fakeCommand, '-f', filename, '--autosemicolon=xxx'];
([
['node', 'lol', '-f', filename, '--autosemicolon=true'],
['node', 'lol', '-f', filename, '--autosemicolon=false']
['node', fakeCommand, '-f', filename, '--autosemicolon=true'],
['node', fakeCommand, '-f', filename, '--autosemicolon=false']
]).forEach(function (argv) {

@@ -109,0 +110,0 @@ process.argv = argv;

var CssbeautifyCli = require('../lib/cssbeautify-cli'),
fakeCommand = './bin/cssbeautify',
filename = 'test.css',

@@ -15,3 +16,3 @@ cssbeautifyCli,

process.argv = ['node', 'lol', '-f', filename, param];
process.argv = ['node', fakeCommand, '-f', filename, param];

@@ -34,3 +35,3 @@ cssbeautifyCli = CssbeautifyCli()

['-c', '-c=', '--config', '--config='].forEach(function (param) {
process.argv = ['node', 'lol', '-f', filename, param, 'someNonexistingFile'];
process.argv = ['node', fakeCommand, '-f', filename, param, 'someNonexistingFile'];

@@ -53,3 +54,3 @@ cssbeautifyCli = CssbeautifyCli()

process.argv = ['node', 'lol', '-f', filename, '-c', configFileName];
process.argv = ['node', fakeCommand, '-f', filename, '-c', configFileName];

@@ -80,3 +81,3 @@ cssbeautifyCli = CssbeautifyCli()

process.argv = ['node', 'lol',
process.argv = ['node', fakeCommand,
'-f', filename,

@@ -83,0 +84,0 @@ '-c', configFileName,

@@ -7,6 +7,7 @@ var cssbeautifyCli = require('../lib/cssbeautify-cli')(),

},
fakeCommand = './bin/cssbeautify',
filename = 'test.css';
exports.singleParam_f = function (test) {
process.argv = ['node', 'lol', '-f', filename];
process.argv = ['node', fakeCommand, '-f', filename];

@@ -25,3 +26,3 @@ options = cssbeautifyCli.parse().process().options;

exports.singleParam_file = function (test) {
process.argv = ['node', 'lol', '--file=' + filename];
process.argv = ['node', fakeCommand, '--file=' + filename];

@@ -28,0 +29,0 @@ options = cssbeautifyCli.parse().process().options;

var CssbeautifyCli = require('../lib/cssbeautify-cli'),
cssbeautifyCli,
fakeCommand = './bin/cssbeautify',
filename = 'test.css',

@@ -23,3 +24,3 @@ indentNumbers = [

indentSpaces.forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '-i', indent];
process.argv = ['node', fakeCommand, '-f', filename, '-i', indent];

@@ -37,3 +38,3 @@ cssbeautifyCli = CssbeautifyCli().parse().process();

indentSpaces.concat('').forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '--indent', indent];
process.argv = ['node', fakeCommand, '-f', filename, '--indent', indent];

@@ -51,3 +52,3 @@ cssbeautifyCli = CssbeautifyCli().parse().process();

indentSpaces.concat('').forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '--indent='+indent];
process.argv = ['node', fakeCommand, '-f', filename, '--indent='+indent];

@@ -64,3 +65,3 @@ cssbeautifyCli = CssbeautifyCli().parse().process();

indentNumbers.forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '-i', indent.value];
process.argv = ['node', fakeCommand, '-f', filename, '-i', indent.value];

@@ -78,3 +79,3 @@ cssbeautifyCli = CssbeautifyCli().parse().process();

indentNumbers.forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '-i'+indent.value];
process.argv = ['node', fakeCommand, '-f', filename, '-i'+indent.value];

@@ -92,3 +93,3 @@ cssbeautifyCli = CssbeautifyCli().parse().process();

indentNumbers.forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '--indent', indent.value];
process.argv = ['node', fakeCommand, '-f', filename, '--indent', indent.value];

@@ -106,3 +107,3 @@ cssbeautifyCli = CssbeautifyCli().parse().process();

indentNumbers.forEach(function (indent) {
process.argv = ['node', 'lol', '-f', filename, '--indent=' + indent.value];
process.argv = ['node', fakeCommand, '-f', filename, '--indent=' + indent.value];

@@ -121,3 +122,3 @@ cssbeautifyCli = CssbeautifyCli()

exports.i_wrong = function (test) {
process.argv = ['node', 'lol', '-f', filename, '-i', wrongIndent];
process.argv = ['node', fakeCommand, '-f', filename, '-i', wrongIndent];

@@ -136,3 +137,3 @@ var cssbeautifyCli = CssbeautifyCli()

exports.indent_wrong = function (test) {
process.argv = ['node', 'lol', '-f', filename, '--indent', wrongIndent];
process.argv = ['node', fakeCommand, '-f', filename, '--indent', wrongIndent];

@@ -151,3 +152,3 @@ var cssbeautifyCli = CssbeautifyCli()

exports['indent=_wrong'] = function (test) {
process.argv = ['node', 'lol', '-f', filename, '--indent', wrongIndent];
process.argv = ['node', fakeCommand, '-f', filename, '--indent', wrongIndent];

@@ -154,0 +155,0 @@ var cssbeautifyCli = CssbeautifyCli()

@@ -1,5 +0,6 @@

var CssbeautifyCli = require('../lib/cssbeautify-cli');
var CssbeautifyCli = require('../lib/cssbeautify-cli'),
fakeCommand = './bin/cssbeautify';
exports.test = function (test) {
process.argv = ['node', 'lol'];
process.argv = ['node', fakeCommand];

@@ -14,3 +15,3 @@ cssbeautifyCli = CssbeautifyCli()

test.strictEqual(typeof cssbeautifyCli.exit, 'object', 'bad exit');
test.strictEqual(typeof cssbeautifyCli.exit, 'object', 'bad exit object');
test.strictEqual(cssbeautifyCli.exit.code, 1, 'bad exit code');

@@ -17,0 +18,0 @@ test.strictEqual(cssbeautifyCli.exit.fn, CssbeautifyCli.ERRORS.file);

var CssbeautifyCli = require('../lib/cssbeautify-cli'),
cssbeautifyCli,
fakeCommand = './bin/cssbeautify',
filename = 'test.css';

@@ -9,3 +10,3 @@

openbrace.forEach(function (openbrace) {
process.argv = ['node', 'lol', '-f', filename, '-o', openbrace];
process.argv = ['node', fakeCommand, '-f', filename, '-o', openbrace];

@@ -27,3 +28,3 @@ cssbeautifyCli = CssbeautifyCli()

openbrace.forEach(function (openbrace) {
process.argv = ['node', 'lol', '-f', filename, '--openbrace', openbrace];
process.argv = ['node', fakeCommand, '-f', filename, '--openbrace', openbrace];

@@ -44,3 +45,3 @@ cssbeautifyCli = CssbeautifyCli()

process.argv = ['node', 'lol', '-f', filename, '-o', openbrace];
process.argv = ['node', fakeCommand, '-f', filename, '-o', openbrace];

@@ -61,3 +62,3 @@ cssbeautifyCli = CssbeautifyCli()

process.argv = ['node', 'lol', '-f', filename, '--openbrace', openbrace];
process.argv = ['node', fakeCommand, '-f', filename, '--openbrace', openbrace];

@@ -78,3 +79,3 @@ cssbeautifyCli = CssbeautifyCli()

process.argv = ['node', 'lol', '-f', filename, '--openbrace='+openbrace];
process.argv = ['node', fakeCommand, '-f', filename, '--openbrace='+openbrace];

@@ -81,0 +82,0 @@ cssbeautifyCli = CssbeautifyCli()

var CssbeautifyCli = require('../lib/cssbeautify-cli'),
fakeCommand = './bin/cssbeautify',
options;
exports.help = function (test) {
process.argv = ['node', 'lol', '-h'];
process.argv = ['node', fakeCommand, '-h'];

@@ -23,3 +24,3 @@ cssbeautifyCli = CssbeautifyCli()

exports.version = function (test) {
process.argv = ['node', 'lol', '-v'];
process.argv = ['node', fakeCommand, '-v'];

@@ -26,0 +27,0 @@ cssbeautifyCli = CssbeautifyCli()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc