title: argparse subparser implied by other parameters
body: <p>The usually way to define a subparser is to do</p>
  
  <pre><code>master_parser = argparse.ArgumentParser()
  subparsers = master_parser.add_subparsers()
  parser = subparsers.add_parser('sub')
  parser.add_argument('--subopt')
  </code></pre>
  
  <p>and the subparser would be called with </p>
  
  <pre><code>command sub --subopt
  </code></pre>
  
  <p>I am implementing a package that calls a number of converters. If I use the usual subparser approach, I would have to do</p>
  
  <pre><code>convert ext1_to_ext2 file.ext1 file.ext2 --args
  </code></pre>
  
  <p>which is both repetitive and error prone because users might call</p>
  
  <pre><code>convert ext1_to_ext3 file.ext1 file.ext2 --args
  </code></pre>
  
  <p>I would much prefer that the subparser is automatically determined from the master parser so users can use command</p>
  
  <pre><code>convert file.ext1 file.ext2  EXTRA
  </code></pre>
  
  <p>and <code>argparse</code> would determine subparser <code>ext1_to_ext2</code> from <code>file.ext1</code> and <code>file.ext2</code> and call the subparser <code>ext1_to_ext2</code> to parse <code>EXTRA</code>. Of course <code>EXTRA</code> here is subparser specific.</p>
  
  <p>I tried to use groups of parameters for each converter (<code>add_argument_group</code>) but the parameters in argument groups cannot overlap and I got a messy list of combined arguments from all parsers, so using subparser seems to be the way to go.</p>
  
  <p>I tried to use <code>parse_known_args</code> with two positional arguments, determine and use the appropriate subparser to parse the remaining args, but it is difficult to provide users a list of converters and their arguments from help message.</p>
  
  <p>Is there a way to do this?</p>