def arg(*args, **kwargs):
def wrapper(func):<EOL><INDENT>declared_args = getattr(func, ATTR_ARGS, [])<EOL>declared_args.insert(<NUM_LIT:0>, dict(option_strings=args, **kwargs))<EOL>setattr(func, ATTR_ARGS, declared_args)<EOL>return func<EOL><DEDENT>return wrapper<EOL>
Declares an argument for given function. Does not register the function
anywhere, nor does it modify the function in any way.

The signature of the decorator matches that of
:meth:`argparse.ArgumentParser.add_argument`, only some keywords are not
required if they can be easily guessed (e.g. you don't have to specify type
or action when an `int` or `bool` default value is supplied).

Typical use cases:

- In combination with :func:`expects_obj` (which is not recommended);
- in combination with ordinary function signatures to add details that
  cannot be expressed with that syntax (e.g. help message).

Usage::

    from argh import arg

    @arg('path', help='path to the file to load')
    @arg('--format', choices=['yaml','json'])
    @arg('-v', '--verbosity', choices=range(0,3), default=2)
    def load(path, something=None, format='json', dry_run=False, verbosity=1):
        loaders = {'json': json.load, 'yaml': yaml.load}
        loader = loaders[args.format]
        data = loader(args.path)
        if not args.dry_run:
            if verbosity < 1:
                print('saving to the database')
            put_to_database(data)

In this example:

- `path` declaration is extended with `help`;
- `format` declaration is extended with `choices`;
- `dry_run` declaration is not duplicated;
- `verbosity` is extended with `choices` and the default value is
  overridden.  (If both function signature and `@arg` define a default
  value for an argument, `@arg` wins.)

.. note::

    It is recommended to avoid using this decorator unless there's no way
    to tune the argument's behaviour or presentation using ordinary
    function signatures.  Readability counts, don't repeat yourself.