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 3737 <div >
3838 <h2 local-class =" heading" >Install</h2 >
3939
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 >
4157 {{ #if (is-clipboard-supported )}}
4258 <CopyButton
4359 @copyText ={{ this.tomlSnippet }}
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ export default class CrateSidebar extends Component {
1414 return homepage && ( ! repository || simplifyUrl ( repository ) !== simplifyUrl ( homepage ) ) ;
1515 }
1616
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+
1723 get tomlSnippet ( ) {
1824 return `${ this . args . crate . name } = "${ this . args . version . num } "` ;
1925 }
Original file line number Diff line number Diff line change 4747 <CrateSidebar
4848 @crate ={{ this.crate }}
4949 @version ={{ this.currentVersion }}
50+ @requestedVersion ={{ this.requestedVersion }}
5051 local-class =" sidebar"
5152 />
5253 </div >
You can’t perform that action at this time.
0 commit comments