mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-20 10:15:23 -04:00
Add option to open config in nvim
Signed-off-by: nathom <nathanthomas707@gmail.com>
This commit is contained in:
parent
3907178f5f
commit
11443af6aa
1 changed files with 7 additions and 3 deletions
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
import requests # type: ignore
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .clients import TidalClient
|
from .clients import TidalClient
|
||||||
|
@ -279,7 +280,7 @@ def lastfm(ctx, source, url):
|
||||||
"-ov",
|
"-ov",
|
||||||
"--open-vim",
|
"--open-vim",
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Open the config file in the vim text editor.",
|
help="Open the config file in the nvim or vim text editor.",
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def config(ctx, **kwargs):
|
def config(ctx, **kwargs):
|
||||||
|
@ -298,7 +299,10 @@ def config(ctx, **kwargs):
|
||||||
click.launch(CONFIG_PATH)
|
click.launch(CONFIG_PATH)
|
||||||
|
|
||||||
if kwargs["open_vim"]:
|
if kwargs["open_vim"]:
|
||||||
os.system(f"vim '{CONFIG_PATH}'")
|
if shutil.which("nvim") is not None:
|
||||||
|
os.system(f"nvim '{CONFIG_PATH}'")
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue