CLI formatting

This commit is contained in:
sanex3339
2016-12-09 23:30:08 +03:00
parent 1e7628b983
commit f22102606d
2 changed files with 347 additions and 280 deletions
+86 -18
View File
@@ -146,29 +146,97 @@ export class JavaScriptObfuscatorCLI {
this.commands = new commander.Command()
.version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version')
.usage('<inputPath> [options]')
.option('-o, --output <path>', 'Output path for obfuscated code')
.option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean)
.option('--controlFlowFlattening <boolean>', 'Enables control flow flattening', JavaScriptObfuscatorCLI.parseBoolean)
.option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean)
.option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean)
.option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean)
.option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
.option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
.option('--rotateStringArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean)
.option('--seed <number>', 'Sets seed for random generator. This is useful for creating repeatable results.', parseFloat)
.option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean)
.option('--sourceMap <boolean>', 'Enables source map generation', JavaScriptObfuscatorCLI.parseBoolean)
.option('--sourceMapBaseUrl <string>', 'Sets base url to the source map import url when `--sourceMapMode=separate`')
.option('--sourceMapFileName <string>', 'Sets file name for output source map when `--sourceMapMode=separate`')
.option(
'-o, --output <path>',
'Output path for obfuscated code'
)
.option(
'--compact <boolean>',
'Disable one line output code compacting',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--controlFlowFlattening <boolean>',
'Enables control flow flattening',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--debugProtection <boolean>',
'Disable browser Debug panel (can cause DevTools enabled browser freeze)',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--debugProtectionInterval <boolean>',
'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--disableConsoleOutput <boolean>',
'Allow console.log, console.info, console.error and console.warn messages output into browser console',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--domainLock <list>',
'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)',
(val: string) => val.split(',')
)
.option(
'--reservedNames <list>',
'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)',
(val: string) => val.split(',')
)
.option(
'--rotateStringArray <boolean>', 'Disable rotation of unicode array values during obfuscation',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--seed <number>',
'Sets seed for random generator. This is useful for creating repeatable results.',
parseFloat
)
.option(
'--selfDefending <boolean>',
'Disables self-defending for obfuscated code',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--sourceMap <boolean>',
'Enables source map generation',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--sourceMapBaseUrl <string>',
'Sets base url to the source map import url when `--sourceMapMode=separate`'
)
.option(
'--sourceMapFileName <string>',
'Sets file name for output source map when `--sourceMapMode=separate`'
)
.option(
'--sourceMapMode <string> [inline, separate]',
'Specify source map output mode',
JavaScriptObfuscatorCLI.parseSourceMapMode
)
.option('--stringArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean)
.option('--stringArrayEncoding <boolean|string> [true, false, base64, rc4]', 'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed', JavaScriptObfuscatorCLI.parseStringArrayEncoding)
.option('--stringArrayThreshold <number>', 'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)', parseFloat)
.option('--unicodeEscapeSequence <boolean>', 'Allows to enable/disable string conversion to unicode escape sequence', JavaScriptObfuscatorCLI.parseBoolean)
.option(
'--stringArray <boolean>',
'Disables gathering of all literal strings into an array and replacing every literal string with an array call',
JavaScriptObfuscatorCLI.parseBoolean
)
.option(
'--stringArrayEncoding <boolean|string> [true, false, base64, rc4]',
'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed',
JavaScriptObfuscatorCLI.parseStringArrayEncoding
)
.option(
'--stringArrayThreshold <number>',
'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)',
parseFloat
)
.option(
'--unicodeEscapeSequence <boolean>',
'Allows to enable/disable string conversion to unicode escape sequence',
JavaScriptObfuscatorCLI.parseBoolean
)
.parse(this.rawArguments);
this.commands.on('--help', () => {