Skip to content

chore(Tests): Add learning/doc test re AltCommandLine -d#232

Merged
bartelink merged 1 commit intofsprojects:masterfrom
bartelink:nestedaliases
Feb 28, 2024
Merged

chore(Tests): Add learning/doc test re AltCommandLine -d#232
bartelink merged 1 commit intofsprojects:masterfrom
bartelink:nestedaliases

Conversation

@bartelink
Copy link
Copy Markdown
Member

@bartelink bartelink commented Feb 28, 2024

I got tied up in knots suspecting a bug in Argu using locally installed dotnet tools (I always install globally and hence it just works)

Invocation was

propulsion sync cosmos -s $EQUINOX_COSMOS_CONNECTION -d $EQUINOX_COSMOS_DATABASE -c $EQUINOX_COSMOS_CONTAINER  \
    from cosmos -s $EQUINOX_COSMOS_CONNECTION -d sourcedb -c sourcecontainer

So I added naively added a dotnet before toolname to shut it up

Which resulted in a ERROR: unrecognized argument: 'equinox-common-test'. message

Which could only be fixed by replacing the two -d cases (which are AltCommandLine aliases) with the raw name (--database)

Hence this test, which proves nothing new, except that it's pretty naive to assume that Eirik left some wacky bugs in here!

Of course the actual problem is my stupidity, which has a proposed solution: dotnet/sdk#14626

The real solution until that issue is addressed in 14626 is to prefix local runs with dotnet tool run

@bartelink bartelink changed the title chore(Tests): Add learning/doc test re AltCommandLine chore(Tests): Add learning/doc test re AltCommandLine -d Feb 28, 2024
@bartelink bartelink merged commit 40e0e26 into fsprojects:master Feb 28, 2024
@bartelink bartelink deleted the nestedaliases branch February 28, 2024 10:30
@bartelink
Copy link
Copy Markdown
Member Author

One more way of getting stung by the same thing is to naively do dotnet run toolname <args>, which, for the above yields:
(coz dotnet run has a -c switch but no -d!)

System.InvalidOperationException: Option '-c' only accepts a single argument but 2 were provided.
   at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result)
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]()
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption(Option option)
   at System.CommandLine.ParseResult.GetValueForOption(Option option)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants