-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial CLI using CommandLineParser (#4197)
* Initial CLI using CommandLineParser * remove extra space * Update options to be single, dash separated words
- Loading branch information
1 parent
d7625df
commit 11e902f
Showing
10 changed files
with
155 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandParserOptions/CLICommandOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using CommandLine; | ||
|
||
namespace Azure.Sdk.Tools.TestProxy.CommandParserOptions | ||
{ | ||
/// <summary> | ||
/// CLICommandOptions contain options common to all CLI Commands (Push, Reset, Restore) | ||
/// </summary> | ||
class CLICommandOptions : DefaultOptions | ||
{ | ||
[Option('a', "assets-json-path", Required = true, HelpText = "Required for Push/Reset/Restore. This should be a path to a valid assets.json within a language repository.")] | ||
public string AssetsJsonPath { get; set; } | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandParserOptions/DefaultOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using CommandLine; | ||
|
||
namespace Azure.Sdk.Tools.TestProxy.CommandParserOptions | ||
{ | ||
/// <summary> | ||
/// DefaultOptions is the base for all CommandParser Verbs. The only options that should go in here are ones common to everything. | ||
/// </summary> | ||
class DefaultOptions | ||
{ | ||
[Option('l', "storage-location", Default = null, HelpText = "The path to the target local git repo. If not provided as an argument, Environment variable TEST_PROXY_FOLDER will be consumed. Lacking both, the current working directory will be utilized.")] | ||
public string StorageLocation { get; set; } | ||
|
||
[Option('p', "storage-plugin", Default = "GitStore", HelpText = "The plugin for the selected storage, default is Git storage is GitStore. (Currently the only option)")] | ||
public string StoragePlugin { get; set; } | ||
|
||
[Option('v', "version", Default = false, HelpText = "Flag. Output the TestProxy version.")] | ||
public bool VersionFlag { get; set; } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandParserOptions/PushOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using CommandLine.Text; | ||
using CommandLine; | ||
|
||
namespace Azure.Sdk.Tools.TestProxy.CommandParserOptions | ||
{ | ||
/// <summary> | ||
/// Any unique options to the push command will reside here. | ||
/// </summary> | ||
[Verb("push", HelpText = "Push the assets, referenced by assets.json, into git.")] | ||
class PushOptions : CLICommandOptions | ||
{ | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandParserOptions/ResetOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using CommandLine; | ||
|
||
namespace Azure.Sdk.Tools.TestProxy.CommandParserOptions | ||
{ | ||
/// <summary> | ||
/// Any unique options to the reset command will reside here. | ||
/// </summary> | ||
[Verb("reset", HelpText = "Reset the assets, referenced by assets.json, from git to their original files referenced by the tag. Will prompt if there's pending changes.")] | ||
class ResetOptions : CLICommandOptions | ||
{ | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandParserOptions/RestoreOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using CommandLine; | ||
|
||
namespace Azure.Sdk.Tools.TestProxy.CommandParserOptions | ||
{ | ||
/// <summary> | ||
/// Any unique options to the restore command will reside here. | ||
/// </summary> | ||
[Verb("restore", HelpText = "Restore the assets, referenced by assets.json, from git.")] | ||
class RestoreOptions : CLICommandOptions | ||
{ | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandParserOptions/StartOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using CommandLine; | ||
using System.Collections.Generic; | ||
|
||
namespace Azure.Sdk.Tools.TestProxy.CommandParserOptions | ||
{ | ||
[Verb("start", isDefault: true, HelpText = "Start the TestProxy.")] | ||
class StartOptions : DefaultOptions | ||
{ | ||
[Option('i', "insecure", Default = false, HelpText = "Flag; Allow insecure upstream SSL certs.")] | ||
public bool Insecure { get; set; } | ||
|
||
[Option('d', "dump", Default = false, HelpText = "Flag; Output configuration values when starting the Test-Proxy.")] | ||
public bool Dump { get; set; } | ||
|
||
// On the command line, use -- and everything after that becomes arguments to Host.CreateDefaultBuilder | ||
// For example Test-Proxy -i -d -- --urls https://localhost:8002 would set AdditionaArgs to a list containing | ||
// --urls and https://localhost:8002 as individual entries. This is converted to a string[] before being | ||
// passed to Host.CreateDefaultBuilder | ||
[CommandLine.Value(0)] | ||
public IEnumerable<string> AdditionalArgs { get; set; } | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters