title: Argparse - How to parse a second argument when the first is not entered and reverting to defualt
body: <p>I have the below function as part of a directory scanner:</p>
  
  <pre><code>def get_args():
      cwd = os.getcwd()
      parser = argparse.ArgumentParser(description='Scan all files')
      parser.add_argument("path", help="Path to folder", nargs='?', default=cwd)
      parser.add_argument("print", help="Print file extensions", nargs='?', default=False)
      return parser.parse_args()
  
  
  Scan /usr/Ari True
  </code></pre>
  
  <p>This will scan the specified folder and print out the list</p>
  
  <pre><code>Scan
  </code></pre>
  
  <p>Will scan the current working directory where I am in the terminal</p>
  
  <pre><code>Scan True
  </code></pre>
  
  <p>Does not work because it assumes I am entering a directory, How do I use the default of the first argument but specify the second?</p>
  
  <p><a href="https://i.stack.imgur.com/Z3KWH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z3KWH.png" alt="enter image description here"></a></p>