HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/node_modules/cardinal/bin/cdl.js
#!/usr/bin/env node
var cardinal = require('..')
var path = require('path')
var settings = require('../settings')
var args = process.argv
var theme = settings.resolveTheme()
var opts = settings.getSettings()
var highlighted

opts = opts || {}
opts.theme = theme
// jsx is only turned on when highlighting non-json files
opts.jsx = false

function usage() {
  var msg = [
      'Usage: cdl <filename.js> [options]'
    , ''
    , 'Options (~/.cardinalrc overrides):'
    , '  --nonum: turn off line printing'
    , ''
    , 'Unix Pipe Example: cat filename.js | grep console | cdl'
    , ''
  ].join('\n')
  console.log(msg)
}

function highlightFile() {
  try {
    // Enabling jsx for JSON breaks most likelely due to esprima AST generation
    // not working for JSON
    opts.jsx = path.extname(args[2]) !== '.json'
    highlighted = cardinal.highlightFileSync(args[2], opts)
    console.log(highlighted)
  } catch (e) {
    console.trace()
    console.error(e)
  }
}

(function runner() {
// E.g., "cardinal myfile.js"
if (args.length === 3) return highlightFile()

var opt = args[3]

// E.g., "cardinal myfile.js --nonum"
if (opt && opt.indexOf('--') === 0) {
  if ((/^--(nonum|noline)/i).test(opt)) opts.linenos = false
  else {
    usage()
    return console.error('Unknown option: ', opt)
  }

  return highlightFile()
}

// UNIX pipes e.g., "cat myfile.js | grep console | cardinal
var stdin = process.stdin
var stdout = process.stdout

// line numbers don't make sense when we are printing line by line
opts.linenos = false

stdin.setEncoding('utf-8')
stdin.resume()
stdin
  .on('data', function(chunk) {
    chunk.split('\n').forEach(function(line) {
      try {
        stdout.write(cardinal.highlight(line, opts) + '\n')
      } catch (e) {
        // line doesn't represent a valid js snippet and therefore cannot be parsed -> just print as is
        stdout.write(line + '\n')
      }
    })
  })
})()