mayuki / Cocona

Micro-framework for .NET console application. Cocona makes it easy and fast to build console applications on .NET.
MIT License
3.22k stars 83 forks source link

Passing an unquoted asterisk from the command line as an argument gets a filename #136

Open sduplooy opened 5 months ago

sduplooy commented 5 months ago

Version: Cocona 2.2.0 Terminal: iTerm2 with zsh OS: MacOS Sonoma 14.4

Something strange happens when passing an unquoted asterisk as the value of an argument. Consider the below test runs and output below:

CoconaStarBug$ dotnet run -- set key-1 value-1
(key-1,value-1)
CoconaStarBug$ dotnet run -- set key-1 *
(key-1,CoconaStarBug.csproj)

As you can see in the second execution Console.Writeline() prints CoconaStarBug.csproj and not the asterisk as one would expect. If I place the in double-quotes it works correctly. Why is that? Is it that gets a listing of the files in the current directory and picks the first filename? Is it that Cocona doesn't consider special characters as strings?

See the attached example. CoconaStarBug.zip