add arguments
parent
abfc6189d3
commit
93cb2784ee
|
@ -17,7 +17,7 @@ class Config(Schema):
|
||||||
class Meta:
|
class Meta:
|
||||||
unknown = INCLUDE
|
unknown = INCLUDE
|
||||||
|
|
||||||
def read_conf(config):
|
def read_conf(config, conf_format):
|
||||||
schema = Config()
|
schema = Config()
|
||||||
if not conf_format:
|
if not conf_format:
|
||||||
if config.name.endswith('.json'):
|
if config.name.endswith('.json'):
|
||||||
|
@ -53,7 +53,7 @@ def read_conf(config):
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.argument('config', type=click.File('rb'))
|
@click.argument('config', type=click.File('rb'))
|
||||||
@click.option('--format', '-f', 'conf_format', type=click.Choice(['json', 'yaml', 'toml']))
|
@click.option('--format', '-f', 'conf_format', type=click.Choice(['json', 'yaml', 'toml']))
|
||||||
def cli(config):
|
def cli(config, conf_format):
|
||||||
config = read_conf(config, conf_format)
|
config = read_conf(config, conf_format)
|
||||||
bot = Bot(**config)
|
bot = Bot(**config)
|
||||||
bot.start()
|
bot.start()
|
||||||
|
|
Loading…
Reference in New Issue