mirror of https://github.com/eyhc1/rendercv.git
cli: fix render command without extra arguments
This commit is contained in:
parent
e9c508085d
commit
2526926b90
|
@ -586,25 +586,26 @@ def cli_command_render(
|
||||||
# double dashed, such as `--cv.sections.education.0.institution`. The following
|
# double dashed, such as `--cv.sections.education.0.institution`. The following
|
||||||
# elements are the corresponding values of the key, such as
|
# elements are the corresponding values of the key, such as
|
||||||
# `"Bogazici University"`. The for loop below parses `ctx.args` accordingly.
|
# `"Bogazici University"`. The for loop below parses `ctx.args` accordingly.
|
||||||
for i in range(0, len(ctx.args), 2):
|
if ctx:
|
||||||
key = ctx.args[i]
|
for i in range(0, len(ctx.args), 2):
|
||||||
value = ctx.args[i + 1]
|
key = ctx.args[i]
|
||||||
if not key.startswith("--"):
|
value = ctx.args[i + 1]
|
||||||
error(f"The key ({key}) should start with double dashes!")
|
if not key.startswith("--"):
|
||||||
|
error(f"The key ({key}) should start with double dashes!")
|
||||||
|
|
||||||
key = key.replace("--", "")
|
key = key.replace("--", "")
|
||||||
|
|
||||||
key_and_values[key] = value
|
key_and_values[key] = value
|
||||||
|
|
||||||
for key, value in key_and_values.items():
|
for key, value in key_and_values.items():
|
||||||
try:
|
try:
|
||||||
# set the key (for example, cv.sections.education.0.institution) to the
|
# set the key (for example, cv.sections.education.0.institution) to the
|
||||||
# value
|
# value
|
||||||
data_model = dm.set_or_update_a_value(data_model, key, value)
|
data_model = dm.set_or_update_a_value(data_model, key, value)
|
||||||
except pydantic.ValidationError as e:
|
except pydantic.ValidationError as e:
|
||||||
raise e
|
raise e
|
||||||
except (ValueError, KeyError, IndexError, AttributeError):
|
except (ValueError, KeyError, IndexError, AttributeError):
|
||||||
raise ValueError(f'The key "{key}" does not exist in the data model!')
|
raise ValueError(f'The key "{key}" does not exist in the data model!')
|
||||||
|
|
||||||
progress.finish_the_current_step()
|
progress.finish_the_current_step()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue