(self, options: str)
| 146 | @throw CommandException if the file couldn't be targets couldn't be loaded. |
| 147 | """ |
| 148 | def __load(self, options: str): |
| 149 | if len(options) == 0: |
| 150 | raise CommandException("No path given.") |
| 151 | path = Path(options) |
| 152 | if path.exists() and path.is_file(): |
| 153 | try: |
| 154 | data = json.load(open(path)) |
| 155 | for target in data["targets"]: |
| 156 | try: |
| 157 | print(f"{target['name']}: ") |
| 158 | self.__add((f"{target['name']} " |
| 159 | f"{target['host']} " |
| 160 | f"{target['path']} " |
| 161 | f"{target['type']} " |
| 162 | f"{target['method']} " |
| 163 | f"{target['header']}")) |
| 164 | print("-" * 80) |
| 165 | except CommandException as e: |
| 166 | print(str(e)) |
| 167 | except: |
| 168 | raise CommandException("Could not parse file.") |
| 169 | else: |
| 170 | raise CommandException("File does not exist.") |
| 171 | |
| 172 | """ |
| 173 | @brief Exports targets as JSON onto disk with timestamp. |
nothing calls this directly
no test coverage detected