title: How to remove the file extension in a zsh completion?
body: <p>I want to adjust zsh so that I can tab complete:</p>
  
  <pre><code>myprog &lt;tab&gt;
  </code></pre>
  
  <p>using all <code>*.foo</code> files in <code>~/somedir</code>, but have it so that it displays them <em>without</em> the <code>.foo</code> extension.</p>
  
  <p>Is there any way to do this?</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>#compdef myprog
  typeset -A opt_args
  local context state line
  local -a mydirs
  mydirs="(. ~/somedir)"
  
  _arguments -s -S \
      "*:name:-&gt;foos" \
      &amp;&amp; return 0
  
  case $state in
      (foos)
          _files -W ${mydirs} -g '*.foo(:r)' &amp;&amp; return 0
      ;;
  esac
  
  return 1
  </code></pre>
  
  <p>However, this displays double the output for every file (that is, each <code>.foo</code> file is listed with and without its extension). Is there any way around this?</p>