title: nargs=* equivalent for options in Click
body: <p>Is there an equivalent to <code>argparse</code>'s <code>nargs='*'</code> functionality for optional arguments in Click?</p>
  <p>I am writing a command line script, and one of the options needs to be able to take an unlimited number of arguments, like:</p>
  <pre><code>foo --users alice bob charlie --bar baz
  </code></pre>
  <p>So <code>users</code> would be <code>['alice', 'bob', 'charlie']</code> and <code>bar</code> would be <code>'baz'</code>.</p>
  <p>In <a href="https://docs.python.org/3/library/argparse.html#nargs" rel="noreferrer"><code>argparse</code></a>, I can specify multiple optional arguments to collect all of the arguments that follow them by setting <code>nargs='*'</code>.</p>
  <pre><code>&gt;&gt;&gt; parser = argparse.ArgumentParser()
  &gt;&gt;&gt; parser.add_argument('--users', nargs='*')
  &gt;&gt;&gt; parser.add_argument('--bar')
  &gt;&gt;&gt; parser.parse_args('--users alice bob charlie --bar baz'.split())
  Namespace(bar='baz', users=['alice', 'bob', 'charlie'])
  </code></pre>
  <p>I know Click allows you to specify an argument to <a href="http://click.pocoo.org/6/arguments/#variadic-arguments" rel="noreferrer">accept unlimited inputs</a> by setting <code>nargs=-1</code>, but when I try to set an optional argument's <code>nargs</code> to -1, I get:</p>
  <blockquote>
  <p>TypeError: Options cannot have nargs &lt; 0</p>
  </blockquote>
  <p>Is there a way to make Click accept an unspecified number of arguments for an option?</p>
  <h3>Update:</h3>
  <p>I need to be able to specify options after the option that takes unlimited arguments.</p>
  <h3>Update:</h3>
  <p>@Stephen Rauch's answer answers this question.  However, I don't recommend using the approach I ask for here.  My feature request is <a href="https://github.com/pallets/click/issues/484" rel="noreferrer">intentionally not implemented in Click</a>, since it can result in unexpected behaviors.  <a href="https://click.palletsprojects.com/en/7.x/options/#multiple-options" rel="noreferrer">Click's recommended approach is to use <code>multiple=True</code></a>:</p>
  <pre><code>@click.option('-u', '--user', 'users', multiple=True)
  </code></pre>
  <p>And in the command line, it will look like:</p>
  <pre><code>foo -u alice -u bob -u charlie --bar baz
  </code></pre>