git-profile
git-profile copied to clipboard
[Feature suggestion] Add support for Fig
Hi! I love your tool! Can you add integration with fig? It would greatly help to see all commands and visualize existing profiles :)
Hello, thank you for the suggestion. Unfortunately, I am not familiar with the tool you mentioned and do not have experience integrating it. If you are willing, I would be grateful if you could set up the integration and send me a pull request. Thank you for your help and understanding.
Coming back to this a year later, I followed this guide https://fig.io/docs/getting-started and made simple spec myself. It only supports use command and "--help", "--config" flags and uses generator for "use" command Related: https://github.com/withfig/autocomplete/pull/1974
anyway here is the spec:
const profiles: Fig.Generator = {
script: "git-profile list",
postProcess: (output) => {
return Array.from(output.matchAll(/^\[(.+?)\]$/gm)).map((result) => ({
name: result[1],
description: `Use profile "${result[1]}"`,
}));
},
};
const completionSpec: Fig.Spec = {
name: "git-profile",
description: "Switch profiles",
subcommands: [
{
name: "use",
description: "Use a profile",
args: {
name: "profile",
description: "Profile you want to apply in this repository",
generators: profiles,
},
},
],
options: [
{
name: ["--help", "-h"],
description: "Help for git-profile script",
},
{
name: ["--config", "-c"],
description: 'Config file (default "~/.gitprofile")',
},
],
};
export default completionSpec;