8000 fix: improve link fallback when OSC 8 not supported (#7294) · netlify/cli@47242ce · GitHub
[go: up one dir, main page]

Skip to content

Commit 47242ce

Browse files
authored
fix: improve link fallback when OSC 8 not supported (#7294)
The `terminal-link` package uses [OSC 8](https://github.com/Alhadis/OSC8-Adoption/) link formatting when running in a terminal that supports it. When it isn't supported, by default it falls back to rendering the text followed by the link in parens. This is fine, but when we pass the full URL as the text, it's unnecessarily noisy, e.g.: https://example.com/foo/bar (https://example.com/foo/bar) Passing `fallback: false` toggles the fallback behaviour to just render the text as-is. This wasn't clear previously from the docs: sindresorhus/terminal-link#26.
1 parent 80652f6 commit 47242ce

File tree

14 files changed

+23
-23
lines changed

14 files changed

+23
-23
lines changed

src/commands/blobs/blobs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const createBlobsCommand = (program: BaseCommand) => {
8888
.addHelpText('after', () => {
8989
const docsUrl = 'https://docs.netlify.com/blobs/overview/'
9090
return `
91-
For more information about Netlify Blobs, see ${terminalLink(docsUrl, docsUrl)}
91+
For more information about Netlify Blobs, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
9292
`
9393
})
9494
.addExamples([

src/commands/build/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const createBuildCommand = (program: BaseCommand) =>
2525
.addHelpText('after', () => {
2626
const docsUrl = 'https://docs.netlify.com/configure-builds/overview/'
2727
return `
28-
For more information about Netlify builds, see ${terminalLink(docsUrl, docsUrl)}
28+
For more information about Netlify builds, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
2929
`
3030
})
3131
.action(async (options, command) => {

src/commands/clone/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To specify a site, use --id or --name. By default, the Netlify site to link will
2828
])
2929
.addHelpText('after', () => {
3030
const docsUrl = 'https://docs.netlify.com/cli/get-started/#link-and-unlink-sites'
31-
return `For more information about linking sites, see ${terminalLink(docsUrl, docsUrl)}\n`
31+
return `For more information about linking sites, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}\n`
3232
})
3333
.action(async (repo: string, targetDir: string | undefined, options: CloneOptionValues, command: BaseCommand) => {
3434
const { clone } = await import('./clone.js')

src/commands/deploy/deploy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,9 @@ const printResults = ({
655655
runBuildCommand: boolean
656656
}): void => {
657657
const msgData: Record<string, string> = {
658-
'Build logs': terminalLink(results.logsUrl, results.logsUrl),
659-
'Function logs': terminalLink(results.functionLogsUrl, results.functionLogsUrl),
660-
'Edge function Logs': terminalLink(results.edgeFunctionLogsUrl, results.edgeFunctionLogsUrl),
658+
'Build logs': terminalLink(results.logsUrl, results.logsUrl, { fallback: false }),
659+
'Function logs': terminalLink(results.functionLogsUrl, results.functionLogsUrl, { fallback: false }),
660+
'Edge function Logs': terminalLink(results.edgeFunctionLogsUrl, results.edgeFunctionLogsUrl, { fallback: false }),
661661
}
662662

663663
log('')
@@ -683,9 +683,9 @@ const printResults = ({
683683
exit(0)
684684
} else {
685685
const message = deployToProduction
686-
? `Deployed to production URL: ${terminalLink(results.siteUrl, results.siteUrl)}\n
687-
Unique deploy URL: ${terminalLink(results.deployUrl, results.deployUrl)}`
688-
: `Deployed draft to ${terminalLink(results.deployUrl, results.deployUrl)}`
686+
? `Deployed to production URL: ${terminalLink(results.siteUrl, results.siteUrl, { fallback: false })}\n
687+
Unique deploy URL: ${terminalLink(results.deployUrl, results.deployUrl, { fallback: false })}`
688+
: `Deployed draft to ${terminalLink(results.deployUrl, results.deployUrl, { fallback: false })}`
689689

690690
log(
691691
boxen(message, {

src/commands/deploy/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co
144144
.addHelpText('after', () => {
145145
const docsUrl = 'https://docs.netlify.com/site-deploys/overview/'
146146
return `
147-
For more information about Netlify deploys, see ${terminalLink(docsUrl, docsUrl)}
147+
For more information about Netlify deploys, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
148148
`
149149
})
150150
.action(async (options: DeployOptionValues, command: BaseCommand) => {

src/commands/dev/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const createDevCommand = (program: BaseCommand) => {
109109
.addHelpText('after', () => {
110110
const docsUrl = 'https://docs.netlify.com/cli/local-development/'
111111
return `
112-
For more information about Netlify local development, see ${terminalLink(docsUrl, docsUrl)}
112+
For more information about Netlify local development, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
113113
`
114114
})
115115
.action(async (options: OptionValues, command: BaseCommand) => {

src/commands/env/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export const createEnvCommand = (program: BaseCommand) => {
164164
.addHelpText('afterAll', () => {
165165
const docsUrl = 'https://docs.netlify.com/configure-builds/environment-variables/'
166166
return `
167-
For more information about environment variables on Netlify, see ${terminalLink(docsUrl, docsUrl)}
167+
For more information about environment variables on Netlify, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
168168
`
169169
})
170170
.action(env)

src/commands/functions/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ The ${name} command will help you manage the functions in this site`,
123123
.addHelpText('afterAll', () => {
124124
const docsUrl = 'https://docs.netlify.com/functions/overview/'
125125
return `
126-
For more information about Netlify Functions, see ${terminalLink(docsUrl, docsUrl)}
126+
For more information about Netlify Functions, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
127127
`
128128
})
129129
.action(functions)

src/commands/init/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const createInitCommand = (program: BaseCommand) =>
1414
.addHelpText('after', () => {
1515
const docsUrl = 'https://docs.netlify.com/cli/get-started/'
1616
return `
17-
For more information about getting started with Netlify CLI, see ${terminalLink(docsUrl, docsUrl)}
17+
For more information about getting started with Netlify CLI, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
1818
`
1919
})
2020
.action(async (options: OptionValues, command: BaseCommand) => {

src/commands/link/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const createLinkCommand = (program: BaseCommand) =>
2020
.addHelpText('after', () => {
2121
const docsUrl = 'https://docs.netlify.com/cli/get-started/#link-and-unlink-sites'
2222
return `
23-
For more information about linking sites, see ${terminalLink(docsUrl, docsUrl)}
23+
For more information about linking sites, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
2424
`
2525
})
2626
.action(async (options: LinkOptionValues, command: BaseCommand) => {

0 commit comments

Comments
 (0)
0