Skip to content

Commit

Permalink
fix: generate topics for aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Feb 13, 2023
1 parent 146735d commit ca03e17
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/autocomplete/zsh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,28 +386,31 @@ _${this.config.bin}
flags,
})

c.aliases.forEach(a=>{
c.aliases.forEach(a => {
cmds.push({
id: a,
summary,
flags
flags,
})

const split = a.split(':')

let words = split[0]

for (let i = 1; i < split.length; words += `:${split[i]}`) {
if(this.topics.find(t=> t.name === words) === undefined) {
console.log(words);
// Completion funcs are generated from topics:
// `force` -> `force:org` -> `force:org:open|list`
//
// but aliases aren't guaranteed to follow the plugin command tree
// so we need to add any missing topic between the starting point and the alias.
for (let i = 0; i < split.length - 1; i++) {
if (!this.topics.find(t => t.name === words)) {
this.topics.push({
name: words,
description: ''
description: '',
})
}
i++;
words += `:${split[i + 1]}`
}

})
})
})
Expand Down

0 comments on commit ca03e17

Please sign in to comment.