Skip to content

Commit d1bc6b5

Browse files
authored
fix(docs): -- is necessary for npm run to pass options to underlying command (tauri-apps#144)
* fix(docs): -- is necessary for `npm run` to pass options to underlying command * fix(docs): fix default value of command tabs
1 parent 7b67335 commit d1bc6b5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/theme/Command.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ const types = [
1010
{ label: 'Global', value: 'tauri ' },
1111
]
1212

13+
function insertDashDashBeforeOption (value, name) {
14+
const idx = name.indexOf('--')
15+
if (idx === -1) {
16+
return value + name
17+
}
18+
return value + name.slice(0, idx) + '-- ' + name.slice(idx)
19+
}
20+
1321
export default ({ name }) => {
1422
return (
15-
<Tabs groupId="installMode" defaultValue="yarn" values={types}>
23+
<Tabs groupId="installMode" defaultValue="Yarn" values={types}>
1624
{types.map((type) => (
1725
<TabItem value={type.value}>
1826
<CodeBlock className="language-sh">
19-
{type.value + name}
27+
{type.label !== 'npm' ? type.value + name : insertDashDashBeforeOption(type.value, name)}
2028
</CodeBlock>
2129
</TabItem>
2230
))}

0 commit comments

Comments
 (0)