add env command
This commit is contained in:
@@ -1,13 +1,40 @@
|
|||||||
"""
|
"""
|
||||||
setup or cleanup enviroment file
|
setup or cleanup enviroment file
|
||||||
usage: rvc env [set / cleanup]
|
usage: rvc env [create / cleanup]
|
||||||
Default: [nowDir/.env]
|
Default: [nowDir/.env]
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.group()
|
||||||
def env():
|
def env():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@env.command()
|
||||||
|
def create():
|
||||||
|
env_file_path = os.path.join(os.getcwd(), ".env")
|
||||||
|
|
||||||
|
if not os.path.exists(env_file_path):
|
||||||
|
default_values = {
|
||||||
|
"weight_root": "",
|
||||||
|
"weight_uvr5_root": "",
|
||||||
|
"index_root": "",
|
||||||
|
"rmvpe_root": "",
|
||||||
|
"hubert_path": "",
|
||||||
|
"save_uvr_path": "",
|
||||||
|
"TEMP": "",
|
||||||
|
"pretrained": "",
|
||||||
|
}
|
||||||
|
|
||||||
|
with open(env_file_path, "w") as env_file:
|
||||||
|
for key, value in default_values.items():
|
||||||
|
env_file.write(f"{key}={value}\n")
|
||||||
|
|
||||||
|
click.echo(f"{env_file_path} created successfully.")
|
||||||
|
else:
|
||||||
|
click.echo(f"{env_file_path} already exists, no change")
|
||||||
|
|||||||
Reference in New Issue
Block a user