-
Notifications
You must be signed in to change notification settings - Fork 645
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
Alternate install command for global tools packages on the packages page #5684
Changes from all commits
72e0e1b
b78618b
2bf94c5
0596327
33821e4
1172511
ba21841
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 |
---|---|---|
|
@@ -6,34 +6,54 @@ | |
|
||
var absolutePackageUrl = Url.Absolute(Url.Package(Model.Id)); | ||
|
||
var packageManagers = new PackageManagerViewModel[] | ||
PackageManagerViewModel[] packageManagers; | ||
|
||
if (Model.IsDotnetToolPackageType) | ||
{ | ||
new PackageManagerViewModel() | ||
packageManagers = new PackageManagerViewModel[] | ||
{ | ||
Id = "package-manager", | ||
Name = "Package Manager", | ||
CommandPrefix = "PM> ", | ||
InstallPackageCommand = string.Format("Install-Package {0} -Version {1}", Model.Id, Model.Version) | ||
}, | ||
|
||
new PackageManagerViewModel() | ||
new PackageManagerViewModel() | ||
{ | ||
Id = "dotnet-cli", | ||
Name = ".NET CLI", | ||
CommandPrefix = "> ", | ||
InstallPackageCommand = string.Format("dotnet tool install --global {0} --version {1}", Model.Id, Model.Version), | ||
AlertLevel = AlertLevel.Info, | ||
AlertMessage = string.Format("This package contains a <a href=\"{0}\">.NET Core Global Tool</a> you can call from the shell/command line.", "https://aka.ms/global-tools"), | ||
} | ||
}; | ||
} | ||
else | ||
{ | ||
packageManagers = new PackageManagerViewModel[] | ||
{ | ||
Id = "dotnet-cli", | ||
Name = ".NET CLI", | ||
CommandPrefix = "> ", | ||
InstallPackageCommand = string.Format("dotnet add package {0} --version {1}", Model.Id, Model.Version) | ||
}, | ||
new PackageManagerViewModel() | ||
{ | ||
Id = "package-manager", | ||
Name = "Package Manager", | ||
CommandPrefix = "PM> ", | ||
InstallPackageCommand = string.Format("Install-Package {0} -Version {1}", Model.Id, Model.Version) | ||
}, | ||
|
||
new ThirdPartyPackageManagerViewModel() | ||
{ | ||
Id = "paket-cli", | ||
Name = "Paket CLI", | ||
CommandPrefix = "> ", | ||
InstallPackageCommand = string.Format("paket add {0} --version {1}", Model.Id, Model.Version), | ||
ContactUrl = "https://fsprojects.github.io/Paket/contact.html" | ||
}, | ||
}; | ||
new PackageManagerViewModel() | ||
{ | ||
Id = "dotnet-cli", | ||
Name = ".NET CLI", | ||
CommandPrefix = "> ", | ||
InstallPackageCommand = string.Format("dotnet add package {0} --version {1}", Model.Id, Model.Version) | ||
}, | ||
|
||
new ThirdPartyPackageManagerViewModel("https://fsprojects.github.io/Paket/contact.html") | ||
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. Why even keep 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. The third party manager message is consistent, having it in the model will remove the need for duplication of that string. |
||
{ | ||
Id = "paket-cli", | ||
Name = "Paket CLI", | ||
CommandPrefix = "> ", | ||
InstallPackageCommand = string.Format("paket add {0} --version {1}", Model.Id, Model.Version), | ||
} | ||
}; | ||
} | ||
} | ||
|
||
@section SocialMeta { | ||
@if (!String.IsNullOrWhiteSpace(ViewBag.FacebookAppID)) | ||
{ | ||
|
@@ -96,13 +116,23 @@ | |
</button> | ||
</div> | ||
</div> | ||
@if (thirdPartyPackageManager != null) | ||
|
||
@switch (packageManager.AlertLevel) | ||
{ | ||
@ViewHelpers.AlertWarning( | ||
@<text> | ||
The NuGet Team does not provide support for this client. | ||
Please contact its <a href="@thirdPartyPackageManager.ContactUrl">maintainers</a> for support. | ||
</text>) | ||
case AlertLevel.Info: | ||
@ViewHelpers.AlertInfo( | ||
@<text> | ||
@Html.Raw(packageManager.AlertMessage) | ||
</text>); | ||
break; | ||
case AlertLevel.Warning: | ||
@ViewHelpers.AlertWarning( | ||
@<text> | ||
@Html.Raw(packageManager.AlertMessage) | ||
</text>); | ||
break; | ||
default: | ||
break; | ||
} | ||
</div> | ||
} | ||
|
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.
Why
set
?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.
No particular reason.
I was following the conventions, because all of the above fields had setters as well, despite only being initialized in the constructor.
I can remove it though