()
| 155 | |
| 156 | |
| 157 | def main() -> None: |
| 158 | logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s") |
| 159 | p = argparse.ArgumentParser( |
| 160 | description="Load CouchDB data for a scenario (default if omitted)." |
| 161 | ) |
| 162 | p.add_argument( |
| 163 | "scenario", |
| 164 | nargs="?", |
| 165 | default=None, |
| 166 | help="Scenario id → scenarios_data/scenario_<id>.json (omit for default).", |
| 167 | ) |
| 168 | p.add_argument( |
| 169 | "--reuse", action="store_true", help="Reuse instead of reloading from scratch." |
| 170 | ) |
| 171 | p.add_argument( |
| 172 | "--reset", |
| 173 | action="store_true", |
| 174 | help="Drop databases first, then load (clean start).", |
| 175 | ) |
| 176 | p.add_argument( |
| 177 | "--reset-only", action="store_true", help="Drop databases and exit (no load)." |
| 178 | ) |
| 179 | p.add_argument( |
| 180 | "--managed-only", |
| 181 | action="store_true", |
| 182 | help="With --reset/--reset-only: drop only the default-manifest collections.", |
| 183 | ) |
| 184 | a = p.parse_args() |
| 185 | |
| 186 | if a.reset_only: |
| 187 | for db in reset(managed_only=a.managed_only): |
| 188 | print(f"dropped\t{db}") |
| 189 | return |
| 190 | |
| 191 | for key, (db, n) in init_data( |
| 192 | a.scenario, force=not a.reuse, reset_first=a.reset, managed_only=a.managed_only |
| 193 | ).items(): |
| 194 | print(f"{key}\t{db}\t{n}") |
| 195 | |
| 196 | |
| 197 | if __name__ == "__main__": |
no test coverage detected