Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hacksalot committed Oct 25, 2015
2 parents 9dd759f + e200077 commit f7c05f4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fluentcmd",
"version": "0.3.1",
"version": "0.4.0",
"description": "Generate beautiful, targeted resumes from your command line or shell.",
"repository": {
"type": "git",
Expand All @@ -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"
}
Expand Down
19 changes: 14 additions & 5 deletions src/fluentcmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }; }
Expand Down Expand Up @@ -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, _opts.theme );
return fObj.gen.generate( rez, fOut, _opts );
}
catch( ex ) {
_err( ex );
Expand All @@ -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.
Expand Down
27 changes: 24 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f7c05f4

Please sign in to comment.