mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-31 07:18:26 -04:00
Add option to open config in vim
Signed-off-by: nathom <nathanthomas707@gmail.com>
This commit is contained in:
parent
bbc6e3ec8a
commit
14710d536a
1 changed files with 9 additions and 0 deletions
|
@ -275,6 +275,12 @@ def lastfm(ctx, source, url):
|
||||||
help="Reset the config file, keeping the credentials",
|
help="Reset the config file, keeping the credentials",
|
||||||
)
|
)
|
||||||
@click.option("-p", "--path", is_flag=True, help="Show the config file's path")
|
@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
|
@click.pass_context
|
||||||
def config(ctx, **kwargs):
|
def config(ctx, **kwargs):
|
||||||
"""Manage the streamrip configuration file."""
|
"""Manage the streamrip configuration file."""
|
||||||
|
@ -291,6 +297,9 @@ def config(ctx, **kwargs):
|
||||||
click.secho(f"Opening {CONFIG_PATH}", fg="green")
|
click.secho(f"Opening {CONFIG_PATH}", fg="green")
|
||||||
click.launch(CONFIG_PATH)
|
click.launch(CONFIG_PATH)
|
||||||
|
|
||||||
|
if kwargs["open_vim"]:
|
||||||
|
os.system(f"vim '{CONFIG_PATH}'")
|
||||||
|
|
||||||
if kwargs["directory"]:
|
if kwargs["directory"]:
|
||||||
config_dir = os.path.dirname(CONFIG_PATH)
|
config_dir = os.path.dirname(CONFIG_PATH)
|
||||||
click.secho(f"Opening {config_dir}", fg="green")
|
click.secho(f"Opening {config_dir}", fg="green")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue