-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSOE-165: Fixing NuGet publishing for repositories without an sln file #30
Conversation
@@ -16,7 +16,16 @@ | |||
|
|||
param([array] $Arguments) | |||
|
|||
foreach ($project in (dotnet sln list | Select-Object -Skip 2 | Get-Item)) | |||
if (!(Get-ChildItem *.sln)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick with -not
for neqation instead of the undocumented exclamation mark. However if you swap the if-else then you don't need any negation in the first place and save an extra pair of parens too.
Also Test-Path
would be more expressive here than Get-ChildItem
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the first one something the analyzers should catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it should. I've opened an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
if (!(Get-ChildItem *.sln)) | ||
{ | ||
$projects = Get-ChildItem *.csproj | ||
} | ||
else | ||
{ | ||
$projects = (dotnet sln list | Select-Object -Skip 2 | Get-Item) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In PowerShell statements return a value too. This is so beautiful it brings tears to my eyes.
So you can do
$projects = if ( ... )
{
}
else
{
}
instead of assigning to the variable in each branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 or 😢 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like poor man's ternary operator to me! Fortunately, PS 7 has actual ternary operators. I briefly contemplated keeping Windows PowerShell compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more like a rich man's ternary operator because you can have multiple expressions in each arm so it's more powerful than a ternary. But yes, please use ternary then. This repo is already not compatible with Windows PowerShell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, and it's lavish with all the characters. Almost like showing off! :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D
OSOE-165