Skip to content

Commit 44e08cb

Browse files
committed
Fix automatic handling of required input_path argument.
1 parent acbbe26 commit 44e08cb

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

ServerCodeExciser/ServerCodeExciser.cs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,9 @@ public sealed class Settings : CommandSettings
6161
[Description("Ensure that all files can be analyzed without syntactic or lexicographical errors.")]
6262
public bool StrictMode { get; init; }
6363

64-
[CommandArgument(0, "[INPUT]")]
64+
[CommandArgument(0, "<INPUT_PATH>")]
6565
[Description("The input folder to excise.")]
66-
public string InputPath { get; init; } = string.Empty;
67-
68-
public override ValidationResult Validate()
69-
{
70-
if (InputPath.Length <= 0)
71-
{
72-
return ValidationResult.Error("Must provide at least one input path!");
73-
}
74-
75-
return base.Validate();
76-
}
66+
public string? InputPath { get; init; }
7767
}
7868

7969
class RootPaths
@@ -113,7 +103,7 @@ public override int Execute([NotNull] CommandContext context, [NotNull] Settings
113103
return (int)EExciserReturnValues.InternalExcisionError;
114104
}
115105
}
116-
else if(Directory.Exists(settings.InputPath))
106+
else if (Directory.Exists(settings.InputPath))
117107
{
118108
parameters.InputPaths.Add(settings.InputPath);
119109
}
@@ -152,14 +142,7 @@ public class ServerCodeExciser
152142
{
153143
public static int Main(string[] args)
154144
{
155-
if (args.Length < 1)
156-
{
157-
Console.Error.WriteLine("You must provide an input path to read input files from as the first argument.");
158-
return (int)EExciserReturnValues.BadInputPath;
159-
}
160-
161-
var app = new CommandApp<ServerCodeExciserCommand>();
162-
return app.Run(args);
145+
return new CommandApp<ServerCodeExciserCommand>().Run(args);
163146
}
164147
}
165148
}

0 commit comments

Comments
 (0)