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

[Feature suggestion] Add support for Fig #9

Open
VityaSchel opened this issue Jul 19, 2022 · 3 comments
Open

[Feature suggestion] Add support for Fig #9

VityaSchel opened this issue Jul 19, 2022 · 3 comments

Comments

@VityaSchel
Copy link

Hi! I love your tool!
Can you add integration with fig? It would greatly help to see all commands and visualize existing profiles :)

@dotzero
Copy link
Owner

dotzero commented Dec 24, 2022

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.

@VityaSchel
Copy link
Author

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: withfig/autocomplete#1974

@VityaSchel
Copy link
Author

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants