Esempio n. 1
0
        public J4JCommandLineProvider(J4JCommandLineSource source)
        {
            Source = source;

            // watch for changes, to the command line text
            // and the OptionsCollection
            Source.SourceChanged += OnSourceChanged;
        }
        public static IConfigurationBuilder AddJ4JCommandLine(this IConfigurationBuilder builder,
                                                              IParser parser,
                                                              out CommandLineSource?cmdLineSource,
                                                              IJ4JLogger?logger = null,
                                                              params ICleanupTokens[] cleanupTokens)
        {
            var source = new J4JCommandLineSource(parser,
                                                  logger,
                                                  cleanupTokens);

            builder.Add(source);

            cmdLineSource = source.CommandLineSource;

            return(builder);
        }
        public static IConfigurationBuilder AddJ4JCommandLine(this IConfigurationBuilder builder,
                                                              IServiceProvider svcProvider,
                                                              out OptionCollection?options,
                                                              out CommandLineSource?cmdLineSource,
                                                              params ICleanupTokens[] cleanupTokens)
        {
            var source = new J4JCommandLineSource(svcProvider.GetRequiredService <IParser>(),
                                                  svcProvider.GetRequiredService <IJ4JLogger>(),
                                                  cleanupTokens);

            builder.Add(source);

            cmdLineSource = source.CommandLineSource;
            options       = source.Parser?.Collection;

            return(builder);
        }