1717
1818
1919@click .group ()
20- @click .option ("-v" , "--verbose" , is_flag = True , help = "Show debug information" )
21- @click .option ("-q" , "--quiet" , is_flag = True , help = "Show errors only" )
22- def cli (quiet = False , verbose = False ):
23- """PDF document generator from YAML-configured SVG templates."""
20+ def cli ():
21+ """Generate PDF documents from YAML-configured SVG templates."""
22+
23+
24+ @cli .command ()
25+ @click .argument ("config_file" , metavar = "<config_file>" , type = click .Path (exists = True , path_type = Path ))
26+ @click .option (
27+ "-v" , "--verbose" , is_flag = True ,
28+ help = "Show debug information"
29+ )
30+ @click .option (
31+ "-q" , "--quiet" , is_flag = True ,
32+ help = "Show errors only"
33+ )
34+ def bake (config_file , verbose = False , quiet = False ):
35+ """Parse config file and bake PDFs."""
2436 if quiet :
2537 logging .getLogger ().setLevel (logging .ERROR )
2638 elif verbose :
2739 logging .getLogger ().setLevel (logging .DEBUG )
2840 else :
2941 logging .getLogger ().setLevel (logging .INFO )
3042
31-
32- @cli .command ()
33- @click .argument ("config_path" , type = click .Path (exists = True , path_type = Path ))
34- def bake (config_path ):
35- """Generate PDF documents from YAML-configured SVG templates.
36-
37- CONFIG_PATH is the path to your configuration YAML file.
38- """
39- config = _load_config (config_path )
40- base_dir = config_path .parent
43+ config = _load_config (config_file )
44+ base_dir = config_file .parent
4145 document_paths = _get_document_paths (base_dir , config .get ("documents" , []))
4246 build_dir , dist_dir = _setup_output_directories (base_dir )
4347
@@ -48,9 +52,9 @@ def bake(config_path):
4852 return 0
4953
5054
51- def _load_config (config_path ):
55+ def _load_config (config_file ):
5256 """Load configuration from a YAML file."""
53- with open (config_path , encoding = "utf-8" ) as f :
57+ with open (config_file , encoding = "utf-8" ) as f :
5458 return yaml .safe_load (f )
5559
5660
0 commit comments