#!/usr/bin/env node /** * fur bin script. */ 'use strict' const program = require('commander') const pkg = require('../package') const Fur = require('../lib/fur') const co = require('co') program .version(pkg[ 'version' ]) // ========================= // Handle `banner` command // ========================= program .command("banner ") .description("Generate a banner.") .option('-c, --color ', "Color expression string or color theme name.") .option('-s, --shape ', "Banner style.") .option('-f, --font ', "Font file name or font theme name.") .option('-F, --font-size ', "Size of font.") .option('-H, --height ', "Banner height.") .option('-o, --format ', "File format. 'svg' or 'png'.") .option('-t, --text ', "Banner text.") .option('-W, --width ', "Banner width.") .option('-v, --verbose', "Emit verbose log.") .action((filename, options) => { const fur = new Fur({}) fur.banner(filename, options) .then(() => process.exit(0)) .catch((e) => { console.error(e) process.exit(1) }) }) // ========================= // Handle `favicon` command // ========================= program .command("favicon ") .description("Generate a favicon.") .option('-c, --color ', "Color expression string or color theme name.") .option('-f, --font ', "Font file name or font theme name.") .option('-F, --font-size ', "Size of font.") .option('-S, --size ', "Favicon size.") .option('-s, --shape ', "Banner style.") .option('-t, --text ', "Favicon text.") .option('-o, --format ', "File format. 'svg' or 'png'.") .option('-v, --verbose', "Emit verbose log.") .action((filename, options) => { const fur = new Fur({}) fur.favicon(filename, options) .then(() => process.exit(0)) .catch((e) => { console.error(e) process.exit(1) }) }) program .parse(process.argv) if (program.args.length === 0) { program.help() }