fix: use the default value on enter, read username from cli arguments
All checks were successful
Update changelog / changelog (push) Successful in 26s

This commit is contained in:
2025-12-11 15:39:40 +01:00
parent f648a73cb2
commit efb8a41065
2 changed files with 14 additions and 7 deletions

View File

@@ -1,6 +1,5 @@
using Shadow.Data; using Shadow.Data;
using Shadow.Entities; using Shadow.Entities;
using System.Security;
namespace Shadow.Controllers; namespace Shadow.Controllers;
public class Cli public class Cli
@@ -91,6 +90,8 @@ public class Cli
while (username is null || username == String.Empty) while (username is null || username == String.Empty)
username = ReadName(" Please enter a username: "); username = ReadName(" Please enter a username: ");
} }
else
username = args[1];
// Check if user by this name exists in DB // Check if user by this name exists in DB
User? foundUser = db.Users User? foundUser = db.Users
@@ -141,6 +142,8 @@ public class Cli
while (username is null || username == String.Empty) while (username is null || username == String.Empty)
username = ReadName(" Please enter a username: "); username = ReadName(" Please enter a username: ");
} }
else
username = args[1];
// Check if user by this name exists in DB // Check if user by this name exists in DB
User? foundUser = db.Users User? foundUser = db.Users
@@ -185,6 +188,8 @@ public class Cli
while (username is null || username == String.Empty) while (username is null || username == String.Empty)
username = ReadName(" Please enter the username: "); username = ReadName(" Please enter the username: ");
} }
else
username = args[1];
// Check if user by this name exists in DB // Check if user by this name exists in DB
User? foundUser = db.Users User? foundUser = db.Users
@@ -283,6 +288,7 @@ public class Cli
while (!exit) while (!exit)
{ {
if (input is not null && input.Length > 0) if (input is not null && input.Length > 0)
{
if (input.ToLower().StartsWith("y")) if (input.ToLower().StartsWith("y"))
{ {
response = true; response = true;
@@ -293,6 +299,7 @@ public class Cli
response = false; response = false;
exit = true; exit = true;
} }
}
else if (default_value is not null) else if (default_value is not null)
{ {
response = (bool)default_value; response = (bool)default_value;