UNPKG

autocode-cli

Version:

code automation for every language, framework and platform

70 lines (68 loc) 2.18 kB
// Generated by CoffeeScript 1.10.0 (function() { module.exports = function(commands) { var getCommands, getCopyright, getInfo, getUsage, output, pad; pad = require('pad'); getCommands = function() { var command, command_length, command_max, command_name, output; output = "Commands:\n\n"; command_max = 0; for (command_name in commands) { command = commands[command_name]; command_length = (command_name + (command.opts ? ' ' + command.opts : '')).length; if (command_length > command_max) { command_max = command_length; } } command_max++; command_max++; for (command_name in commands) { command = commands[command_name]; output += ' '; output += pad(command_name + (command.opts ? ' ' + command.opts : ''), command_max, ' '); output += command.desc + "\n"; } return output; }; getCopyright = function() { var output; return output = "Copyright (c) 2014 Crystal. All Rights Reserved.\n"; }; getInfo = function() { var detail, detail_length, detail_max, detail_name, details, output; output = "\nInfo:\n\n"; details = { Author: 'Chris Tate <chris@crystal.sh>', License: 'MIT', Website: 'https://crystal.sh', Repository: 'https://github.com/crystal/autocode' }; detail_max = 0; for (detail_name in details) { detail = details[detail_name]; detail_length = detail_name.length; if (detail_length > detail_max) { detail_max = detail_length; } } detail_max++; detail_max++; for (detail_name in details) { detail = details[detail_name]; detail_name += ':'; output += ' ' + pad(detail_name, detail_max, ' '); output += detail + "\n"; } return output += "\n"; }; getUsage = function() { var output; output = "Usage:\n\n"; return output += "autocode [command]\n\n"; }; output = getUsage(); output += getCommands(); output += getInfo(); return output += getCopyright(); }; }).call(this);