CLI¶
This module contains the functions and classes that handle the command line interface (CLI) of RenderCV. It uses Typer to create the CLI and Rich to provide a nice looking terminal output.
LiveProgressReporter(number_of_steps, end_message='Your CV is rendered!')
¶
Bases: Live
This class is a wrapper around rich.live.Live
that provides the live progress
reporting functionality.
Parameters:
-
number_of_steps
(int
) –The number of steps to be finished.
Source code in rendercv/cli.py
__enter__()
¶
start_a_step(step_name)
¶
Start a step and update the progress bars.
finish_the_current_step()
¶
Finish the current step and update the progress bars.
Source code in rendercv/cli.py
welcome()
¶
Print a welcome message to the terminal.
Source code in rendercv/cli.py
warning(text)
¶
Print a warning message to the terminal.
Parameters:
-
text
(str
) –The text of the warning message.
error(text=None, exception=None)
¶
Print an error message to the terminal.
Parameters:
-
text
(str
, default:None
) –The text of the error message.
-
exception
(Exception
, default:None
) –An exception object. Defaults to None.
Source code in rendercv/cli.py
information(text)
¶
Print an information message to the terminal.
Parameters:
-
text
(str
) –The text of the information message.
get_error_message_and_location_and_value_from_a_custom_error(error_string)
¶
Look at a string and figure out if it's a custom error message that has been
sent from data_models.py
. If it is, then return the custom
message, location, and the input value.
This is done because sometimes we raise an error about a specific field in the model validation level, but Pydantic doesn't give us the exact location of the error because it's a model-level error. So, we raise a custom error with three string arguments: message, location, and input value. Those arguments then combined into a string by Python. This function is used to parse that custom error message and return the three values.
Parameters:
-
error_string
(str
) –The error message.
Returns: tuple[Optional[str], Optional[str], Optional[str]]: The custom message, location, and the input value.
Source code in rendercv/cli.py
handle_validation_error(exception)
¶
Take a Pydantic validation error and print the error messages in a nice table.
Pydantic's ValidationError
object is a complex object that contains a lot of
information about the error. This function takes a ValidationError
object and
extracts the error messages, locations, and the input values. Then, it prints them
in a nice table with Rich.
Parameters:
-
exception
(ValidationError
) –The Pydantic validation error object.
Source code in rendercv/cli.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
handle_exceptions(function)
¶
Return a wrapper function that handles exceptions.
A decorator in Python is a syntactic convenience that allows a Python to interpret the code below:
as which is step by step equivalent to- Execute
handle_exceptions(my_function)
which will return the function calledwrapper
. - Execute
wrapper()
.
Parameters:
-
function
(Callable
) –The function to be wrapped.
Returns: Callable: The wrapped function.
Source code in rendercv/cli.py
copy_templates(folder_name, copy_to, new_folder_name=None, suppress_warning=False)
¶
Copy one of the folders found in rendercv.templates
to copy_to
.
Parameters:
-
folder_name
(str
) –The name of the folder to be copied.
-
copy_to
(Path
) –The path to copy the folder to.
Returns: Optional[pathlib.Path]: The path to the copied folder.
Source code in rendercv/cli.py
cli_command_render(input_file_name, use_local_latex_command=None, output_folder_name='rendercv_output', latex_path=None, pdf_path=None, markdown_path=None, html_path=None, png_path=None, dont_generate_markdown=False, dont_generate_html=False, dont_generate_png=False, ctx=None)
¶
Generate a $\LaTeX$ CV from a YAML input file.
Source code in rendercv/cli.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
|
cli_command_new(full_name, theme='classic', dont_create_theme_source_files=False, dont_create_markdown_source_files=False)
¶
Generate a YAML input file to get started.
Source code in rendercv/cli.py
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
|
cli_command_create_theme(theme_name, based_on='classic')
¶
Create a custom theme folder based on an existing theme.