Web Analytics Made Easy -
StatCounter Realising a GUI for command line options in a node script - CodingForum

Announcement

Collapse
No announcement yet.

Realising a GUI for command line options in a node script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Realising a GUI for command line options in a node script

    I am very new to JavaScript so this task might be way over my head but I need to make a user interface for a preexisting JavaScript. This script is used with node.js and uses command line options to control it.
    My first thought, being the newbie that I am, was to use a simple HTML document that reads the possible options from the existing scripts and creates a grid that would display these options with dropdowns or input fields so they can be passed to the program. But now I am not sure how feasible that is.
    At one point in the script the Options are created like this:

    Code:
    var program = require('commander');
    
    program
    			.version('0.0.1')
    			.usage('[options] <inputFile1> [inputFile2] [...]')
    			.description(bla')
    			.option('-o, --output <filename>', 'Output filename')
    			.option('-m, --mode <mode>', 'bla')
    			.option('-c, --getTimeFromStat <file status name>', 'Guess first timestamp from file stat')
    			.option('-f, --filter <filter name>', 'Add filter', collect, [])
    			.option('-s, --stdout', 'bla')
    			.option('-n, --si', 'bla)
    			.option('-t, --txtp <plugin:option1=val1,option2=val2,...>', 'bla', collect, [])
    			.option('--bla', 'bla')
    			.option('-g, --gggversion', 'bla')
    			.option('--ts <ms>', 'bla')
    			.parse(this._argv);
    (ignore the "blas" and the like, just for anonymity purposes)

    Am I correct in thinking that I can't get the options from the program object since the script would have to be started for the options to even exist?
    Is my only option to read the script file like a text and find lines containing ".options" that way? The idea is for the GUI to get updated automatically if new options were to be added to the script.

    What are my best options here? Is this even possible? Any and all help is appreciated. If I missed a good guide that would help me with this in the must read thread please point me to it.
Working...
X