diff --git a/README.md b/README.md index 2def5c4..8399484 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,46 @@ Generate labels for printing using HTML rendering. ## Usage -The simplest use case is some static labels: +The simplest use case is some static labels using a [template](examples/simple.html): python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 > output.html Then, when you need some more just pop the same sheet back in the printer and offset the start - python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 > output.html + python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 -o 10 > output.html -To do some mail merge operations create a list of names: +To do some mail merge operations create a [list of names](examples/names.txt): Andy Andrews Bob Brown Charlie Chaplin -and use a `{data[text]}` element in your template. Note we've shifted to an external stylesheet now as well. +and use a `{data[text]}` element in your [template](examples/name_tags.html). Note we've shifted to an [external stylesheet](examples/hello.css) now as well. python -m pylabel -t examples/name_tags.html -p avery.L7157 -d examples/names.txt -s examples/hello.css > output.html +Full list of options `python -m pylabel -h` + + usage: __main__.py [-h] [--count COUNT] [--offset OFFSET] [--profile PROFILE] [--template TEMPLATE] [--style STYLE] [--data DATA] [--json] [--logging LOGGING] [spec] + + Generate a page of labels + + positional arguments: + spec Specification module + + options: + -h, --help show this help message and exit + --count COUNT, -c COUNT + Number of labels to generate + --offset OFFSET, -o OFFSET + Skip first n labels + --profile PROFILE, -p PROFILE + Label profile + --template TEMPLATE, -t TEMPLATE + Template for label + --style STYLE, -s STYLE + Additional stylesheet + --data DATA, -d DATA Pre-generated data, one entry per line + --json, -j Parse data lines as json + --logging LOGGING, -l LOGGING + Logging level \ No newline at end of file diff --git a/pylabel/__main__.py b/pylabel/__main__.py index edc54da..459983f 100644 --- a/pylabel/__main__.py +++ b/pylabel/__main__.py @@ -15,7 +15,7 @@ logger = logging.getLogger(__name__) parser = argparse.ArgumentParser(description="Generate a page of labels") parser.add_argument('--count', '-c', type=int, default=0, help="Number of labels to generate") -parser.add_argument('--skip', '-n', type=int, default=0, help="Skip first n labels") +parser.add_argument('--offset', '-o', type=int, default=0, help="Skip first n labels") parser.add_argument('--profile', '-p', help='Label profile') parser.add_argument('--template', '-t', type=argparse.FileType('r'), help='Template for label') parser.add_argument('--style', '-s', type=argparse.FileType('r'), help='Additional stylesheet') @@ -77,4 +77,4 @@ for required in ('profile', 'template', 'data'): sheet = LabelSheet(spec.profile) -sys.stdout.write(sheet.render_html(spec.template, spec.data, options.skip, getattr(spec, 'style', ''))) \ No newline at end of file +sys.stdout.write(sheet.render_html(spec.template, spec.data, options.offset, getattr(spec, 'style', ''))) \ No newline at end of file