This commit is contained in:
2024-07-26 16:57:28 +02:00
parent 6301bd438a
commit 128ae21088
5 changed files with 22 additions and 19 deletions

View File

@@ -133,12 +133,16 @@ public class DotenvCommand : Command, ISubCommandOf<RootCommand>
private async Task ExecuteAsync(string vars, bool overwrite)
{
var path = Path.Join(Environment.CurrentDirectory, ".env");
var exists = File.Exists(path);
if (exists && !overwrite)
if (File.Exists(path))
{
if (overwrite)
{
await _context.WriteFile(".env", content);
return;
}
Console.WriteLine($"File {path} already exists, add the -o or --overwrite flag to overwrite it.");
return;
}
var content = string.Join(Environment.NewLine, vars.Split(';'));