Change options json structure, tweak templates.

This commit is contained in:
André Cruz
2013-05-31 17:36:04 +01:00
parent 0b0055e0e2
commit 487cd384a5
9 changed files with 101 additions and 45 deletions

View File

@@ -2,8 +2,8 @@ var mout = require('mout');
var leadLinesRegExp = /^\r?\n/;
var multipleLinesRegExp = /\r?\n(\r?\n)+/mg;
function oneLiner(Handlebars) {
Handlebars.registerHelper('oneLiner', function (context) {
function condense(Handlebars) {
Handlebars.registerHelper('condense', function (context) {
var str = context.fn(this);
// Remove multiple lines
@@ -19,4 +19,4 @@ function oneLiner(Handlebars) {
});
}
module.exports = oneLiner;
module.exports = condense;

View File

@@ -2,5 +2,5 @@ module.exports = {
colors: require('./colors'),
own: require('./own'),
rpad: require('./rpad'),
oneLiner: require('./oneLiner')
condense: require('./condense')
};

View File

@@ -1,11 +1,11 @@
var mout = require('mout');
function own(Handlebars) {
Handlebars.registerHelper('own', function (obj, hash) {
Handlebars.registerHelper('own', function (obj, options) {
var str = '';
mout.object.forOwn(obj, function (value, key) {
str += hash.fn({
str += options.fn({
key: key,
value: value
});

View File

@@ -5,10 +5,26 @@
"install",
"install [<endpoint> [, <endpoint>, ..]]"
],
"options": {
"-s, --save": "Save installed packages into the project's bower.json dependencies",
"-D, --save-dev": "Save installed packages into the project's bower.json devDependencies",
"-F, --force-latest": "Force latest version on conflict",
"-p, --production": "Do not install project devDependencies"
}
"options": [
{
"shorthand": "-F",
"flag": "--force-latest",
"description": "Force latest version on conflict"
},
{
"shorthand": "-p",
"flag": "--production",
"description": "Do not install project devDependencies"
},
{
"shorthand": "-s",
"flag": "--save",
"description": "Save installed packages into the project's bower.json dependencies"
},
{
"shorthand": "-D",
"flag": "--save-dev",
"description": "Save installed packages into the project's bower.json devDependencies"
}
]
}

View File

@@ -4,8 +4,16 @@
"usage": [
"uninstall <name> [<name>, ..]"
],
"options": {
"-s, --save": "Remove uninstalled packages from the bower.json dependencies",
"-D, --save-dev": "Remove uninstalled packages from the bower.json devDependencies"
}
"options": [
{
"shorthand": "-s",
"flag": "--save",
"description": "Save installed packages into the project's bower.json dependencies"
},
{
"shorthand": "-D",
"flag": "--save-dev",
"description": "Save installed packages into the project's bower.json devDependencies"
}
]
}

View File

@@ -4,7 +4,11 @@
"usage": [
"update <name> [<name>, ..]"
],
"options": {
"-p, --production": "Do not update project devDependencies"
}
"options": [
{
"shorthand": "-p",
"flag": "--production",
"description": "Do not install project devDependencies"
}
]
}

View File

@@ -10,20 +10,48 @@
"init": "Interactively create a bower.json file",
"install": "Install a package locally",
"link": "Symlink a package folder",
"list, ls": "List all installed packages",
"list": "List all installed packages",
"lookup": "Look up a package URL by name",
"register": "Register a package",
"search": "Search for a package by name",
"uninstall": "Remove a package",
"update": "Update a package"
},
"options": {
"-f, --force": "Makes various commands more forceful",
"-o, --offline": "Do not hit the network",
"-V, --verbose": "Makes output more verbose",
"-q, --quiet": "Only output important information",
"-l, --loglevel": "What level of logs to report",
"-j, --json": "Output consumable JSON output",
"-s, --silent": "Do not output anything, besides errors"
}
"options": [
{
"shorthand": "-f",
"flag": "--force",
"description": "Makes various commands more forceful"
},
{
"shorthand": "-o",
"flag": "--offline",
"description": "Do not hit the network"
},
{
"shorthand": "-v",
"flag": "--verbose",
"description": "Makes output more verbose"
},
{
"shorthand": "-q",
"flag": "--quiet",
"description": "Only output important information"
},
{
"shorthand": "-l",
"flag": "--log-level",
"description": "What level of logs to report"
},
{
"shorthand": "-j",
"flag": "--json",
"description": "Output consumable JSON output"
},
{
"shorthand": "-s",
"flag": "--silent",
"description": "Do not output anything, besides errors"
}
]
}

View File

@@ -1,19 +1,19 @@
Usage:
{{#oneLiner}}
{{#condense}}
{{#each usage}}
{{#cyan}}bower{{/cyan}} {{.}}
{{/each}}
{{/oneLiner}}
{{/condense}}
Options:
{{#oneLiner}}
{{#own options}}
{{#yellow}}{{#rpad length="20"}}{{key}}{{/rpad}}{{/yellow}} {{value}}
{{/own}}
{{/oneLiner}}
{{#condense}}
{{#each options}}
{{#yellow}}{{#rpad length="20"}}{{#if shorthand}}{{shorthand}}, {{/if}}{{flag}}{{/rpad}}{{/yellow}} {{description}}
{{/each}}
{{/condense}}
Additionally all global options listed in 'bower -h' are available

View File

@@ -1,26 +1,26 @@
Usage:
{{#oneLiner}}
{{#condense}}
{{#each usage}}
{{#cyan}}bower{{/cyan}} {{.}}
{{/each}}
{{/oneLiner}}
{{/condense}}
Commands:
{{#oneLiner}}
{{#condense}}
{{#own commands}}
{{#rpad length="20"}}{{key}}{{/rpad}} {{value}}
{{/own}}
{{/oneLiner}}
{{/condense}}
Options:
{{#oneLiner}}
{{#own options}}
{{#yellow}}{{#rpad length="20"}}{{key}}{{/rpad}}{{/yellow}} {{value}}
{{/own}}
{{/oneLiner}}
{{#condense}}
{{#each options}}
{{#yellow}}{{#rpad length="20"}}{{#if shorthand}}{{shorthand}}, {{/if}}{{flag}}{{/rpad}}{{/yellow}} {{description}}
{{/each}}
{{/condense}}
See 'bower help <command>' for more information on a specific command.