From 71441261751538150be59bc16eda52223dad1ca6 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Sun, 11 Feb 2018 08:13:13 -0500 Subject: [PATCH] feat: improve help behavior --- dist/cli/error.js | 8 +--- dist/cli/help/analyze.txt | 24 +++++----- dist/cli/help/build.txt | 62 ++++++++++++------------ dist/cli/help/convert.txt | 21 ++++---- dist/cli/help/help.txt | 8 ++-- dist/cli/help/new.txt | 22 +++++---- dist/cli/help/peek.txt | 33 ++++++------- dist/cli/help/use.txt | 96 +++++++++++++++++++++++-------------- dist/cli/help/validate.txt | 21 ++++---- dist/cli/main.js | 4 +- src/cli/error.coffee | 18 +++---- src/cli/help/analyze.txt | 24 +++++----- src/cli/help/build.txt | 62 ++++++++++++------------ src/cli/help/convert.txt | 21 ++++---- src/cli/help/help.txt | 8 ++-- src/cli/help/new.txt | 22 +++++---- src/cli/help/peek.txt | 33 ++++++------- src/cli/help/use.txt | 96 +++++++++++++++++++++++-------------- src/cli/help/validate.txt | 21 ++++---- src/cli/main.coffee | 9 ++-- test/scripts/test-hmr.txt | 2 +- test/scripts/test-output.js | 30 +++++++----- 22 files changed, 349 insertions(+), 296 deletions(-) diff --git a/dist/cli/error.js b/dist/cli/error.js index 5df9bda..cabf421 100644 --- a/dist/cli/error.js +++ b/dist/cli/error.js @@ -113,14 +113,10 @@ Error-handling routines for HackMyResume. quit = false; break; case HMSTATUS.resumeNotFound: - msg = M2C(this.msgs.resumeNotFound.msg, 'yellow'); + msg += M2C(FS.readFileSync(PATH.resolve(__dirname, 'help/' + ex.verb + '.txt'), 'utf8'), 'white', 'yellow'); break; case HMSTATUS.missingCommand: - msg = M2C(this.msgs.missingCommand.msg + " (", 'yellow'); - msg += Object.keys(FCMD.verbs).map(function(v, idx, ar) { - return (idx === ar.length - 1 ? chalk.yellow('or ') : '') + chalk.yellow.bold(v.toUpperCase()); - }).join(chalk.yellow(', ')) + chalk.yellow(").\n\n"); - msg += chalk.gray(FS.readFileSync(PATH.resolve(__dirname, '../cli/use.txt'), 'utf8')); + msg += M2C(FS.readFileSync(PATH.resolve(__dirname, 'help/use.txt'), 'utf8'), 'white', 'yellow'); break; case HMSTATUS.invalidCommand: msg = printf(M2C(this.msgs.invalidCommand.msg, 'yellow'), ex.attempted); diff --git a/dist/cli/help/analyze.txt b/dist/cli/help/analyze.txt index 5635f16..8e7187e 100644 --- a/dist/cli/help/analyze.txt +++ b/dist/cli/help/analyze.txt @@ -1,23 +1,25 @@ -**analyze** | Analyze a FRESH resume document for statistics +**analyze** | Analyze a resume for statistical insight Usage: - hackmyresume ANALYZE [] - hackmyresume ANALYZE [] + **hackmyresume ANALYZE ** + + The ANALYZE command evaluates the specified resume(s) for + coverage, duration, gaps, keywords, and other metrics. + + This command can be run against multiple resumes. Each + will be analyzed in turn. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents to be analyzed. Multiple resumes - can be specified, separated by spaces: + Path to a FRESH or JRS resume. Multiple resumes can be + specified, separated by spaces. - hackmyresume ANALYZE r1.json r2.json r3.json + hackmyresume ANALYZE resume.json + hackmyresume ANALYZE r1.json r2.json r3.json Options: **None.** - -The ANALYZE command performs simple analysis on a FRESH or -JSON Resume document. diff --git a/dist/cli/help/build.txt b/dist/cli/help/build.txt index e572f5c..6a1d228 100644 --- a/dist/cli/help/build.txt +++ b/dist/cli/help/build.txt @@ -1,28 +1,29 @@ -**build** | Generate resumes in supported output formats +**build** | Generate themed resumes in multiple formats Usage: - hackmyresume BUILD TO [] + **hackmyresume BUILD TO [--theme]** + **[--pdf] [--no-escape] [--private]** + + The BUILD command generates themed resumes and CVs in + multiple formats. Use it to create outbound resumes in + specific formats such HTML, MS Word, and PDF. Parameters: - **** + **** - Absolute or relative path(s) to one or more resumes in - FRESH or JSON format, separated by spaces. If multiple - resumes are specified, they will be merged into a - single resume prior to transformation. + Path to a FRESH or JRS resume (*.json) containing your + resume data. Multiple resumes may be specified. - hackmyresume BUILD resume.json output.all - hackmyresume BUILD base.json developer.json gamedev.json TO out/resume.all + If multiple resumes are specified, they will be merged + into a single resume prior to transformation. - **** + **** - Absolute or relative path(s) to one or more outbound - resume(s), separated by spaces. If multiple output - resumes are specified, all of them will be generated. - The desired format of each resume will be determined - from the file extension: + Path to the desired output resume. Multiple resumes + may be specified. The file extension will determine + the format. .all Generate all supported formats .html HTML 5 @@ -33,27 +34,22 @@ Parameters: .png PNG Image .latex LaTeX - Note: not all formats are supported by all themes. - Check the theme's documentation for details. + Note: not all formats are supported by all themes! + Check the theme's documentation for details or use + the .all extension to build all available formats. Options: **--theme -t ** - Relative or absolute path to a FRESH or JSON Resume - theme, or the name of a built-in theme. - - As of 1.9.0, the following built-in themes are - provided: basis, modern, positive, compact, awesome. + Path to a FRESH or JSON Resume theme OR the name of a + built-in theme. Valid theme names are 'modern', + 'positive', 'compact', 'awesome', and 'basis'. **--pdf -p ** - Specify the PDF engine to use. Legal values are: - - - none: Don't generate a PDF. - - wkhtmltopdf: Use the wkhtmltopdf PDF engine. - - phantom: use the PhantomJS PDF engine. - - weazyprint: use the WeazyPrint PDF engine. + Specify the PDF engine to use. Legal values are + 'none', 'wkhtmltopdf', 'phantom', or 'weasyprint'. **--no-escape** @@ -64,6 +60,10 @@ Options: Include resume fields marked as private. -The BUILD command generates themed resumes and CVs in -multiple formats from a single source of truth in the form -of a FRESH or JSON Resume document. +Notes: + +The BUILD command can be run against multiple source as well +as multiple target resumes. If multiple source resumes are +provided, they will be merged into a single source resume +before generation. If multiple output resumes are provided, +each will be generated in turn. diff --git a/dist/cli/help/convert.txt b/dist/cli/help/convert.txt index dd6092b..1a065d6 100644 --- a/dist/cli/help/convert.txt +++ b/dist/cli/help/convert.txt @@ -2,20 +2,22 @@ Usage: - hackmyresume CONVERT TO [] + **hackmyresume CONVERT TO [--format]** + + The CONVERT command converts one or more resume documents + between the FRESH Resume Schema and JSON Resume formats. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents (*.json), separated by spaces. + Path to a FRESH or JRS resume. Multiple resumes can be + specified. - **** + **** - The desired absolute or relative path(s) of the newly - converted resume(s). HackMyResume will create the - converted resume(s) here. + The path of the converted resume. Multiple resumes can + be specified, one per provided input resume. Options: @@ -29,6 +31,3 @@ Options: will be inferred from the source resume's format. If the source format is FRESH, the destination format will be JSON Resume, and vice-versa. - -The CONVERT command converts one or more resume documents -between FRESH and JSON Resume formats. diff --git a/dist/cli/help/help.txt b/dist/cli/help/help.txt index f259bba..9b11cf3 100644 --- a/dist/cli/help/help.txt +++ b/dist/cli/help/help.txt @@ -2,7 +2,10 @@ Usage: - hackmyresume HELP + **hackmyresume HELP []** + + The HELP command displays help information for a specific + HackMyResume command, including the HELP command itself. Parameters: @@ -18,6 +21,3 @@ Parameters: Options: **None.** - -The HELP command displays help information for a specific -HackMyResume command, including the HELP command itself. diff --git a/dist/cli/help/new.txt b/dist/cli/help/new.txt index 0d7f05e..9487793 100644 --- a/dist/cli/help/new.txt +++ b/dist/cli/help/new.txt @@ -2,16 +2,23 @@ Usage: - hackmyresume NEW [] + **hackmyresume NEW [--format]** + + The NEW command generates a new resume document in FRESH + or JSON Resume format. This document can serve as an + official source of truth for your resume and career data + as well an input to tools like HackMyResume. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents (*.json), separated by spaces: + The filename (relative or absolute path) of the resume + to be created. Multiple resume paths can be specified, + and each will be created in turn. - hackmyresume NEW r1.json r2.json r3.json + hackmyresume NEW resume.json + hackmyresume NEW r1.json foo/r2.json ../r3.json Options: @@ -20,8 +27,3 @@ Options: The desired format for the new resume(s). Valid values are 'FRESH', 'JRS', or, to target the latest edge version of the JSON Resume Schema, 'JRS@1'. - -The NEW command generates one or more new resumes in FRESH -or JSON Resume format. This document can serve as a source -of truth for resume and career data and an input to tools -like HackMyResume or resume-cli. diff --git a/dist/cli/help/peek.txt b/dist/cli/help/peek.txt index 576b42e..81fe6ac 100644 --- a/dist/cli/help/peek.txt +++ b/dist/cli/help/peek.txt @@ -2,29 +2,30 @@ Usage: - hackmyresume PEEK [] + **hackmyresume PEEK ** + + The PEEK command displays a specific piece or part of the + resume without requiring the resume to be opened in an + editor. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents to be validated. Multiple resumes - can be specified, separated by spaces: + Path to a FRESH or JRS resume. Multiple resumes can be + specified, separated by spaces. - hackmyresume PEEK r1.json r2.json r3.json + hackmyresume PEEK r1.json r2.json r3.json "employment.history[2]" - **** + **** - The part of the resume to peek at. + The resume property or field to be displayed. Can be + any valid resume path, for example: + + education[0] + info.name + employment.history[3].start Options: - **--assert -a** - - Tell HackMyResume to return a non-zero process exit - code if a resume fails to validate. - -The PEEK command displays a specific piece or part of the -resume without requiring the resume to be opened in an -editor. + **None.** diff --git a/dist/cli/help/use.txt b/dist/cli/help/use.txt index 760cf9d..8ece4fc 100644 --- a/dist/cli/help/use.txt +++ b/dist/cli/help/use.txt @@ -1,48 +1,70 @@ -**HackMyResume** | A Swiss Army knife for resumes and CVs. +**HackMyResume** | A Swiss Army knife for resumes and CVs Usage: - hackmyresume [] + **hackmyresume [--version] [--help] [--silent] [--debug]** + **[--options] [--no-colors] []** -Available commands (type "hackmyresume help COMMAND" for details): +Commands: (type "hackmyresume help COMMAND" for details) - **BUILD** Build your resume to the destination format(s). - **ANALYZE** Analyze your resume for keywords, gaps, and metrics. - **VALIDATE** Validate your resume for errors and typos. - **NEW** Create a new resume in FRESH or JSON Resume format. - **CONVERT** Convert your resume between FRESH and JSON Resume. - **PEEK** View a specific field or element on your resume. - **HELP** View help on a specific HackMyResume command. + **BUILD** Build your resume to the destination format(s). + **ANALYZE** Analyze your resume for keywords, gaps, and metrics. + **VALIDATE** Validate your resume for errors and typos. + **NEW** Create a new resume in FRESH or JSON Resume format. + **CONVERT** Convert your resume between FRESH and JSON Resume. + **PEEK** View a specific field or element on your resume. + **HELP** View help on a specific HackMyResume command. -Available options: +Common Tasks: - **--options -o** Load options from an external JSON file. - **--debug -d** Emit extended debugging info. - **--assert -a** Treat resume validation warnings as errors. - **--no-colors** Disable terminal colors. - **--tips** Display theme messages and tips. - **--help -h** Display help documentation. - **--version -v** Display the current version. + Generate a resume in a specific format (HTML, Word, PDF, etc.) -Examples: + **hackmyresume build rez.json to out/rez.html** + **hackmyresume build rez.json to out/rez.doc** + **hackmyresume build rez.json to out/rez.pdf** + **hackmyresume build rez.json to out/rez.txt** + **hackmyresume build rez.json to out/rez.md** + **hackmyresume build rez.json to out/rez.png** + **hackmyresume build rez.json to out/rez.tex** - hackmyresume BUILD resume.json TO out/resume.all --theme modern - hackmyresume ANALYZE resume.json - hackmyresume NEW my-new-resume.json --format JRS - hackmyresume CONVERT resume-fresh.json TO resume-jrs.json - hackmyresume VALIDATE resume.json - hackmyresume PEEK resume.json employment[2].summary + Build a resume to ALL available formats: -Tips: + **hackmyresume build rez.json to out/rez.all** - - You can specify multiple sources and/or targets for all commands. - - You can use any FRESH or JSON Resume theme with HackMyResume. - - Specify a file extension of .all to generate your resume to all - available formats supported by the theme. (BUILD command.) - - The --theme parameter can specify either the name of a preinstalled - theme, or the path to a local FRESH or JSON Resume theme. - - Visit https://www.npmjs.com/search?q=jsonresume-theme for a full - listing of all available JSON Resume themes. - - Visit https://github.com/fresh-standard/fresh-themes for a complete - listing of all available FRESH themes. - - Report bugs to https://githut.com/hacksalot/HackMyResume/issues. + Build a resume with a specific theme: + + **hackmyresume build rez.json to out/rez.all -t themeName** + + Create a new empty resume: + + **hackmyresume new rez.json** + + Convert a resume between FRESH and JRS formats: + + **hackmyresume convert rez.json converted.json** + + Analyze a resume for important metrics + + **hackmyresume analyze rez.json** + + Find more resume themes: + + **https://www.npmjs.com/search?q=jsonresume-theme** + **https://www.npmjs.com/search?q=fresh-theme** + **https://github.com/fresh-standard/fresh-themes** + + Validate a resume's structure and syntax: + + **hackmyresume validate resume.json** + + View help on a specific command: + + **hackmyresume help [build|convert|new|analyze|validate|peek|help]** + + Submit a bug or request: + + **https://githut.com/hacksalot/HackMyResume/issues** + +HackMyResume is free and open source software published +under the MIT license. For more information, visit the +HackMyResume website or GitHub project page. diff --git a/dist/cli/help/validate.txt b/dist/cli/help/validate.txt index 08a062e..9bc1289 100644 --- a/dist/cli/help/validate.txt +++ b/dist/cli/help/validate.txt @@ -1,18 +1,21 @@ -**validate** - Validate a resume for correctness +**validate** | Validate a resume for correctness Usage: - hackmyresume VALIDATE [] - hackmyresume VALIDATE [] + **hackmyresume VALIDATE [--assert]** + + The VALIDATE command validates a FRESH or JRS document + against its governing schema, verifying that the resume + is correctly structured and formatted. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents to be validated. Multiple resumes - can be specified, separated by spaces: + Path to a FRESH or JRS resume. Multiple resumes can be + specified. + hackmyresume ANALYZE resume.json hackmyresume ANALYZE r1.json r2.json r3.json Options: @@ -21,7 +24,3 @@ Options: Tell HackMyResume to return a non-zero process exit code if a resume fails to validate. - -The VALIDATE command validates a FRESH or JSON Resume -document against its governing schema, verifying that the -resume is correctly structured. diff --git a/dist/cli/main.js b/dist/cli/main.js index 6072e3d..202936d 100644 --- a/dist/cli/main.js +++ b/dist/cli/main.js @@ -151,7 +151,8 @@ Definition of the `main` function. Command.prototype.missingArgument = function(name) { if (this.name() !== 'help') { _err.err({ - fluenterror: this.name() !== 'new' ? HMSTATUS.resumeNotFound : HMSTATUS.createNameMissing + verb: this.name(), + fluenterror: HMSTATUS.resumeNotFound }, true); } }; @@ -328,6 +329,7 @@ Definition of the `main` function. if (params.length === 0) { throw { fluenterror: HMSTATUS.resumeNotFound, + verb: this.name(), quit: true }; } diff --git a/src/cli/error.coffee b/src/cli/error.coffee index 1112120..4fb8e39 100644 --- a/src/cli/error.coffee +++ b/src/cli/error.coffee @@ -110,17 +110,19 @@ assembleError = ( ex ) -> quit = false when HMSTATUS.resumeNotFound - msg = M2C( this.msgs.resumeNotFound.msg, 'yellow' ); + #msg = M2C( this.msgs.resumeNotFound.msg, 'yellow' ); + msg += M2C(FS.readFileSync( + PATH.resolve(__dirname, 'help/' + ex.verb + '.txt'), 'utf8' ), 'white', 'yellow') when HMSTATUS.missingCommand - msg = M2C( this.msgs.missingCommand.msg + " (", 'yellow'); - msg += Object.keys( FCMD.verbs ).map( (v, idx, ar) -> - return ( if idx == ar.length - 1 then chalk.yellow('or ') else '') + - chalk.yellow.bold(v.toUpperCase()); - ).join( chalk.yellow(', ')) + chalk.yellow(").\n\n"); + # msg = M2C( this.msgs.missingCommand.msg + " (", 'yellow'); + # msg += Object.keys( FCMD.verbs ).map( (v, idx, ar) -> + # return ( if idx == ar.length - 1 then chalk.yellow('or ') else '') + + # chalk.yellow.bold(v.toUpperCase()); + # ).join( chalk.yellow(', ')) + chalk.yellow(").\n\n"); - msg += chalk.gray(FS.readFileSync( - PATH.resolve(__dirname, '../cli/use.txt'), 'utf8' )) + msg += M2C(FS.readFileSync( + PATH.resolve(__dirname, 'help/use.txt'), 'utf8' ), 'white', 'yellow') when HMSTATUS.invalidCommand msg = printf( M2C( this.msgs.invalidCommand.msg, 'yellow'), ex.attempted ) diff --git a/src/cli/help/analyze.txt b/src/cli/help/analyze.txt index 5635f16..8e7187e 100644 --- a/src/cli/help/analyze.txt +++ b/src/cli/help/analyze.txt @@ -1,23 +1,25 @@ -**analyze** | Analyze a FRESH resume document for statistics +**analyze** | Analyze a resume for statistical insight Usage: - hackmyresume ANALYZE [] - hackmyresume ANALYZE [] + **hackmyresume ANALYZE ** + + The ANALYZE command evaluates the specified resume(s) for + coverage, duration, gaps, keywords, and other metrics. + + This command can be run against multiple resumes. Each + will be analyzed in turn. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents to be analyzed. Multiple resumes - can be specified, separated by spaces: + Path to a FRESH or JRS resume. Multiple resumes can be + specified, separated by spaces. - hackmyresume ANALYZE r1.json r2.json r3.json + hackmyresume ANALYZE resume.json + hackmyresume ANALYZE r1.json r2.json r3.json Options: **None.** - -The ANALYZE command performs simple analysis on a FRESH or -JSON Resume document. diff --git a/src/cli/help/build.txt b/src/cli/help/build.txt index e572f5c..6a1d228 100644 --- a/src/cli/help/build.txt +++ b/src/cli/help/build.txt @@ -1,28 +1,29 @@ -**build** | Generate resumes in supported output formats +**build** | Generate themed resumes in multiple formats Usage: - hackmyresume BUILD TO [] + **hackmyresume BUILD TO [--theme]** + **[--pdf] [--no-escape] [--private]** + + The BUILD command generates themed resumes and CVs in + multiple formats. Use it to create outbound resumes in + specific formats such HTML, MS Word, and PDF. Parameters: - **** + **** - Absolute or relative path(s) to one or more resumes in - FRESH or JSON format, separated by spaces. If multiple - resumes are specified, they will be merged into a - single resume prior to transformation. + Path to a FRESH or JRS resume (*.json) containing your + resume data. Multiple resumes may be specified. - hackmyresume BUILD resume.json output.all - hackmyresume BUILD base.json developer.json gamedev.json TO out/resume.all + If multiple resumes are specified, they will be merged + into a single resume prior to transformation. - **** + **** - Absolute or relative path(s) to one or more outbound - resume(s), separated by spaces. If multiple output - resumes are specified, all of them will be generated. - The desired format of each resume will be determined - from the file extension: + Path to the desired output resume. Multiple resumes + may be specified. The file extension will determine + the format. .all Generate all supported formats .html HTML 5 @@ -33,27 +34,22 @@ Parameters: .png PNG Image .latex LaTeX - Note: not all formats are supported by all themes. - Check the theme's documentation for details. + Note: not all formats are supported by all themes! + Check the theme's documentation for details or use + the .all extension to build all available formats. Options: **--theme -t ** - Relative or absolute path to a FRESH or JSON Resume - theme, or the name of a built-in theme. - - As of 1.9.0, the following built-in themes are - provided: basis, modern, positive, compact, awesome. + Path to a FRESH or JSON Resume theme OR the name of a + built-in theme. Valid theme names are 'modern', + 'positive', 'compact', 'awesome', and 'basis'. **--pdf -p ** - Specify the PDF engine to use. Legal values are: - - - none: Don't generate a PDF. - - wkhtmltopdf: Use the wkhtmltopdf PDF engine. - - phantom: use the PhantomJS PDF engine. - - weazyprint: use the WeazyPrint PDF engine. + Specify the PDF engine to use. Legal values are + 'none', 'wkhtmltopdf', 'phantom', or 'weasyprint'. **--no-escape** @@ -64,6 +60,10 @@ Options: Include resume fields marked as private. -The BUILD command generates themed resumes and CVs in -multiple formats from a single source of truth in the form -of a FRESH or JSON Resume document. +Notes: + +The BUILD command can be run against multiple source as well +as multiple target resumes. If multiple source resumes are +provided, they will be merged into a single source resume +before generation. If multiple output resumes are provided, +each will be generated in turn. diff --git a/src/cli/help/convert.txt b/src/cli/help/convert.txt index dd6092b..1a065d6 100644 --- a/src/cli/help/convert.txt +++ b/src/cli/help/convert.txt @@ -2,20 +2,22 @@ Usage: - hackmyresume CONVERT TO [] + **hackmyresume CONVERT TO [--format]** + + The CONVERT command converts one or more resume documents + between the FRESH Resume Schema and JSON Resume formats. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents (*.json), separated by spaces. + Path to a FRESH or JRS resume. Multiple resumes can be + specified. - **** + **** - The desired absolute or relative path(s) of the newly - converted resume(s). HackMyResume will create the - converted resume(s) here. + The path of the converted resume. Multiple resumes can + be specified, one per provided input resume. Options: @@ -29,6 +31,3 @@ Options: will be inferred from the source resume's format. If the source format is FRESH, the destination format will be JSON Resume, and vice-versa. - -The CONVERT command converts one or more resume documents -between FRESH and JSON Resume formats. diff --git a/src/cli/help/help.txt b/src/cli/help/help.txt index f259bba..9b11cf3 100644 --- a/src/cli/help/help.txt +++ b/src/cli/help/help.txt @@ -2,7 +2,10 @@ Usage: - hackmyresume HELP + **hackmyresume HELP []** + + The HELP command displays help information for a specific + HackMyResume command, including the HELP command itself. Parameters: @@ -18,6 +21,3 @@ Parameters: Options: **None.** - -The HELP command displays help information for a specific -HackMyResume command, including the HELP command itself. diff --git a/src/cli/help/new.txt b/src/cli/help/new.txt index 0d7f05e..9487793 100644 --- a/src/cli/help/new.txt +++ b/src/cli/help/new.txt @@ -2,16 +2,23 @@ Usage: - hackmyresume NEW [] + **hackmyresume NEW [--format]** + + The NEW command generates a new resume document in FRESH + or JSON Resume format. This document can serve as an + official source of truth for your resume and career data + as well an input to tools like HackMyResume. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents (*.json), separated by spaces: + The filename (relative or absolute path) of the resume + to be created. Multiple resume paths can be specified, + and each will be created in turn. - hackmyresume NEW r1.json r2.json r3.json + hackmyresume NEW resume.json + hackmyresume NEW r1.json foo/r2.json ../r3.json Options: @@ -20,8 +27,3 @@ Options: The desired format for the new resume(s). Valid values are 'FRESH', 'JRS', or, to target the latest edge version of the JSON Resume Schema, 'JRS@1'. - -The NEW command generates one or more new resumes in FRESH -or JSON Resume format. This document can serve as a source -of truth for resume and career data and an input to tools -like HackMyResume or resume-cli. diff --git a/src/cli/help/peek.txt b/src/cli/help/peek.txt index 576b42e..81fe6ac 100644 --- a/src/cli/help/peek.txt +++ b/src/cli/help/peek.txt @@ -2,29 +2,30 @@ Usage: - hackmyresume PEEK [] + **hackmyresume PEEK ** + + The PEEK command displays a specific piece or part of the + resume without requiring the resume to be opened in an + editor. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents to be validated. Multiple resumes - can be specified, separated by spaces: + Path to a FRESH or JRS resume. Multiple resumes can be + specified, separated by spaces. - hackmyresume PEEK r1.json r2.json r3.json + hackmyresume PEEK r1.json r2.json r3.json "employment.history[2]" - **** + **** - The part of the resume to peek at. + The resume property or field to be displayed. Can be + any valid resume path, for example: + + education[0] + info.name + employment.history[3].start Options: - **--assert -a** - - Tell HackMyResume to return a non-zero process exit - code if a resume fails to validate. - -The PEEK command displays a specific piece or part of the -resume without requiring the resume to be opened in an -editor. + **None.** diff --git a/src/cli/help/use.txt b/src/cli/help/use.txt index 760cf9d..8ece4fc 100644 --- a/src/cli/help/use.txt +++ b/src/cli/help/use.txt @@ -1,48 +1,70 @@ -**HackMyResume** | A Swiss Army knife for resumes and CVs. +**HackMyResume** | A Swiss Army knife for resumes and CVs Usage: - hackmyresume [] + **hackmyresume [--version] [--help] [--silent] [--debug]** + **[--options] [--no-colors] []** -Available commands (type "hackmyresume help COMMAND" for details): +Commands: (type "hackmyresume help COMMAND" for details) - **BUILD** Build your resume to the destination format(s). - **ANALYZE** Analyze your resume for keywords, gaps, and metrics. - **VALIDATE** Validate your resume for errors and typos. - **NEW** Create a new resume in FRESH or JSON Resume format. - **CONVERT** Convert your resume between FRESH and JSON Resume. - **PEEK** View a specific field or element on your resume. - **HELP** View help on a specific HackMyResume command. + **BUILD** Build your resume to the destination format(s). + **ANALYZE** Analyze your resume for keywords, gaps, and metrics. + **VALIDATE** Validate your resume for errors and typos. + **NEW** Create a new resume in FRESH or JSON Resume format. + **CONVERT** Convert your resume between FRESH and JSON Resume. + **PEEK** View a specific field or element on your resume. + **HELP** View help on a specific HackMyResume command. -Available options: +Common Tasks: - **--options -o** Load options from an external JSON file. - **--debug -d** Emit extended debugging info. - **--assert -a** Treat resume validation warnings as errors. - **--no-colors** Disable terminal colors. - **--tips** Display theme messages and tips. - **--help -h** Display help documentation. - **--version -v** Display the current version. + Generate a resume in a specific format (HTML, Word, PDF, etc.) -Examples: + **hackmyresume build rez.json to out/rez.html** + **hackmyresume build rez.json to out/rez.doc** + **hackmyresume build rez.json to out/rez.pdf** + **hackmyresume build rez.json to out/rez.txt** + **hackmyresume build rez.json to out/rez.md** + **hackmyresume build rez.json to out/rez.png** + **hackmyresume build rez.json to out/rez.tex** - hackmyresume BUILD resume.json TO out/resume.all --theme modern - hackmyresume ANALYZE resume.json - hackmyresume NEW my-new-resume.json --format JRS - hackmyresume CONVERT resume-fresh.json TO resume-jrs.json - hackmyresume VALIDATE resume.json - hackmyresume PEEK resume.json employment[2].summary + Build a resume to ALL available formats: -Tips: + **hackmyresume build rez.json to out/rez.all** - - You can specify multiple sources and/or targets for all commands. - - You can use any FRESH or JSON Resume theme with HackMyResume. - - Specify a file extension of .all to generate your resume to all - available formats supported by the theme. (BUILD command.) - - The --theme parameter can specify either the name of a preinstalled - theme, or the path to a local FRESH or JSON Resume theme. - - Visit https://www.npmjs.com/search?q=jsonresume-theme for a full - listing of all available JSON Resume themes. - - Visit https://github.com/fresh-standard/fresh-themes for a complete - listing of all available FRESH themes. - - Report bugs to https://githut.com/hacksalot/HackMyResume/issues. + Build a resume with a specific theme: + + **hackmyresume build rez.json to out/rez.all -t themeName** + + Create a new empty resume: + + **hackmyresume new rez.json** + + Convert a resume between FRESH and JRS formats: + + **hackmyresume convert rez.json converted.json** + + Analyze a resume for important metrics + + **hackmyresume analyze rez.json** + + Find more resume themes: + + **https://www.npmjs.com/search?q=jsonresume-theme** + **https://www.npmjs.com/search?q=fresh-theme** + **https://github.com/fresh-standard/fresh-themes** + + Validate a resume's structure and syntax: + + **hackmyresume validate resume.json** + + View help on a specific command: + + **hackmyresume help [build|convert|new|analyze|validate|peek|help]** + + Submit a bug or request: + + **https://githut.com/hacksalot/HackMyResume/issues** + +HackMyResume is free and open source software published +under the MIT license. For more information, visit the +HackMyResume website or GitHub project page. diff --git a/src/cli/help/validate.txt b/src/cli/help/validate.txt index 08a062e..9bc1289 100644 --- a/src/cli/help/validate.txt +++ b/src/cli/help/validate.txt @@ -1,18 +1,21 @@ -**validate** - Validate a resume for correctness +**validate** | Validate a resume for correctness Usage: - hackmyresume VALIDATE [] - hackmyresume VALIDATE [] + **hackmyresume VALIDATE [--assert]** + + The VALIDATE command validates a FRESH or JRS document + against its governing schema, verifying that the resume + is correctly structured and formatted. Parameters: - **** + **** - Absolute or relative path(s) to one or more FRESH or - JSON Resume documents to be validated. Multiple resumes - can be specified, separated by spaces: + Path to a FRESH or JRS resume. Multiple resumes can be + specified. + hackmyresume ANALYZE resume.json hackmyresume ANALYZE r1.json r2.json r3.json Options: @@ -21,7 +24,3 @@ Options: Tell HackMyResume to return a non-zero process exit code if a resume fails to validate. - -The VALIDATE command validates a FRESH or JSON Resume -document against its governing schema, verifying that the -resume is correctly structured. diff --git a/src/cli/main.coffee b/src/cli/main.coffee index ffe7a65..9ab07a2 100644 --- a/src/cli/main.coffee +++ b/src/cli/main.coffee @@ -191,10 +191,8 @@ initialize = ( ar, exitCallback ) -> Command.prototype.missingArgument = (name) -> if this.name() != 'help' _err.err - fluenterror: - if this.name() != 'new' - then HMSTATUS.resumeNotFound - else HMSTATUS.createNameMissing + verb: @name() + fluenterror: HMSTATUS.resumeNotFound , true return @@ -363,7 +361,8 @@ splitSrcDest = () -> params = this.parent.args.filter((j) -> return String.is(j) ) if params.length == 0 - throw { fluenterror: HMSTATUS.resumeNotFound, quit: true } + #tmpName = @name() + throw { fluenterror: HMSTATUS.resumeNotFound, verb: @name(), quit: true } # Find the TO keyword, if any splitAt = _.findIndex( params, (p) -> return p.toLowerCase() == 'to'; ) diff --git a/test/scripts/test-hmr.txt b/test/scripts/test-hmr.txt index 4237e47..10d403b 100644 --- a/test/scripts/test-hmr.txt +++ b/test/scripts/test-hmr.txt @@ -4,7 +4,7 @@ 4|--debug 4|-d 5|notacommand -8|new +3|new 0|new test/sandbox/cli-test/new-empty-resume.auto.json 0|new test/sandbox/cli-test/new-empty-resume.jrs.json -f jrs 0|new test/sandbox/cli-test/new-empty-resume.fresh.json -f fresh diff --git a/test/scripts/test-output.js b/test/scripts/test-output.js index 75fbdb0..1a4024d 100644 --- a/test/scripts/test-output.js +++ b/test/scripts/test-output.js @@ -84,19 +84,23 @@ describe('Testing Ouput interface', function () { var title = '*** HackMyResume v' + PKG.version + ' ***'; var feedMe = 'Please feed me a resume in FRESH or JSON Resume format.'; - var manPage = FS.readFileSync( PATH.resolve( __dirname, '../../src/cli/use.txt' ), 'utf8'); + var manPage = FS.readFileSync( PATH.resolve( __dirname, '../../src/cli/help/use.txt' ), 'utf8').replace(/\*\*/g, ''); + var manPages = { }; + ['build','new','convert','analyze','validate','peek'].forEach( function(verb) { + manPages[verb] = FS.readFileSync( PATH.resolve( __dirname, '../../src/cli/help/' + verb + '.txt' ), 'utf8').replace(/\*\*/g, ''); + }); - run('HMR should output a help string when no command is specified', - [], [ title, 'Please give me a command (BUILD, ANALYZE, VALIDATE, CONVERT, NEW, or PEEK).' ]); + // run('HMR should output a help string when no command is specified', + // [], [ title, 'Please give me a command (BUILD, ANALYZE, VALIDATE, CONVERT, NEW, or PEEK).' ]); - run('BUILD should output a tip when no source is specified', - ['build'], [ title, feedMe ]); + run('BUILD should output a help message when no source is specified', + ['build'], [ title, manPages.build ]); - run('VALIDATE should output a tip when no source is specified', - ['validate'], [ title, feedMe ]); + run('VALIDATE should output a help message when no source is specified', + ['validate'], [ title, manPages.validate ]); - run('ANALYZE should output a tip when no source is specified', - ['analyze'], [ title, feedMe ]); + run('ANALYZE should output a help message when no source is specified', + ['analyze'], [ title, manPages.analyze ]); run('BUILD should display an error on a broken resume', ['build', @@ -104,11 +108,11 @@ describe('Testing Ouput interface', function () { '-t', 'modern' ], [ title, 'Error: Invalid or corrupt JSON on line' ]); - run('CONVERT should output a tip when no source is specified', - ['convert'], [ title, feedMe ]); + run('CONVERT should output a help message when no source is specified', + ['convert'], [ title, manPages.convert ]); - run('NEW should output a tip when no source is specified', - ['new'], [ title, 'Please specify the filename of the resume to create.' ]); + run('NEW should output a help message when no source is specified', + ['new'], [ title, manPages.new ]); // This will cause the HELP doc to be emitted, followed by an "unknown option --help" // error in the log, based on the way we're calling into HMR. As long as the test