<commit_before>#!/usr/bin/env node

const fs               = require('fs')
const arg              = require('arg')
const chalk            = require('chalk')
const {version}        = require('../package.json')
const { init, render } = require('@nexrender/core')

const args = arg({
    // Types
    '--help':       Boolean,
    '--version':    Boolean,

    '--file':       String,
    '--binary':     String,
    '--workpath':   String,

    '--stop-on-error':  String,

    '--skip-cleanup':   Boolean,
    '--no-license':     Boolean,
    '--force-patch':    Boolean,
    '--debug':          Boolean,
    '--multi-frames':   Boolean,
    '--reuse':          Boolean,

    '--max-memory-percent':  Number,
    '--image-cache-percent': Number,

    // Aliases
    '-v':           '--version',
    '-h':           '--help',
    '-f':           '--file',
    '-b':           '--binary',
    '-w':           '--workpath',
});

let serverHost = 'http://localhost:3000';
let serverSecret = '';

if (args['--help']) {
    console.error(chalk`
  {bold.cyan nexrender-cli} - nexrender standalone renderer
  {bold.cyan version} - v${version}

  {bold USAGE}

      {bold $} {cyan nexrender-cli} {underline JOB_JSON} --help
      {bold $} {cyan nexrender-cli} {underline JOB_JSON} --version

      By default {cyan nexrender-cli} will connect to {bold http://localhost:3000} and will
      start making api calls to fetch any existing queued project and start rendering those.

      Specifying {bold --secret} argument will enable the security validator, and will check
      for {bold nexrender-secret} header value for every outgoing request.

  {bold OPTIONS}

      -h, --help                            shows this help message

      -v, --version                         displays the current version of nexrender-cli

      -b, --binary {underline path}            instead of using json from argument, provide a relative
                                            or absolute path to file with json containing job

      -b, --binary {underline absolute_path}            manually specify path to the {bold "aerender"} binary
                                            you can leave it empty to rely on autofinding

      -w, --workpath {underline absolute_path}          manually override path to the working directory
                                            by default nexrender is using os tmpdir/nexrender folder

  {bold ADVANCED OPTIONS}


    --stop-on-error                         forces worker to stop if processing/rendering error occures,
                                            otherwise worker will report an error, and continue working

    --no-license                            prevents creation of the ae_render_only_node.txt file (enabled by default),
                                            which allows free usage of trial version of Adobe After Effects

    --force-patch                           forces commandLineRenderer.jsx patch (re)installation

    --debug                                 enables command dump for aerender, and other debugging stuff

    --skip-cleanup                          forces worker to keep temporary data after rendering is finished

    --multi-frames                          (from Adobe site): More processes may be created to render multiple frames simultaneously,
                                            depending on system configuration and preference settings.<commit_msg>feat:  invalid parameter<commit_after>#!/usr/bin/env node

const fs               = require('fs')
const arg              = require('arg')
const chalk            = require('chalk')
const {version}        = require('../package.json')
const { init, render } = require('@nexrender/core')

const args = arg({
    // Types
    '--help':       Boolean,
    '--version':    Boolean,

    '--file':       String,
    '--binary':     String,
    '--workpath':   String,

    '--stop-on-error':  String,

    '--skip-cleanup':   Boolean,
    '--no-license':     Boolean,
    '--force-patch':    Boolean,
    '--debug':          Boolean,
    '--multi-frames':   Boolean,
    '--reuse':          Boolean,

    '--max-memory-percent':  Number,
    '--image-cache-percent': Number,

    // Aliases
    '-v':           '--version',
    '-h':           '--help',
    '-f':           '--file',
    '-b':           '--binary',
    '-w':           '--workpath',
});

let serverHost = 'http://localhost:3000';
let serverSecret = '';

if (args['--help']) {
    console.error(chalk`
  {bold.cyan nexrender-cli} - nexrender standalone renderer
  {bold.cyan version} - v${version}

  {bold USAGE}

      {bold $} {cyan nexrender-cli} {underline JOB_JSON} --help
      {bold $} {cyan nexrender-cli} {underline JOB_JSON} --version

      By default {cyan nexrender-cli} will connect to {bold http://localhost:3000} and will
      start making api calls to fetch any existing queued project and start rendering those.

      Specifying {bold --secret} argument will enable the security validator, and will check
      for {bold nexrender-secret} header value for every outgoing request.

  {bold OPTIONS}

      -h, --help                            shows this help message

      -v, --version                         displays the current version of nexrender-cli

      -f, --file {underline path}            instead of using json from argument, provide a relative
                                            or absolute path to file with json containing job

      -b, --binary {underline absolute_path}            manually specify path to the {bold "aerender"} binary
                                            you can leave it empty to rely on autofinding

      -w, --workpath {underline absolute_path}          manually override path to the working directory
                                            by default nexrender is using os tmpdir/nexrender folder

  {bold ADVANCED OPTIONS}


    --stop-on-error                         forces worker to stop if processing/rendering error occures,
                                            otherwise worker will report an error, and continue working

    --no-license                            prevents creation of the ae_render_only_node.txt file (enabled by default),
                                            which allows free usage of trial version of Adobe After Effects

    --force-patch                           forces commandLineRenderer.jsx patch (re)installation

    --debug                                 enables command dump for aerender, and other debugging stuff

    --skip-cleanup                          forces worker to keep temporary data after rendering is finished

    --multi-frames                          (from Adobe site): More processes may be created to render multiple frames simultaneously,
                                            depending on system configuration and preference settings.
{'fraction_non_alphanumeric': 0.0988279554333671, 'fraction_numerical': 0.002315149761250181, 'mean_word_length': 1.620166793025019, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4207777', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1635, 'n_words': 609}