File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 37
37
<div >
38
38
<h2 local-class =" heading" >Install</h2 >
39
39
40
- <p local-class =" copy-help" >Add the following line to your Cargo.toml file:</p >
40
+ <p local-class =" copy-help" >Run the following Cargo command in your project directory:</p >
41
+ {{ #if (is-clipboard-supported )}}
42
+ <CopyButton
43
+ @copyText ={{ this.cargoAddCommand }}
44
+ title =" Copy command to clipboard"
45
+ local-class =" copy-button"
46
+ >
47
+ <span >{{ this.cargoAddCommand }} </span >
48
+ {{ svg-jar " copy" aria-hidden =" true" local-class =" copy-icon" }}
49
+ </CopyButton >
50
+ {{ else }}
51
+ <code local-class =" copy-fallback" >
52
+ {{ this.cargoAddCommand }}
53
+ </code >
54
+ {{ /if }}
55
+
56
+ <p local-class =" copy-help" >Or add the following line to your Cargo.toml:</p >
41
57
{{ #if (is-clipboard-supported )}}
42
58
<CopyButton
43
59
@copyText ={{ this.tomlSnippet }}
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ export default class CrateSidebar extends Component {
14
14
return homepage && ( ! repository || simplifyUrl ( repository ) !== simplifyUrl ( homepage ) ) ;
15
15
}
16
16
17
+ get cargoAddCommand ( ) {
18
+ return this . args . requestedVersion
19
+ ? `cargo add ${ this . args . crate . name } @${ this . args . requestedVersion } `
20
+ : `cargo add ${ this . args . crate . name } ` ;
21
+ }
22
+
17
23
get tomlSnippet ( ) {
18
24
return `${ this . args . crate . name } = "${ this . args . version . num } "` ;
19
25
}
Original file line number Diff line number Diff line change 47
47
<CrateSidebar
48
48
@crate ={{ this.crate }}
49
49
@version ={{ this.currentVersion }}
50
+ @requestedVersion ={{ this.requestedVersion }}
50
51
local-class =" sidebar"
51
52
/>
52
53
</div >
You can’t perform that action at this time.
0 commit comments