From 14dbda2dcf967da4068727e588a06a678a4804fb Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Thu, 10 Mar 2022 00:19:41 +0000 Subject: [PATCH] chore: build cli --- bin/showdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/showdown.js b/bin/showdown.js index 9ef2e52..84b07f9 100644 --- a/bin/showdown.js +++ b/bin/showdown.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -var showdown,version,fs=require("fs"),path=require("path"),Command=require("commander").Command,program=new Command,path1=path.resolve(__dirname+"/../dist/showdown.js"),path2=path.resolve(__dirname+"/../../.build/showdown.js");function Messenger(o,t,e){"use strict";t=!!t||!!e,e=!!e,this._print="stdout"===(o=o||"stderr")?console.log:console.error,this.errorExit=function(o){e||(console.error("ERROR: "+o.message),console.error("Run 'showdown -h' for help")),process.exit(1)},this.okExit=function(){e||(this._print("\n"),this._print("DONE!")),process.exit(0)},this.printMsg=function(o){t||e||!o||this._print(o)},this.printError=function(o){e||console.error(o)}}function showShowdownOptions(){"use strict";var o,t=showdown.getDefaultOptions(!1);for(o in console.log("\nshowdown makehtml config options:"),t)t.hasOwnProperty(o)&&console.log(" "+o+":","[default="+t[o].defaultValue+"]",t[o].describe);console.log('\n\nExample: showdown makehtml -c openLinksInNewWindow ghMentions ghMentionsLink="https://google.com"')}function parseShowdownOptions(o,t){"use strict";var e=t;if(o)for(var n=0;n [options]").option("-q, --quiet","Quiet mode. Only print errors").option("-m, --mute","Mute mode. Does not print anything"),program.command("makehtml").description("Converts markdown into html").addHelpText("after","\n\nExamples:").addHelpText("after"," showdown makehtml -i Reads from stdin and outputs to stdout").addHelpText("after"," showdown makehtml -i foo.md -o bar.html Reads 'foo.md' and writes to 'bar.html'").addHelpText("after",' showdown makehtml -i --flavor="github" Parses stdin using GFM style').addHelpText("after","\nNote for windows users:").addHelpText("after","When reading from stdin, use option -u to set the proper encoding or run `chcp 65001` prior to calling showdown cli to set the command line to utf-8").option("-i, --input [file]","Input source. Usually a md file. If omitted or empty, reads from stdin. Windows users see note below.",!0).option("-o, --output [file]","Output target. Usually a html file. If omitted or empty, writes to stdout",!0).option("-u, --encoding ","Sets the input encoding","utf8").option("-y, --output-encoding ","Sets the output encoding","utf8").option("-a, --append","Append data to output instead of overwriting. Ignored if writing to stdout",!1).option("-e, --extensions ","Load the specified extensions. Should be valid paths to node compatible extensions").option("-p, --flavor ","Run with a predetermined flavor of options. Default is vanilla","vanilla").option("-c, --config ","Enables showdown makehtml parser config options. Overrides flavor").option("--config-help","Shows configuration options for showdown parser").action(makehtmlCommand),program.parse(); \ No newline at end of file +var showdown,version,fs=require("fs"),path=require("path"),Command=require("commander").Command,program=new Command,path1=path.resolve(__dirname+"/../dist/showdown.js"),path2=path.resolve(__dirname+"/../../.build/showdown.js");function Messenger(o,t,e){"use strict";t=!!t||!!e,e=!!e,this._print="stdout"===(o=o||"stderr")?console.log:console.error,this.errorExit=function(o){e||(console.error("ERROR: "+o.message),console.error("Run 'showdown -h' for help")),process.exit(1)},this.okExit=function(){e||(this._print("\n"),this._print("DONE!")),process.exit(0)},this.printMsg=function(o){t||e||!o||this._print(o)},this.printError=function(o){e||console.error(o)}}function showShowdownOptions(){"use strict";var o,t=showdown.getDefaultOptions(!1);for(o in console.log("\nshowdown makehtml config options:"),t)t.hasOwnProperty(o)&&console.log(" "+o+":","[default="+t[o].defaultValue+"]",t[o].describe);console.log('\n\nExample: showdown makehtml -c openLinksInNewWindow ghMentions ghMentionsLink="https://google.com"')}function parseShowdownOptions(o,t){"use strict";var e=t;if(o)for(var n=0;n [options]").option("-q, --quiet","Quiet mode. Only print errors").option("-m, --mute","Mute mode. Does not print anything"),program.command("makehtml").description("Converts markdown into html").addHelpText("after","\n\nExamples:").addHelpText("after"," showdown makehtml -i Reads from stdin and outputs to stdout").addHelpText("after"," showdown makehtml -i foo.md -o bar.html Reads 'foo.md' and writes to 'bar.html'").addHelpText("after",' showdown makehtml -i --flavor="github" Parses stdin using GFM style').addHelpText("after","\nNote for windows users:").addHelpText("after","When reading from stdin, use option -u to set the proper encoding or run `chcp 65001` prior to calling showdown cli to set the command line to utf-8").option("-i, --input [file]","Input source. Usually a md file. If omitted or empty, reads from stdin. Windows users see note below.",!0).option("-o, --output [file]","Output target. Usually a html file. If omitted or empty, writes to stdout",!0).option("-u, --encoding ","Sets the input encoding","utf8").option("-y, --output-encoding ","Sets the output encoding","utf8").option("-a, --append","Append data to output instead of overwriting. Ignored if writing to stdout",!1).option("-e, --extensions ","Load the specified extensions. Should be valid paths to node compatible extensions").option("-p, --flavor ","Run with a predetermined flavor of options. Default is vanilla","vanilla").option("-c, --config ","Enables showdown makehtml parser config options. Overrides flavor").option("--config-help","Shows configuration options for showdown parser").action(makehtmlCommand),program.parse(); \ No newline at end of file