Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ internal CommandOption Configure(CommandLineApplication app, Type type, Func<obj
};
}

return app.VersionOption(Template, shortFormGetter, longFormGetter);
var option = app.VersionOption(Template, shortFormGetter, longFormGetter);
Configure(option);
return option;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using Xunit;

namespace McMaster.Extensions.CommandLineUtils.Tests
Expand Down Expand Up @@ -67,5 +68,19 @@ public void ThrowWhenMemberDoesNotExist()
});
Assert.Equal(Strings.NoPropertyOrMethodFound("Version", typeof(MissingMethod)), ex.Message);
}

[VersionOptionFromMember(Description = "42")]
private class Description
{
}

[Fact]
public void GetsDescriptionFromOption()
{
var app = new CommandLineApplication<Description>();
app.Conventions.UseVersionOptionFromMemberAttribute();

Assert.Equal("42", app.Options.First().Description);
}
}
}