iasMergeProps
index
/home/acaproni/ias/Tools/src/main/python/iasMergeProps.py

Merge two Java property files (e.g., Kafka configuration files) and write
the result to stdout.
 
Properties from the second file override those from the first.  Properties
unique to the first file are kept in place.  Properties unique to the second
file are appended at the end.  Overridden properties from the first file are
commented out with a '#REPLACED' prefix so the user can see what changed.
 
Comments and blank lines from the first file are preserved.

 
Modules
       
argparse
os
sys

 
Functions
       
main()
Entry point.  Reads two Java properties files, merges them according to
the rules described in the module docstring, and prints the result.
parse_args()
Parse command-line arguments.
 
Returns:
    argparse.Namespace: contains PropFile1, PropFile2, and comment.
parse_line(line: str) -> tuple[str, str, str]
Parse a single line from a Java properties file.
 
Args:
    line: a raw line from the properties file.
 
Returns:
    A tuple (prop_name, prop_value, comment) where comment is the
    trailing '# ...' portion if present, else an empty string.
    For blank or comment-only lines prop_name and prop_value are empty.
 
Raises:
    ValueError: if the line contains text that is not a comment and
        does not have a valid 'key=value' format.