Skip to content

Commit a2f7448

Browse files
authored
feat(compliance-fall-21): Exclude non-localizable fields from CLI help output (#655)
1 parent bff2b05 commit a2f7448

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/CLI/Program.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Axe.Windows.Automation;
55
using CommandLine;
6+
using CommandLine.Text;
67
using System;
78
using System.IO;
89
using System.Threading;
@@ -59,8 +60,18 @@ private int Run()
5960
{
6061
using (var parser = CaseInsensitiveParser())
6162
{
62-
parser.ParseArguments<Options>(_args)
63-
.WithParsed<Options>(RunWithParsedInputs);
63+
ParserResult<Options> parserResult = parser.ParseArguments<Options>(_args);
64+
parserResult.WithParsed(RunWithParsedInputs)
65+
.WithNotParsed(_ =>
66+
{
67+
HelpText helpText = HelpText.AutoBuild(parserResult, h =>
68+
{
69+
h.AutoHelp = false; // hides --help
70+
h.AutoVersion = false; // hides --version
71+
return HelpText.DefaultParsingErrorsHandler(parserResult, h);
72+
}, e => e);
73+
_writer.WriteLine(helpText);
74+
});
6475
}
6576
}
6677
#pragma warning disable CA1031

src/CLI/README.MD

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ Copyright c 2020
3636
a default of 0.
3737
3838
--customuia The path to a configuration file specifying custom UI Automation attributes
39-
40-
--help Display this help screen.
41-
42-
--version Display version information.
4339
```
4440

4541
To scan an application, you need to specify the application's process via either the `--processId` or `--processName` parameters

0 commit comments

Comments
 (0)