55import shutil
66
77
8- def create_settings_template (product_location : str , include_comments : bool ) -> None :
8+ def create_settings_template (product_location : str , include_comments : bool , verbose : bool ) -> None :
99 """
1010 Create complete list of settings for settings.ini file
1111
1212 :param product_location: Location of the product jar files to check for *preferences.properties files
1313 :param include_comments: Option to include comments for each setting in output file
14+ :param verbose: Verbose operation
1415 """
1516 # find all jar files so we can unzip jar and find preference files
1617 jar_file_list = glob .glob (product_location + "/*.jar" )
@@ -25,6 +26,8 @@ def create_settings_template(product_location: str, include_comments: bool) -> N
2526 out_f .write ("# Complete List of Available Preference Properties (Created by create_settings_template.py)\n " )
2627
2728 for jar_file in jar_file_list :
29+ if verbose :
30+ print ("| {}" .format (jar_file ))
2831 if not os .path .isdir (tmp_zip_dir ):
2932 os .makedirs (tmp_zip_dir )
3033 with zipfile .ZipFile (jar_file , 'r' ) as zip_ref :
@@ -34,6 +37,8 @@ def create_settings_template(product_location: str, include_comments: bool) -> N
3437
3538 package_str = ""
3639 for prop_file in prop_files :
40+ if verbose :
41+ print ("+ {}/{}" .format (jar_file , prop_file ).replace ("/./tmp-zip/" , "/" ))
3742 with open (prop_file , 'r' ) as file :
3843 lines = file .readlines ()
3944 for line in lines :
@@ -45,6 +50,8 @@ def create_settings_template(product_location: str, include_comments: bool) -> N
4550 out_f .write ("\n {0}\n {1}\n {0}\n " .format ("#" * (len (line )), line ))
4651 else :
4752 out_f .write ("\n {0}\n {1}\n {0}\n \n " .format ("#" * (len (line )), line ))
53+ if verbose :
54+ print ("| {} ({})" .format (" " * len (jar_file ), package_str ))
4855 elif "--------" in line :
4956 continue
5057 # assume equal sign means this is a property
@@ -68,8 +75,9 @@ def create_settings_template(product_location: str, include_comments: bool) -> N
6875
6976parser = argparse .ArgumentParser (description = "Create template of settings.ini with all available settings" )
7077parser .add_argument ("product" , type = str , nargs = '?' , default = "./target/lib" , help = "Location of product jars. Defaults to ./target/lib" )
71- parser .add_argument ("-c" , "--comments" , action = "store_true" , help = "Include settting comments in file" )
78+ parser .add_argument ("-c" , "--comments" , action = "store_true" , help = "Include setting comments in file" )
79+ parser .add_argument ("-v" , "--verbose" , action = "store_true" , help = "Verbose operation" )
7280
7381args = parser .parse_args ()
7482
75- create_settings_template (args .product , args .comments )
83+ create_settings_template (args .product , args .comments , args . verbose )
0 commit comments