/// <summary> /// Get a list of all argument objects /// </summary> /// <returns></returns> public static IEnumerable <IArgument> GetAllArguments(this IArguments args) { Assert.ArgumentNotNull(args, nameof(args)); return(args.GetAllPositionals().Cast <IArgument>() .Concat(args.GetAllNamed()) .Concat(args.GetAllFlags()) .Where(p => !p.Consumed)); }
public IEnumerable <IArgument> Access(IArguments args) { var results = new List <IArgument>(); var flags = args.GetAllFlags(); foreach (var flag in flags) { flag.MarkConsumed(); results.Add(new FlagArgument(flag.Name)); } return(results); }
public void Execute() { int index = 0; foreach (var p in _args.GetAllPositionals()) { _output.WriteLine($"{index}: {p.Value}"); index++; } foreach (var n in _args.GetAllNamed()) { _output.WriteLine($"'{n.Name}': {n.Value}"); } foreach (var f in _args.GetAllFlags()) { _output.WriteLine($"flag: {f.Name}"); } }