Closed
Description
If an Argument
's value start with (e.g.) a period or backslash, like a path would, the value is not parsed correctly.
Example:
using System;
using System.Linq;
using Utility.CommandLine;
namespace Foo
{
class Program
{
[Argument('f', "folder")]
private static string Folder { get; set; }
[Operands]
private static string[] Operands { get; set; }
static void Main(string[] args)
{
Arguments.Populate();
Console.WriteLine($"Folder='{Folder}'");
Console.WriteLine($"Operands='{String.Join(';', Operands.Skip(1))}'");
}
}
}
PM> .\foo.exe
Folder=''
Operands=''
PM> .\foo.exe -f
Folder=''
Operands=''
PM> .\foo.exe -f a.txt
Folder='a.txt'
Operands=''
PM> .\foo.exe -f .\a.txt
Folder=''
Operands='.\a.txt'
PM> .\foo.exe -f ..\a.txt
Folder=''
Operands='..\a.txt'
PM> .\foo.exe -f \path\to\a.txt
Folder=''
Operands='\path\to\a.txt'
PM> .\foo.exe -f \\server\path\to\a.txt
Folder=''
Operands='\\server\path\to\a.txt'
Metadata
Metadata
Assignees
Labels
No labels