Add `gem` completion spec
AlanSyue opened this issue · comments
Sanity checks
- My issue relates to a specific CLI completion spec (e.g.
git checkout
is missing options ingit
completion spec). If your issue is more general, please create your issue here: withfig/fig - I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
- I would like to work on this.
What CLI tool does this relate to?
gem
Which statement makes the most sense?
This completion spec does not exist
Issue Details
Wow, it's kinda wild that we don't already support this! Yes gem would be amazing, would really appreciate if you could contribute it 🤩
Generator for listing gems:
const gems: Fig.Generator = {
trigger: () => true,
custom: async (tokens, executeShellCommand) => {
const searchTerm = tokens[tokens.length - 1];
const out = await executeShellCommand(
`gem search --both --no-versions --no-details --quiet --norc '${searchTerm.replace("'", `'"'"'`)}'`,
);
return out.trim().split("\n")
.filter((line) => line && !line.startsWith("*"))
.map((name) => ({ name }));
},
};
Make sure you put debounce: true
on the arg containing the generator!
I'd be happy to accept a PR containing only the subcommands and their args, should be possible to knock that out in a couple mins
OK, thanks! I'd love to work on it.