Guest User

Untitled

a guest
Sep 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // dotnet add package McMaster.Extensions.CommandLineUtils
  2.  
  3. using McMaster.Extensions.CommandLineUtils;
  4. using static Bullseye.Targets;
  5.  
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var app = new CommandLineApplication(throwOnUnexpectedArg: false);
  11. var id = app.Option<string>("--id", "The ID of something to import", CommandOptionType.SingleValue);
  12.  
  13. app.OnExecute(() =>
  14. {
  15. Target("importSomething", () => System.Console.WriteLine($"id={id.Value()}"));
  16. RunTargets(app.RemainingArguments);
  17. });
  18.  
  19. app.Execute(args);
  20. }
  21. }
  22.  
  23. // dotnet run -- --id=123 importSomething
Add Comment
Please, Sign In to add comment