Questions tagged [system.commandline]

27 questions
0
votes
1 answer

System.CommandLine mutally exclusive options

I am using System.CommandLine and I wanted to create a mutually exclusive option. The user either has to use --ipAddresses and pass in list of one or more IP addresses OR use --ipAddressesCsv and pass in a file path containing the CSV file. I am…
Node.JS
  • 1,042
  • 6
  • 44
  • 114
0
votes
0 answers

How to expose System.CommandLine arguments to HostedServices

There is a nice example, how to use System.Commanline with Host: https://github.com/dotnet/command-line-api/tree/main/samples/HostingPlayground I want to start more HostedServices to make some background tasks, but they alse need the command line…
Aaaaaaaa
  • 2,015
  • 3
  • 22
  • 40
0
votes
1 answer

How to ignore unrecognized command line parameters

I'm testing out System.CommandLine. There will be several options passed to my executable, but I only care about one of them. If I don't define them all, I will get errors: Unrecognized command or argument '-i'. Unrecognized command or argument…
briddums
  • 1,826
  • 18
  • 31
0
votes
0 answers

I got unauthorized exception when trying to create a file using File.Create

I have simple code for creating .sql file in some directory. string path = @"C:\Examples\my projects\Database\1.0.0_FirstScript.sql"; File.Create(path); I have checked my folder Database and every user has full control for that directory. But when…
savke
  • 268
  • 1
  • 3
  • 11
0
votes
1 answer

Console System.CommandLine command one liner with options?

I have a .net console app where I'm trying to make the code more concise. Currently to setup a command using System.CommandLine I have something like this: using System.CommandLine; var rootCommand = new RootCommand("CLI"); var theOption = new…
0
votes
1 answer

Value passed to CommandHandler is null

I am trying to learn how to use System.CommandLine. I have created a simple code which need to accept a url and an optional parameter of file path. static async Task Main(string[] args) { var cmd = new RootCommand("Save URL…
0
votes
0 answers

Scripting option for CLI utilizing .NET System.Commandline

Just now starting to implement a command line interface utilizing the new System.Commandline package and using the approach of the SCL example project. Which I really like, thanks for that. The client more or less maps the console input to gRPC…
0
votes
1 answer

C# - Console App - How To Read CLI option arguments

Using the System.CommandLine v.2.0.0-beta3.22114.1 and System.CommandLine.NamingConventionBinder v.2.0.0-beta3.22114.1, I'm attempting to create a simple get command with a --name option. The option is required. It expects an argument, and it will…
0
votes
0 answers

.net 5: System.CommandLine: Exception when argument list is specified whose name begins with option name

Example code: using System; using System.CommandLine; using System.CommandLine.Invocation; using System.Collections.Generic; class Program { static int Main(string[] args) { var rootCommand = new RootCommand { …
user3224237
  • 448
  • 6
  • 12
0
votes
2 answers

How to pass command line arguments to Cake (Frosting), when these arguments are already collected with System.CommandLine?

I'm developing a .net tool for building our projects. I'm using System.CommandLine package for collect command line argument without sweat. My build command looks like this: [Command(Description = "Runs build process")] public class Build …
Sarrus
  • 586
  • 7
  • 21
0
votes
1 answer

System.CommandLine problem with ArgumentArity

I've got this RootCommand: var rootCommand = new RootCommand() { new Argument("search","string to search for") ,new Option(new…
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
1
2