Open the config file in a text editor.
(ctx, vim)
| 273 | @click.option("-v", "--vim", help="Open in (Neo)Vim", is_flag=True) |
| 274 | @click.pass_context |
| 275 | def config_open(ctx, vim): |
| 276 | """Open the config file in a text editor.""" |
| 277 | config_path = ctx.obj["config_path"] |
| 278 | |
| 279 | console.print(f"Opening file at [bold cyan]{config_path}") |
| 280 | if vim: |
| 281 | if shutil.which("nvim") is not None: |
| 282 | subprocess.run(["nvim", config_path]) |
| 283 | elif shutil.which("vim") is not None: |
| 284 | subprocess.run(["vim", config_path]) |
| 285 | else: |
| 286 | logger.error("Could not find nvim or vim. Using default launcher.") |
| 287 | click.launch(config_path) |
| 288 | else: |
| 289 | click.launch(config_path) |
| 290 | |
| 291 | |
| 292 | @config.command("reset") |