From c988f8731f575ca1898567e7783227ef31909b5c Mon Sep 17 00:00:00 2001 From: Ftps Date: Sun, 21 Jan 2024 01:16:10 +0900 Subject: [PATCH] add env command --- rvc/cli/utils/env.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/rvc/cli/utils/env.py b/rvc/cli/utils/env.py index 818f0cf..0393dd4 100644 --- a/rvc/cli/utils/env.py +++ b/rvc/cli/utils/env.py @@ -1,13 +1,40 @@ """ setup or cleanup enviroment file -usage: rvc env [set / cleanup] +usage: rvc env [create / cleanup] Default: [nowDir/.env] """ +import os + import click -@click.command() +@click.group() def env(): 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")