fix: use the default value on enter, read username from cli arguments
All checks were successful
Update changelog / changelog (push) Successful in 26s
All checks were successful
Update changelog / changelog (push) Successful in 26s
This commit is contained in:
@@ -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,11 +299,12 @@ 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;
|
{
|
||||||
exit = true;
|
response = (bool)default_value;
|
||||||
}
|
exit = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,4 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$schema": "https://json.schemastore.org/launchsettings.json"
|
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user