Source for: __main__.py [raw]

 1"""
 2Usage:
 3    boxes <input> <output> [--page-size=<WxH>] [--separation=<sep>]
 4    boxes --version
 5"""
 6
 7from docopt import docopt
 8import boxes
 9
10
11def main():
12    """The main routine of Boxes."""
13    arguments = docopt(__doc__, version=f"Boxes {boxes.__version__}")
14
15    if arguments["--page-size"]:
16        p_size = [int(x) for x in arguments["--page-size"].split("x")]
17    else:
18        p_size = (30, 50)
19
20    if arguments["--separation"]:
21        separation = float(arguments["--separation"])
22    else:
23        separation = 0.05
24
25    boxes.convert(
26        input=arguments["<input>"],
27        output=arguments["<output>"],
28        page_size=p_size,
29        separation=separation,
30    )
31
32
33if __name__ == "__main__":
34    main()
35