title: Auto-complete both - and - - arguments
body: <p>I have the following Python script in file <code>test.py</code>:</p>
  <pre><code>import argparse
  
  library_list=[&quot;LibraryA&quot;,&quot;LibraryB&quot;,&quot;LibraryC&quot;]
  
  ap = argparse.ArgumentParser()
  ap.add_argument(&quot;-l&quot;, &quot;--library&quot;, required=True, choices=library_list,
     help=&quot;Choose library&quot;)
  args = vars(ap.parse_args())
  
  library=args[&quot;library&quot;]
  print(library+&quot; chosen&quot;)
  </code></pre>
  <p>I want to be able to auto-complete the arguments for <code>-l/--library</code>. For this I have this Bash auto-complete script:</p>
  <pre><code>lib_list=&quot;LibraryA LibraryB LibraryC&quot;
  
  function libs()
  {
  case $3 in
      -l) COMPREPLY=($(compgen -W &quot;$lib_list&quot; &quot;${COMP_WORDS[$COMP_CWORD]}&quot;));;
  esac
  }
  
  complete -F libs test.py
  </code></pre>
  <p>This script however only completes the <code>-l</code> flag as I have not been able to get it to work for <code>--library</code>. I have tried adding another line for the <code>case</code> statement with <code>--library</code> instead of <code>-l</code> or using <code>-l | --library) COMPREPLY=($(compgen -W &quot;$lib_list&quot; &quot;${COMP_WORDS[$COMP_CWORD]}&quot;));;</code>, but both don't work.
  How would I get this to work?</p>