-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use antimatter for command line docs
- Loading branch information
Jeff Escalante
committed
Mar 6, 2014
1 parent
224291f
commit 092b242
Showing
2 changed files
with
22 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,37 @@ | ||
require('colors') | ||
antimatter = require 'anti-matter' | ||
|
||
exports.execute = -> | ||
console.log( | ||
"\n" + | ||
"Roots Usage\n".red.bold + | ||
"-----------\n".bold + | ||
|
||
document_option( | ||
antimatter | ||
title: 'Roots Usage' | ||
options: { log: true, width: 65 } | ||
commands: [{ | ||
name: 'new' | ||
required: ['name'] | ||
optional: ['dir', '--template-name'] | ||
description: 'Creates a new roots project called [name] in [dir]. If [dir] is not provided, project is created in the current directory. The [--template-name] option lets you choose to initialize with an installed template.' | ||
) + | ||
|
||
document_option( | ||
}, { | ||
name: 'compile' | ||
optional: ['--no-compress'] | ||
description: 'Compiles the roots project. Optional flag will not compress or minify files.' | ||
) + | ||
|
||
document_option( | ||
description: 'Compiles the roots project. Optional flag will not compress or minify files.' | ||
}, { | ||
name: 'watch' | ||
optional: ['dir', '--no-open', '--no-livereload'] | ||
description: 'Watches the given [dir] or current directory and recompiles every time changes are made.' | ||
) + | ||
|
||
document_option( | ||
description: 'Watches the given [dir] or current directory and recompiles every time changes are made.' | ||
}, { | ||
name: 'deploy' | ||
required: ['deployer'] | ||
optional: ['file/dir'] | ||
description: 'Deploys the given [file/dir] or by default the output folder via the given [deployer]. See http://ship.io for deployers.' | ||
) + | ||
|
||
document_option( | ||
description: 'Deploys the given [file/dir] or by default the output folder via the given [deployer]. See http://ship.io for deployers.' | ||
}, { | ||
name: 'clean' | ||
description: 'Removes the output folder.' | ||
) + | ||
|
||
document_option( | ||
description: 'Removes the output folder.' | ||
}, { | ||
name: 'version' | ||
description: 'Outputs the currently installed version of roots.' | ||
) + | ||
|
||
document_option( | ||
description: 'Outputs the currently installed version of roots.' | ||
}, { | ||
name: 'template' | ||
description: 'Manage roots templates. `roots template` for help.' | ||
) + | ||
|
||
document_option( | ||
description: 'Manage roots templates. `roots template` for help.' | ||
}, { | ||
name: 'pkg' | ||
description: 'Utilize a roots-integrated package manager. `roots pkg` for help.' | ||
) + | ||
|
||
"\nCheck out https://roots.cx for more docs and tutorials!\n".green | ||
) | ||
|
||
wordwrap = (str, width, brk, cut) -> | ||
brk = brk || '\n' | ||
width = width || 75 | ||
cut = cut || false | ||
if !str then return str | ||
regex = '.{1,' +width+ '}(\\s|$)' + (if cut then '|.{' +width+ '}|.+$' else '|\\S+?(\\s|$)') | ||
return str.match( RegExp(regex, 'g') ).join(brk) | ||
|
||
document_option = (conf) -> | ||
res = "\n* ".red | ||
res += "#{conf.name.bold} " | ||
res += "#{arg.underline} ".grey for arg in conf.required if conf.required | ||
res += "[#{arg}] ".grey for arg in conf.optional if conf.optional | ||
res += "\n" | ||
res += "#{wordwrap(conf.description, 59, '\n')}" | ||
res += "\n" | ||
description: 'Utilize a roots-integrated package manager. `roots pkg` for help.' | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters