GithubHelp home page GithubHelp logo

Comments (3)

BryanWilhite avatar BryanWilhite commented on June 2, 2024

the current bright idea is to use the IActivityExtensions class to Parse() and DisplayHelp().

from songhaycore.

BryanWilhite avatar BryanWilhite commented on June 2, 2024

the latest bright idea is to pass args to the constructor of ActivitiesGetter to get Activity arguments and Activity name; the conventional help system should be part of ProgramArgs

from songhaycore.

BryanWilhite avatar BryanWilhite commented on June 2, 2024

This test, ShouldGetActivityFromDefaultName(), passes, addressing this issue.

Piggy-backed on this issue was coverage of the JsonConfiguration class for .NET Standard 2.0. Specifically, TraceSourceExtensions.EnsureTraceSource was added to optionally throw an exception when traceSource is null.

MSTEST2 Stuff

Note that the IConfigurationBuilderExtensions.WithSettingsJsonFile extension method looks for a basePath in the current directory or will turn to Environment.GetCommandLineArgs(). These conventions are not test friendly as MSTEST populates args with its own stuff. The workaround is to set our conventional app-settings.json to copy to the output directory.

One last MSTEST2 thing: since .NET Core does not support declaring trace listeners in configuration, I have to resort to stuff like this:

using (var listener = new TextWriterTraceListener(Console.Out))
{
    traceSource.Listeners.Add(listener);

    var args = new[]
    {
        nameof(GetHelloWorldActivity),
        "--world-name",
        "Saturn"
    };

    var getter = new MyActivitiesGetter(args);
    var activity = getter.GetActivity();
    Assert.IsNotNull(activity);

    activity.Start(getter.Args);

    listener.Flush();
}

Command-Line Help from ProgramArgs

Even though this issue is resolved, I would like to break the rules and tack on command-line help support around the recently added ProgramArgs.HelpSet property.

from songhaycore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.