summaryrefslogtreecommitdiff
path: root/src/Agent.App/Cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/Agent.App/Cli')
-rw-r--r--src/Agent.App/Cli/CommandLine.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Agent.App/Cli/CommandLine.cs b/src/Agent.App/Cli/CommandLine.cs
index df65080..3fdac9f 100644
--- a/src/Agent.App/Cli/CommandLine.cs
+++ b/src/Agent.App/Cli/CommandLine.cs
@@ -6,8 +6,8 @@ public sealed record CommandLine(AppCommand Command, string? ConfigPath, string?
{
public static CommandLine Parse(string[] args)
{
- if (args.Length == 0) throw new CommandLineException("Expected 'serve' or 'check'.");
- AppCommand command = args[0] switch
+ bool implicitServe = args.Length == 0 || args[0].StartsWith("--", StringComparison.Ordinal);
+ AppCommand command = implicitServe ? AppCommand.Serve : args[0] switch
{
"serve" => AppCommand.Serve,
"check" => AppCommand.Check,
@@ -17,7 +17,7 @@ public sealed record CommandLine(AppCommand Command, string? ConfigPath, string?
string? config = null;
string? language = null;
string? transport = null;
- for (int i = 1; i < args.Length; i++)
+ for (int i = implicitServe ? 0 : 1; i < args.Length; i++)
{
string option = args[i];
if (i + 1 >= args.Length) throw new CommandLineException($"Missing value for '{option}'.");