Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
CLI: Overrides default version info.
Browse files Browse the repository at this point in the history
* Based on sindresorhus/meow#2.
* Improves info text; inspired by Less CLI. :)

PR URL: #717.
  • Loading branch information
am11 committed Feb 28, 2015
1 parent fb8786d commit 06ae56a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
19 changes: 10 additions & 9 deletions bin/node-sass
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#!/usr/bin/env node
var Emitter = require('events').EventEmitter,
path = require('path'),
Gaze = require('gaze'),
meow = require('meow'),
stdin = require('get-stdin'),
grapher = require('sass-graph'),
render = require('../lib/render');
meow = require('meow'),
path = require('path'),
render = require('../lib/render'),
stdin = require('get-stdin');

/**
* Initialize CLI
*/

var cli = meow({
pkg: '../package.json',
version: process.sassInfo,
help: [
require('../lib/').info(),
'',
'Usage',
' node-sass [options] <input.scss> [output.css]',
' cat <input.scss> | node-sass > output.css',
Expand All @@ -38,6 +37,7 @@ var cli = meow({
' --include-path Path to look for imported files',
' --precision The amount of precision allowed in decimal numbers',
' --importer Path to custom importer',
' --version Prints version info',
' --help Print usage info'
].join('\n')
}, {
Expand All @@ -56,12 +56,13 @@ var cli = meow({
'precision'
],
alias: {
c: 'source-comments',
i: 'indented-syntax',
o: 'output',
w: 'watch',
r: 'recursive',
x: 'omit-source-map-url',
c: 'source-comments',
r: 'recursive'
v: 'version',
w: 'watch'
},
default: {
'include-path': process.cwd(),
Expand Down
12 changes: 11 additions & 1 deletion lib/extensions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var fs = require('fs');
var eol = require('os').EOL,
fs = require('fs'),
package = require('../package.json');

/**
* Get Runtime Info
Expand Down Expand Up @@ -41,5 +43,13 @@ function getBinaryIdentifiableName() {
v8SemVersion].join('');
}

function getSassInfo() {
return [
['node-sass', package.version, '(Wrapper)', '[Javascript]'].join('\t'),
['libsass ', package.libsass, '(Sass Compiler)', '[C/C++]'].join('\t'),
].join(eol);
}

process.runtime = getRuntimeInfo();
process.sassInfo = getSassInfo();
process.sassBinaryName = getBinaryIdentifiableName();
9 changes: 1 addition & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,4 @@ module.exports.renderSync = function(options) {
* @api public
*/

module.exports.info = function() {
var package = require('../package.json');

return [
'node-sass version: ' + package.version,
'libsass version: ' + package.libsass
].join('\n');
};
module.exports.info = process.sassInfo;

0 comments on commit 06ae56a

Please sign in to comment.