Skip to content
Snippets Groups Projects
Commit 5a110159 authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Global: changed 'setconfig' to take additional config files to merged with the first

parent aa3752fe
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ Global
* Changed version info to be retrieved from version control system.
This requires an additional 'make' step before running
* Changed 'setconfig' to take additional config files to merged with the first
Configuration
-------------
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
No preview for this file type
......@@ -33,15 +33,24 @@ command_line.add_argument('--delete', '-d', action='append', default=[],
help='remove given keys from configuration')
command_line.add_argument('--header', '-H', action='append', default=[],
help='append text to header (initial comment)')
command_line.add_argument('--add', '-a', action='append', default=[],
help='add settings from file')
args = command_line.parse_args()
data_arg = args.config
if data_arg == '-':
data_arg = sys.stdin
# File handling
try:
config_data = ConfigObj(data_arg, interpolation=False, file_error=True,
config_file = args.config
if config_file == '-':
config_file = sys.stdin
config_data = ConfigObj(config_file, interpolation=False, file_error=True,
write_empty_values=True)
# Add settings from other files
for add_file in args.add:
if add_file == '-':
add_file = sys.stdin
config_data.merge(ConfigObj(add_file, interpolation=False,
file_error=True))
except IOError as error:
die(error.message)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment