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: use topic separator for deprecated alias warnings in help #1209

Conversation

myarmolinsky
Copy link
Contributor

@myarmolinsky myarmolinsky commented Oct 1, 2024

Makes the warning for deprecated aliases here:

core/src/help/index.ts

Lines 202 to 206 in cc8366a

if (command.deprecateAliases && command.aliases.includes(name)) {
const actualCmd = this.config.commands.find((c) => c.aliases.includes(name))
const opts = {...command.deprecationOptions, ...(actualCmd ? {to: actualCmd.id} : {})}
this.log(`${formatCommandDeprecationWarning(toConfiguredId(name, this.config), opts)}\n`)
}

use the topic separator by passing actualCmd.id into toConfiguredIds and using that result for the to in the Deprecation type parameter of formatCommandDeprecationWarning as done here:

core/src/command.ts

Lines 311 to 315 in 66604a3

if (this.ctor.deprecateAliases && this.ctor.aliases.includes(id)) {
const cmdName = toConfiguredId(this.ctor.id, this.config)
const aliasName = toConfiguredId(id, this.config)
this.warn(formatCommandDeprecationWarning(aliasName, {to: cmdName}))
}

@mdonnalley
Copy link
Contributor

Thanks @myarmolinsky for the contribution 🏆

@mdonnalley mdonnalley merged commit fb6ace2 into oclif:main Oct 1, 2024
2 checks passed
@myarmolinsky myarmolinsky deleted the fix-deprecated-alias-help-output-to-use-topic-separators branch October 1, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants