Skip to content
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

Can you provide better examples in docs? #21

Open
oliverjanik opened this issue Mar 14, 2014 · 5 comments
Open

Can you provide better examples in docs? #21

oliverjanik opened this issue Mar 14, 2014 · 5 comments

Comments

@oliverjanik
Copy link

Can you add more examples how to use your API. E.g. Help section?

Calling CreateAndBind simply throws exceptions on wrong params.

@itreptil
Copy link

Hi.
You can find a Testfixture for the Help section here - https://github.com/little-sharps/args/blob/master/Args.Tests/HelpProviderTest.cs

Attributes used from System.ComponentModel namespace whenever possible

eg.

    [ArgsModel(SwitchDelimiter = "//")]
    [SimpleResourceMemberHelp("This is my console application")]
    public class HelpClassTest
    {
        [System.ComponentModel.Description("This is the Id")]
        public int Id { get; set; }

        [System.ComponentModel.Description("This is the name you should put in.")]
        public string Name { get; set; }

        [System.ComponentModel.Description("Force it!")]
        public bool Switch { get; set; }

        [System.ComponentModel.Description("Effective date")]
        [ArgsMemberSwitch(0)]
        public DateTime Date { get; set; }


    }

@ernestochaves
Copy link

Not sure if anyone will ever see this, but after looking at the tests, still have no idea how to use the help document in an app. Are there any docs?

@cbrianball
Copy link
Member

@ernestochaves Can you please be more specific in what you are asking? If you are asking how to output the help text, please see the following test:

[Test]
public void VerifyHelpOutput()
{
var definition = Configuration.Configure<HelpModelTest>();
var help = new Help.HelpProvider().GenerateModelHelp(definition);
var f = new ConsoleHelpFormatter(80, 1, 5);
Assert.AreEqual(HelpOutput, f.GetHelp(help));
}

To output the help text to the console, then pass in the generated text to Console.WriteLine(...).

@ernestochaves
Copy link

Thanks. I see how that would work now. I figured in my mind that after configuration the app would just show help message after -help switch was invoked. Very kind of you to answer. Thanks.

@cbrianball
Copy link
Member

@ernestochaves No problem. This issue is still open because I acknowledge there isn't enough documentation for most use-cases.

It isn't the goal of Args to "take over" the command-line experience, but simply to make it easier to read data passed into your console application. Thanks!

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

No branches or pull requests

4 participants