-
Notifications
You must be signed in to change notification settings - Fork 73
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: fix aliases in config.commandIDs missing the default topic separator #1229
fix: fix aliases in config.commandIDs missing the default topic separator #1229
Conversation
3f5ff6f
to
53f3743
Compare
@myarmolinsky Thanks for taking the time to make the PR! Quick question: how are you defining the aliases? I found that I'm only able to replicate the issue if I set the aliases like this: We never intended for that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Just need one change then I'll merge into a separate feature branch so that all the integration tests can run. Once those pass, I'll merge to main
src/config/config.ts
Outdated
@@ -780,23 +780,27 @@ export class Config implements IConfig { | |||
} | |||
|
|||
const handleAlias = (alias: string, hidden = false) => { | |||
if (this._commands.has(alias)) { | |||
const aliasWithDefaultTopicSeparator = alias.replaceAll(' ', ':') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a util function for whenever we need to do this:
import { toStandardizedId } from '../util/ids'
const aliasWithDefaultTopicSeparator = toStandardizedId(alias)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 I should have noticed this, my bad
This issue has been linked to a new work item: W-17039093 |
Thank you for always being so quick to review! I am indeed setting the aliases as I have just tested |
53f3743
to
0eca8b3
Compare
0eca8b3
to
bbd8186
Compare
…ator (#1229) (#1230) Co-authored-by: Matthew Yarmolinsky <[email protected]>
This fixes the following issue/example:
cli add topic3
is an alias forcli set topic3
cli add
is an alias forcli set
cat foo | cli add topic3
foo
should be sent tocli add topic3
, but it is instead sent tocli add
cat foo | cli set topic3
works fine: the content offoo
is sent tocli set topic3
rather thancli set
Please let me know if I am missing some context, or if there is a better spot to apply this change. I was looking for a spot to apply it before
Config.load
is called (or at least earlier on than whenloadPluginsAndCommands
is called inConfig.load
) but I couldn't find an appropriate spot