List or install example files The example files that come with the package can be listed and optionally installed in the currently running profile configuration. Arguments: list: List all example files, and where they will be installed. type
(self, arg)
| 111 | self.log.error(f"Error installing examples: {str(e)}") |
| 112 | |
| 113 | def command_examples(self, arg): |
| 114 | """ |
| 115 | List or install example files |
| 116 | |
| 117 | The example files that come with the package can be listed and |
| 118 | optionally installed in the currently running profile configuration. |
| 119 | |
| 120 | Arguments: |
| 121 | list: List all example files, and where they will be installed. |
| 122 | type: The type of example files to install (default is all configured types). |
| 123 | |
| 124 | Examples: |
| 125 | {COMMAND} list |
| 126 | {COMMAND} presets |
| 127 | """ |
| 128 | if arg: |
| 129 | if arg in self.default_types: |
| 130 | self.log.info(f"Installing examples for: {arg}") |
| 131 | self.install_examples_confirm(arg) |
| 132 | elif arg == "list": |
| 133 | for t in self.default_types: |
| 134 | self.log.debug(f"Listing examples for: {t}") |
| 135 | install_dir = f"{self.profile_dir}/{t}" |
| 136 | file_list = "\n".join([f"* {f}" for f in sorted(self.get_examples(t))]) |
| 137 | util.print_markdown("## %s\nInstall to: %s\n%s" % (t, install_dir, file_list)) |
| 138 | else: |
| 139 | return False, arg, "Invalid example type" |
| 140 | else: |
| 141 | self.log.info(f"Installing examples for: {', '.join(self.default_types)}") |
| 142 | self.install_examples_confirm() |
nothing calls this directly
no test coverage detected