From 1b4056371bca00924c07fbfb860f77e0857423a7 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Sat, 17 Oct 2015 11:10:59 -0400 Subject: [PATCH 1/6] Objectify options. Support FCV Desktop requirement. --- src/fluentcmd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fluentcmd.js b/src/fluentcmd.js index c677d89..6db20e0 100644 --- a/src/fluentcmd.js +++ b/src/fluentcmd.js @@ -71,7 +71,7 @@ module.exports = function () { var fObj = _fmts.filter( function(_f) { return _f.ext === fType; } )[0]; var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext ); _log( 'Generating ' + fi.fmt.name.toUpperCase() + ' resume: ' + path.relative(process.cwd(), f ) ); - return fObj.gen.generate( rez, fOut, _opts.theme ); + return fObj.gen.generate( rez, fOut, { theme: _opts.theme } ); } catch( ex ) { _err( ex ); From ceaef3e1c4b00f7891fd7ce0f489003c064a527e Mon Sep 17 00:00:00 2001 From: devlinjd Date: Sat, 17 Oct 2015 11:11:10 -0400 Subject: [PATCH 2/6] Bump version to 0.4.1. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c441c6e..b50cf25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fluentcmd", - "version": "0.3.1", + "version": "0.4.1", "description": "Generate beautiful, targeted resumes from your command line or shell.", "repository": { "type": "git", From 2a7963450ef40ed39ed09289b2869dcc5747ff60 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Sun, 25 Oct 2015 02:16:54 -0400 Subject: [PATCH 3/6] Bump fluentlib version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b50cf25..e7d66cf 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/fluentdesk/fluentcmd", "dependencies": { - "fluentlib": "fluentdesk/fluentlib#v0.2.0", + "fluentlib": "fluentdesk/fluentlib#v0.3.0", "minimist": "^1.2.0", "underscore": "^1.8.3" } From 68f943745c5b50e5f6e92c63e7939a3b73a3c876 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Sun, 25 Oct 2015 03:04:51 -0400 Subject: [PATCH 4/6] Support "--no-prettify" option. Add command-line support for "--no-prettify" and "-n". Use a negative option here since pretty printing is enabled by default. --- src/fluentcmd.js | 19 ++++++++++++++----- src/index.js | 27 ++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/fluentcmd.js b/src/fluentcmd.js index 6db20e0..9d8eced 100644 --- a/src/fluentcmd.js +++ b/src/fluentcmd.js @@ -22,11 +22,14 @@ module.exports = function () { @param theme Friendly name of the resume theme. Defaults to "modern". @param logger Optional logging override. */ - function gen( src, dst, theme, logger, errHandler ) { + function gen( src, dst, opts, logger, errHandler ) { _log = logger || console.log; _err = errHandler || error; - _opts.theme = (theme && theme.toLowerCase().trim()) || 'modern'; + + //_opts = extend( true, _opts, opts ); + _opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern'; + _opts.prettify = opts.prettify === true ? _opts.prettify : false; // Load input resumes... if(!src || !src.length) { throw { fluenterror: 3 }; } @@ -71,7 +74,7 @@ module.exports = function () { var fObj = _fmts.filter( function(_f) { return _f.ext === fType; } )[0]; var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext ); _log( 'Generating ' + fi.fmt.name.toUpperCase() + ' resume: ' + path.relative(process.cwd(), f ) ); - return fObj.gen.generate( rez, fOut, { theme: _opts.theme } ); + return fObj.gen.generate( rez, fOut, _opts ); } catch( ex ) { _err( ex ); @@ -98,11 +101,17 @@ module.exports = function () { ]; /** - Default options. + Default FluentCMD options. */ var _opts = { theme: 'modern', - } + prettify: { // ← See https://github.com/beautify-web/js-beautify#options + indent_size: 2, + unformatted: ['em','strong'], + max_char: 80, // ← See lib/html.js in above-linked repo + //wrap_line_length: 120, ← Don't use this + } + }; /** Internal module interface. Used by FCV Desktop and HMR. diff --git a/src/index.js b/src/index.js index fd588e8..5ef1637 100644 --- a/src/index.js +++ b/src/index.js @@ -10,17 +10,38 @@ var ARGS = require( 'minimist' ) , PKG = require('../package.json'); try { + main(); +} +catch( ex ) { + handleError( ex ); +} + +function main() { + // Setup. console.log( '*** FluentCMD v' + PKG.version + ' ***' ); if( process.argv.length <= 2 ) { throw { fluenterror: 3 }; } + + // Convert arguments to source files, target files, options var args = ARGS( process.argv.slice(2) ); var src = args._ || []; var dst = (args.o && ((typeof args.o === 'string' && [ args.o ]) || args.o)) || []; - dst = (dst === true) ? [] : dst; // handle -o with missing output file - FCMD.generate( src, dst, args.t || 'modern' ); + dst = (dst === true) ? [] : dst; // Handle -o with missing output file + + // Generate! + FCMD.generate( src, dst, getOpts( args ) ); process.platform !== 'win32' && console.log('\n'); } -catch( ex ) { +function getOpts( args ) { + var noPretty = args['nopretty'] || args.n; + noPretty = noPretty && (noPretty === true || noPretty === 'true'); + return { + theme: args.t || 'modern', + prettify: !noPretty + }; +} + +function handleError( ex ) { var msg = ''; if( ex.fluenterror ){ switch( ex.fluenterror ) { // TODO: Remove magic numbers From 19b6627df7628c4d224830439cac2c7636621b58 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Sun, 25 Oct 2015 08:03:46 -0400 Subject: [PATCH 5/6] Bump version to 0.4.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e7d66cf..11570d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fluentcmd", - "version": "0.4.1", + "version": "0.4.0", "description": "Generate beautiful, targeted resumes from your command line or shell.", "repository": { "type": "git", From e20007721e4611821e0add082710a2a6721239af Mon Sep 17 00:00:00 2001 From: devlinjd Date: Sun, 25 Oct 2015 08:18:49 -0400 Subject: [PATCH 6/6] Update README for 0.4.0. --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc80bac..ada6120 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ fluentcmd in1.json in2.json -o out.html -o out.doc -o out.pdf You should see something to the effect of: ``` -*** FluentCMD v0.3.1 *** +*** FluentCMD v0.4.0 *** Reading JSON resume: foo/resume.json Generating HTML resume: out/resume.html Generating TXT resume: out/resume.txt @@ -78,7 +78,7 @@ fluentcmd resume.json -t modern fluentcmd resume.json -t ~/foo/bar/my-custom-theme/ ``` -As of v0.3.1, available predefined themes are `modern`, `minimist`, `informatic`, and `hello-world`. +As of v0.4.0, available predefined themes are `modern`, `minimist`, and `hello-world`. ### Merging resumes @@ -129,6 +129,14 @@ fluentcmd me.json -o out/resume.all ..tells FluentCV to read `me.json` and generate `out/resume.md`, `out/resume.doc`, `out/resume.html`, `out/resume.txt`, `out/resume.pdf`, and `out/resume.json`. +### Prettifying + +FluentCMD applies [js-beautify][10]-style HTML prettification by default to HTML-formatted resumes. To disable prettification, the `--nopretty` or `-n` flag can be used: + +```bash +fluentcmd resume.json out.all --nopretty +``` + ## License MIT. Go crazy. See [LICENSE.md][1] for details. @@ -142,3 +150,4 @@ MIT. Go crazy. See [LICENSE.md][1] for details. [7]: http://fluentcv.com [8]: https://youtu.be/N9wsjroVlu8 [9]: https://api.jquery.com/jquery.extend/ +[10]: https://github.com/beautify-web/js-beautify