Skip to content

Commit cae107b

Browse files
committed
Add version to cargo add on version detail page
1 parent e9e587f commit cae107b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app/components/crate-sidebar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export default class CrateSidebar extends Component {
1515
}
1616

1717
get cargoAddCommand() {
18-
return `cargo add ${this.args.crate.name}`;
18+
return this.args.requestedVersion
19+
? `cargo add ${this.args.crate.name}@${this.args.requestedVersion}`
20+
: `cargo add ${this.args.crate.name}`;
1921
}
2022

2123
get tomlSnippet() {

app/templates/crate/version.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<CrateSidebar
4848
@crate={{this.crate}}
4949
@version={{this.currentVersion}}
50+
@requestedVersion={{this.requestedVersion}}
5051
local-class="sidebar"
5152
/>
5253
</div>

0 commit comments

Comments
 (0)