title: Why is .argv_[0] returning undefined when moving yargs config to a separate file?
body: <p>this might seem like a basic question, but I'm working on a note taking app on a Node course I purchased. My original file that works had yargs defined in the same file as the app, along with all of the commands. I figured this made the file a bit length and cumbersome and I was trying to modularize it a bit and move the actual configuration for the yarg commands I wanted to use in a different file. </p>
  
  <pre><code>const fs = require('fs');
  const _ = require('lodash');
  
  
  
  //Application files
  const notes = require('./notes.js');
  const yg = require('./yargs.conf.js');
  var command = yg.argv._[0];
  
  if(command === 'add'){
    var note = notes.addNote(yg.argv.title, yg.argv.body);
    if (note) {
      notes.logNote(note);
    } else {
      console.log("Note title exists")
    }
  } else if (command === 'list') {
      var allnotes = notes.getAll();
      console.log(`\nPrinting ${allnotes.length} note(s):`);
      allnotes.forEach((note) =&gt; notes.logNote(note));
  } else if (command === 'read'){
      var note = notes.getNote(yg.argv.title);
      if (note) {
        notes.logNote(note);
      } else {
        console.log("Note not found");
      }
  } else if (command ==='remove'){
      var noteRemoved = notes.removeNote(yg.argv.title);
      var message = noteRemoved ? "Note was removed" : "Note not found";
      console.log(message);
  
  } else {
  
  }
  </code></pre>
  
  <p>this is how I have the code now with my config moved to another file below:</p>
  
  <pre><code>const yargs = require('yargs');
  const titleOptions =
  {
      describe: 'Title of note',
      demand: true,
      alias: 't'
  };
  const bodyOptions =
  {
      describe: 'Body of the note',
      demand: true,
      alias: 'b'
  };
  
  
  const argv = yargs
  .command('add', 'Add a new note', {
    title: titleOptions,
    body: bodyOptions
  })
  .command('list', 'Lists all notes')
  .command('read', 'Reads individual note to the screen', {
    title: titleOptions
  })
  .command('remove', 'Removes selected note', {
    title: titleOptions
  })
  .help()
  .argv;
  </code></pre>
  
  <p>and when I run the file, using list as the command, I receive the following error from the terminal:</p>
  
  <blockquote>
  <pre><code>TypeError: Cannot read property '_' of undefined
      at Object.&lt;anonymous&gt; (C:\Users\*Hidden*\NodeCourse\notes-node\app.js:16:23)
      at Module._compile (module.js:660:30)
      at Object.Module._extensions..js (module.js:671:10)
      at Module.load (module.js:573:32)
      at tryModuleLoad (module.js:513:12)
      at Function.Module._load (module.js:505:3)
      at Function.Module.runMain (module.js:701:10)
      at startup (bootstrap_node.js:194:16)
      at bootstrap_node.js:618:3
  </code></pre>
  </blockquote>
  
  <p>I can't really figure out where I'm messing up on this. Am I just trying to do something I can't? Or am I just accessing the property incorrectly?</p>