-
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
Changes from 4 commits
3ef12f0
09d984c
4942527
3b9dfee
ff52b9c
3cd4ab8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,16 @@ | |
|
||
param([array] $Arguments) | ||
|
||
foreach ($project in (dotnet sln list | Select-Object -Skip 2 | Get-Item)) | ||
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 commentThe 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. $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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. :D |
||
|
||
foreach ($project in $projects) | ||
{ | ||
Push-Location $project.Directory | ||
|
||
|
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 thanGet-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.