Skip to content

Showvariable paramter fix #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Showvariable paramter fix #447

wants to merge 4 commits into from

Conversation

KyleOndy
Copy link
Contributor

Working on #403. I am unfamiliar with reflection so I am not sure I am even on the right path here. I will look into writing some tests shortly.

@@ -12,7 +12,7 @@ public class ArgumentParser
{
static ArgumentParser()
{
var fields = typeof(VariableProvider).GetFields(BindingFlags.Public | BindingFlags.Static);
var fields = typeof(VersionVariables).GetProperties();
VersionParts = fields.Select(x => x.Name.ToLower()).ToArray();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should actually be able to just do new VariableProvider().AvailableVariables now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see an 'AvailableVariables' property contined in VersionVariables. To access that property I need to instantiate a new VersionVariables instance, either directly

new VersionVariables(...).AvailableVariables()

or through

VariableProvider.GetVariablesFor(...).AvailableVariables()

@KyleOndy
Copy link
Contributor Author

I see I failed the CI build. I'll take a better look at this tonight.

@JakeGinnivan
Copy link
Contributor

Using directive is not required by the code and can be safely removed

using System.Reflection is not needed anymore

@JakeGinnivan
Copy link
Contributor

One additional thing which would be good is to make a better error message when the variable doesn't exist.

At the moment:
.\GitVersionExe\bin\Debug\GitVersion.exe /showvariable SemVer2
Failed to parse arguments: /showvariable SemVer2

I would like

Variable SemVer2 doesn't exist, available variables:
....
list them all
....

Do you think you could do that as part of this PR? Otherwise this looks good

@JakeGinnivan
Copy link
Contributor

@KyleOndy any thoughts on extending this PR to list available variables before I merge?

@KyleOndy
Copy link
Contributor Author

KyleOndy commented Jun 8, 2015

Let me clean up what I have and get some tests written.

@JakeGinnivan
Copy link
Contributor

@KyleOndy how did you go?

@JakeGinnivan
Copy link
Contributor

Superseded by #482

@KyleOndy Thanks for the contribution anyways :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants