title: argparse - Different mandatory / available parameters per action
body: <p>I'm looking to create an argument parser with the following structure:</p>
  
  <pre><code>options [ 'backup', 'consistency_check', 'backup_and_consistency_check']
  
  --database [ required ]
  --action [ required choice from list options ]
    --where_to_backup_to [ only required if --action is 'backup' ]
    --what_file_to_consistency_check [ only required if --action is 'consistency_check']
  --clean [ optional ]
    --force [ optional if --clean is also in arguments ]
  </code></pre>
  
  <p>How can I implement optional arguments using the ArgumentParser module, depending on the choice which was made as another command line argument.</p>
  
  <p>I'm looking to make the ArgParse fail if for example the command line arguments are</p>
  
  <pre><code>--d database_name --a backup --what_file_to_consistency_check /var/tmp/file.bak
  </code></pre>
  
  <p>This is what I've gotten so far (I know it's very little but I don't want to go in the complete wrong direction with subparsers if I haven't gotten it right from the start)</p>
  
  <pre><code>actions = ['backup', 'consistency_check', 'backup_and_consistency_check']
  
  def create_parser():
      parser = ArgumentParser(description='Parser for Backup / Consistency Check')
  
      parser.add_argument('--database', '-d', dest='db', help='Database name', choices=get_active_database_list())
  
      parser.add_argument('--action', '-a', dest='action', help='Action option', choices=actions)
      # --where_to_backup_to [ only if action = backup ]
      # --what_file_to_consistency_check [ only if action = cc ]
      parser.add_argument('--clean', '-c', dest='clean', help='Clean')
      # --force [ only available if --clean is also in arguments ]
  
      return parser
  </code></pre>