Merge pull request #3 from microsoft/dev/sknam/add-commandline-parser · microsoft/VSConfigFinder@67737f1 (original) (raw)

1

1

`namespace VSConfigFinder

`

2

2

`{

`

3

``

`-

internal class CommandLineOptions : ICommandLineOptions

`

4

``

`-

{

`

5

``

`-

public CommandLineOptions(string filePath, string output)

`

6

``

`-

{

`

7

``

`-

Utilities.ValidateIsNotNullOrEmpty(filePath, nameof(filePath));

`

8

``

`-

Utilities.ValidateOutputParameter(output, nameof(output));

`

9

``

-

10

``

`-

FilePath = filePath;

`

11

``

`-

Output = output;

`

12

``

`-

}

`

``

3

`+

using CommandLine;

`

13

4

``

14

``

`-

public string FilePath { get; set; }

`

``

5

`+

///

`

``

6

`+

public class CommandLineOptions : ICommandLineOptions

`

``

7

`+

{

`

``

8

`+

///

`

``

9

`+

[Option("folderpath", Required = true, HelpText = "Set the source folder path to use as the root. The search will start from the root towards the bottom.")]

`

``

10

`+

public string FolderPath { get; set; }

`

15

11

``

16

``

`-

public string Output { get; set; }

`

``

12

`+

///

`

``

13

`+

[Option("createfile", Required = false, HelpText = "Set the folder path to output the consolidated .vsconfig.\n" +

`

``

14

`+

"If the argument (--createfile) is not passed at all, the program will output the cli arguments that can be fed into the Visual Studio Installer setup arguments. (e.g. --add Microsoft.VisualStudio.Component.Roslyn.Compiler Microsoft.Net.Component.4.8.SDK)\n" +

`

``

15

`+

"If the argument is passed without a following folder path, the program will create and output the final .vsconfig into the current directory.\n" +

`

``

16

`+

"If the argument is passed with a following folder path, the program will create and output the final .vsconfig into the specified folder path that is followed by --createFile.")]

`

``

17

`+

public string? CreateFile { get; set; }

`

17

18

`}

`

18

19

`}

`