|
28 | 28 | { |
29 | 29 | packageManagers = new PackageManagerViewModel[] |
30 | 30 | { |
31 | | - new PackageManagerViewModel(".NET CLI") |
| 31 | + new PackageManagerViewModel(".NET CLI (Global)") |
32 | 32 | { |
33 | | - Id = "dotnet-cli", |
| 33 | + Id = "dotnet-cli-global", |
| 34 | + CommandPrefix = "> ", |
| 35 | + InstallPackageCommands = new [] { string.Format("dotnet tool install --global {0} --version {1}", Model.Id, Model.Version) }, |
| 36 | + AlertLevel = AlertLevel.Info, |
| 37 | + AlertMessage = "This package contains a <a href='https://aka.ms/global-tools'>.NET tool</a> you can call from the shell/command line.", |
| 38 | + }, |
| 39 | + |
| 40 | + new PackageManagerViewModel(".NET CLI (Local)") |
| 41 | + { |
| 42 | + Id = "dotnet-cli-local", |
34 | 43 | CommandPrefix = "> ", |
35 | | - InstallPackageCommand = string.Format("dotnet tool install --global {0} --version {1}", Model.Id, Model.Version), |
| 44 | + InstallPackageCommands = new [] |
| 45 | + { |
| 46 | + "dotnet new tool-manifest # if you are setting up this repo", |
| 47 | + string.Format("dotnet tool install --local {0} --version {1}", Model.Id, Model.Version), |
| 48 | + }, |
36 | 49 | AlertLevel = AlertLevel.Info, |
37 | | - AlertMessage = "This package contains a <a href='https://aka.ms/global-tools'>.NET Core Global Tool</a> you can call from the shell/command line.", |
| 50 | + AlertMessage = "This package contains a <a href='https://aka.ms/global-tools'>.NET tool</a> you can call from the shell/command line.", |
38 | 51 | }, |
39 | 52 |
|
40 | 53 | new ThirdPartyPackageManagerViewModel("Cake", "https://cakebuild.net/support/nuget") |
41 | 54 | { |
42 | 55 | Id = "cake-dotnet-tool", |
43 | | - InstallPackageCommand = Model.GetCakeInstallPackageCommand(), |
| 56 | + InstallPackageCommands = new [] { Model.GetCakeInstallPackageCommand() }, |
44 | 57 | }, |
45 | 58 | }; |
46 | 59 | } |
|
52 | 65 | { |
53 | 66 | Id = "dotnet-cli", |
54 | 67 | CommandPrefix = "> ", |
55 | | - InstallPackageCommand = string.Format("dotnet new --install {0}::{1}", Model.Id, Model.Version), |
| 68 | + InstallPackageCommands = new [] { string.Format("dotnet new --install {0}::{1}", Model.Id, Model.Version) }, |
56 | 69 | AlertLevel = AlertLevel.Info, |
57 | 70 | AlertMessage = "This package contains a <a href='https://aka.ms/dotnet-new'>.NET Core Template Package</a> you can call from the shell/command line.", |
58 | 71 | } |
|
66 | 79 | { |
67 | 80 | Id = "package-manager", |
68 | 81 | CommandPrefix = "PM> ", |
69 | | - InstallPackageCommand = string.Format("Install-Package {0} -Version {1}", Model.Id, Model.Version) |
| 82 | + InstallPackageCommands = new [] { string.Format("Install-Package {0} -Version {1}", Model.Id, Model.Version) }, |
70 | 83 | }, |
71 | 84 |
|
72 | 85 | new PackageManagerViewModel(".NET CLI") |
73 | 86 | { |
74 | 87 | Id = "dotnet-cli", |
75 | 88 | CommandPrefix = "> ", |
76 | | - InstallPackageCommand = string.Format("dotnet add package {0} --version {1}", Model.Id, Model.Version) |
| 89 | + InstallPackageCommands = new [] { string.Format("dotnet add package {0} --version {1}", Model.Id, Model.Version) }, |
77 | 90 | }, |
78 | 91 |
|
79 | 92 | new PackageManagerViewModel("PackageReference") |
80 | 93 | { |
81 | 94 | Id = "package-reference", |
82 | | - InstallPackageCommand = Model.DevelopmentDependency |
| 95 | + InstallPackageCommands = new [] { Model.DevelopmentDependency |
83 | 96 | ? string.Format(string.Join(Environment.NewLine, |
84 | 97 | "<PackageReference Include=\"{0}\" Version=\"{1}\">", |
85 | 98 | " <PrivateAssets>all</PrivateAssets>", |
86 | 99 | " <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>", |
87 | 100 | "</PackageReference>"), Model.Id, Model.Version) |
88 | | - : string.Format("<PackageReference Include=\"{0}\" Version=\"{1}\" />", Model.Id, Model.Version), |
| 101 | + : string.Format("<PackageReference Include=\"{0}\" Version=\"{1}\" />", Model.Id, Model.Version) }, |
89 | 102 | AlertLevel = AlertLevel.Info, |
90 | 103 | AlertMessage = string.Format("For projects that support <a href=\"{0}\">PackageReference</a>, copy this XML node into the project file to reference the package.", |
91 | 104 | "https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files"), |
|
96 | 109 | { |
97 | 110 | Id = "paket-cli", |
98 | 111 | CommandPrefix = "> ", |
99 | | - InstallPackageCommand = string.Format("paket add {0} --version {1}", Model.Id, Model.Version), |
| 112 | + InstallPackageCommands = new [] { string.Format("paket add {0} --version {1}", Model.Id, Model.Version) }, |
100 | 113 | }, |
101 | 114 |
|
102 | 115 | new PackageManagerViewModel("F# Interactive") |
103 | 116 | { |
104 | 117 | Id = "fsharp-interactive", |
105 | 118 | CommandPrefix = "> ", |
106 | | - InstallPackageCommand = string.Format("#r \"nuget: {0}, {1}\"", Model.Id, Model.Version), |
| 119 | + InstallPackageCommands = new [] { string.Format("#r \"nuget: {0}, {1}\"", Model.Id, Model.Version) }, |
107 | 120 | AlertLevel = AlertLevel.Info, |
108 | 121 | AlertMessage = string.Format( |
109 | 122 | "For F# scripts that support <a href=\"{0}\">#r syntax</a>, copy this into the source code to reference the package.", |
|
113 | 126 | new ThirdPartyPackageManagerViewModel("Cake", "https://cakebuild.net/support/nuget") |
114 | 127 | { |
115 | 128 | Id = Model.IsCakeExtension() ? "cake-extension" : "cake", |
116 | | - InstallPackageCommand = Model.GetCakeInstallPackageCommand() |
| 129 | + InstallPackageCommands = new [] { Model.GetCakeInstallPackageCommand() }, |
117 | 130 | }, |
118 | 131 | }; |
119 | 132 | } |
|
165 | 178 | @helper CommandPanel(PackageManagerViewModel packageManager, bool active) |
166 | 179 | { |
167 | 180 | var thirdPartyPackageManager = packageManager as ThirdPartyPackageManagerViewModel; |
168 | | - |
169 | 181 | <div role="tabpanel" class="tab-pane @(active ? "active" : string.Empty)" id="@packageManager.Id"> |
170 | 182 | <div> |
171 | 183 | <div class="install-script-row"> |
172 | | - <pre class="install-script" id="@packageManager.Id-text">@packageManager.InstallPackageCommand</pre> |
| 184 | + @{ |
| 185 | + var lastIndex = packageManager.InstallPackageCommands.Length - 1; |
| 186 | + var cs = packageManager.InstallPackageCommands.Select((c, i) => i < lastIndex ? c + Environment.NewLine : c); |
| 187 | + } |
| 188 | + @* Writing out the install command must be on a single line to avoid undesired whitespace in the <pre> tag. *@ |
| 189 | + <pre class="install-script" id="@packageManager.Id-text">@foreach (var c in cs) {<span class="install-command-row">@c</span>}</pre> |
173 | 190 | <div class="copy-button"> |
174 | 191 | <!--In order to statisfy the requirement to announce button status both on NVDA/Narrator, other screen reader like NVDA will |
175 | 192 | announce the data-content "Copied" everytime when we press button, however, it won't work with Narrator when we use bootstrap popover |
|
1184 | 1201 | continue; |
1185 | 1202 | } |
1186 | 1203 |
|
1187 | | - packageManagersCss += "#" + packageManager.Id + " .install-script::before {"; |
| 1204 | + packageManagersCss += "#" + packageManager.Id + " .install-command-row::before {"; |
1188 | 1205 | packageManagersCss += " content: \"" + packageManager.CommandPrefix + "\""; |
1189 | 1206 | packageManagersCss += "}"; |
1190 | 1207 | } |
|
0 commit comments