Make brother_ql info a click.group()
This commit is contained in:
@@ -82,7 +82,7 @@ The main user interface of this package is the command line tool `brother_ql`.
|
|||||||
Commands:
|
Commands:
|
||||||
analyze interpret a binary file containing raster...
|
analyze interpret a binary file containing raster...
|
||||||
discover find connected label printers
|
discover find connected label printers
|
||||||
info list available choices (for labels or models)
|
info list available labels, models etc.
|
||||||
print Print a label
|
print Print a label
|
||||||
send send an instruction file to the printer
|
send send an instruction file to the printer
|
||||||
|
|
||||||
|
|||||||
+16
-14
@@ -53,32 +53,34 @@ def discover_and_list_available_devices(backend):
|
|||||||
log_discovered_devices(available_devices)
|
log_discovered_devices(available_devices)
|
||||||
print(textual_description_discovered_devices(available_devices))
|
print(textual_description_discovered_devices(available_devices))
|
||||||
|
|
||||||
@cli.command()
|
@cli.group()
|
||||||
@click.argument('info', click.Choice(('labels', 'models', 'env')))
|
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def info(ctx, *args, **kwargs):
|
def info(ctx, *args, **kwargs):
|
||||||
""" list available choices (for labels or models) """
|
""" list available labels, models etc. """
|
||||||
if kwargs['info'] == 'models':
|
|
||||||
"""List the models (choices for --model)
|
|
||||||
|
|
||||||
List the models that can be used with this software.
|
@info.command(name='models')
|
||||||
Those are the choices avaiable for the --model option.
|
@click.pass_context
|
||||||
|
def models_cmd(ctx, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
List the choices for --model
|
||||||
"""
|
"""
|
||||||
print('Supported models:')
|
print('Supported models:')
|
||||||
for model in models: print(" " + model)
|
for model in models: print(" " + model)
|
||||||
|
|
||||||
elif kwargs['info'] == 'labels':
|
@info.command()
|
||||||
|
@click.pass_context
|
||||||
|
def labels(ctx, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
List the choices for --label
|
||||||
"""
|
"""
|
||||||
List labels (types and sizes).
|
|
||||||
|
|
||||||
This command lists all labels (label types and label sizes)
|
|
||||||
that can be used with this software. """
|
|
||||||
from brother_ql.output_helpers import textual_label_description
|
from brother_ql.output_helpers import textual_label_description
|
||||||
print(textual_label_description(label_sizes))
|
print(textual_label_description(label_sizes))
|
||||||
|
|
||||||
elif kwargs['info'] == 'env':
|
@info.command()
|
||||||
|
@click.pass_context
|
||||||
|
def env(ctx, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Print information about the running environment of brother_ql.
|
print debug info about running environment
|
||||||
"""
|
"""
|
||||||
import sys, platform, os, shutil
|
import sys, platform, os, shutil
|
||||||
from pkg_resources import get_distribution, working_set
|
from pkg_resources import get_distribution, working_set
|
||||||
|
|||||||
Reference in New Issue
Block a user