Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bin command template

uupaa edited this pageSep 7, 2016 ·2 revisions
#!/usr/bin/env node(function(global){varUSAGE=_multiline(function(){/*    Usage:        node bin/<<REPOSITORY_NAME>>.js [-h or --help]                        [-v or --verbose]                        [--output output-file]                        input-file [input-file ...]    See:        https://github.com/${GITHUB_USER_NAME}/${REPOSITORY_FULLNAME}/wiki/${REPOSITORY_NAME}*/});varCONSOLE_COLOR={RED:"\u001b[31m",YELLOW:"\u001b[33m",GREEN:"\u001b[32m",CLEAR:"\u001b[0m"};var<<REPOSITORY_NAME>>=require("../lib/<<REPOSITORY_NAME>>");varfs=require("fs");varcp=require("child_process");varwmlib=process.argv[1].split("/").slice(0,-2).join("/")+"/lib/";// "WebModule/lib/"varTask=require(wmlib+"Task.js");varargv=process.argv.slice(2);varoptions=_parseCommandLineOptions({help:false,// Boolean: show help.verbose:false,// Boolean: verbose mode.output:"a.out",// String: output file.inputs:[]// StringArray: input files. [file, ...]});if(options.help){console.log(CONSOLE_COLOR.YELLOW+USAGE+CONSOLE_COLOR.CLEAR);return;}if(options.verbose){}/*<<REPOSITORY_NAME>>({    "verbose":      options.verbose,    "output":       options.output,    "inputs":       options.inputs,}, function(err) {    //}); */function_parseCommandLineOptions(options){//@arg Object://@ret Object:for(vari=0,iz=argv.length;i<iz;++i){switch(argv[i]){case"-h":case"--help":options.help=true;break;case"-v":case"--verbose":options.verbose=true;break;case"--output":options.output=argv[++i];break;default:varfile=argv[i];if(options.inputs.indexOf(file)<0){// avoid duplicateoptions.inputs.push(file);}}}returnoptions;}function_multiline(fn){//@arg Function://@ret String:return(fn+"").split("\n").slice(1,-1).join("\n");}})(GLOBAL);
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp