Closed jirikuncar closed 8 years ago
For the extra arguments: before, I was wondering if we can do something like:
@click.group()
def do():
"""Command line interface."""
@do.command(name='marc21')
@click.option('-i', '--input', 'source', type=click.File('rb'),
default=sys.stdin)
@click.option('-l', '--load', callback=open_entry_point('dojson.cli.load'),
default='json')
@click.option('-d', '--dump', callback=open_entry_point('dojson.cli.dump'),
default='json')
@click.option('--strict', is_flag=True, default=False,
help='Raise when there is not matching rule for a key.')
def apply_rule_marc21(source, load, dump, strict):
...
@do.command(name='to_marc21')
@click.option('-i', '--input', 'source', type=click.File('rb'),
default=sys.stdin)
@click.option('-l', '--load', callback=open_entry_point('dojson.cli.load'),
default='json')
@click.option('-d', '--dump', callback=open_entry_point('dojson.cli.dump'),
default='json')
@click.option('-f', '--filename')
@click.option('--strict', is_flag=True, default=False,
help='Raise when there is not matching rule for a key.')
def apply_rule_to_marc21(source, load, dump, filename, strict):
...
In this way we can add all options we want.
Is it possible to do like a "subgroup" with Click
?
@hachreak it isn't about the arguments for rules but about the extra args for dump
.
Overdo.do
should/can add relative$schema
cc @SamiHiltunen @hachreak @egabancho