Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve CLI shortcuts help display #11247

Merged
merged 2 commits into from Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/vite/src/node/logger.ts
Expand Up @@ -153,9 +153,10 @@ export function printServerUrls(
info(` ${colors.green('➜')} ${colors.bold('Network')}: ${colorUrl(url)}`)
}
if (urls.network.length === 0 && optionsHost === undefined) {
const note = `use ${colors.reset(colors.bold('--host'))} to expose`
info(
colors.dim(` ${colors.green('➜')} ${colors.bold('Network')}: ${note}`),
colors.dim(` ${colors.green('➜')} ${colors.bold('Network')}: use `) +
colors.bold('--host') +
colors.dim(' to expose'),
)
}
}
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/index.ts
Expand Up @@ -306,7 +306,7 @@ export interface ViteDevServer {
* @internal
* Actually BindShortcutsOptions | undefined but api-extractor checks for
* export before trimming internal types :(
* And I don't want to complexity prePatchTypes for that
* And I don't want to add complexity to prePatchTypes for that
*/
_shortcutsOptions: any | undefined
}
Expand Down
10 changes: 6 additions & 4 deletions packages/vite/src/node/shortcuts.ts
Expand Up @@ -50,14 +50,16 @@ export function bindShortcuts(

if (input === 'h') {
server.config.logger.info(
shortcuts
.map(
[
'',
colors.bold(' Shortcuts'),
...shortcuts.map(
(shortcut) =>
colors.dim(' press ') +
colors.bold(shortcut.key) +
colors.dim(` to ${shortcut.description}`),
)
.join('\n'),
),
].join('\n'),
)
}

Expand Down