From 14710d536a0907268c743c4969e8f30701eff0d7 Mon Sep 17 00:00:00 2001 From: nathom Date: Tue, 8 Jun 2021 23:18:30 -0700 Subject: [PATCH] Add option to open config in vim Signed-off-by: nathom --- streamrip/cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/streamrip/cli.py b/streamrip/cli.py index 90c8b19..f2448ee 100644 --- a/streamrip/cli.py +++ b/streamrip/cli.py @@ -275,6 +275,12 @@ def lastfm(ctx, source, url): help="Reset the config file, keeping the credentials", ) @click.option("-p", "--path", is_flag=True, help="Show the config file's path") +@click.option( + "-ov", + "--open-vim", + is_flag=True, + help="Open the config file in the vim text editor.", +) @click.pass_context def config(ctx, **kwargs): """Manage the streamrip configuration file.""" @@ -291,6 +297,9 @@ def config(ctx, **kwargs): click.secho(f"Opening {CONFIG_PATH}", fg="green") click.launch(CONFIG_PATH) + if kwargs["open_vim"]: + os.system(f"vim '{CONFIG_PATH}'") + if kwargs["directory"]: config_dir = os.path.dirname(CONFIG_PATH) click.secho(f"Opening {config_dir}", fg="green")