Yevhenii Babichenko
Yevhenii Babichenko

Reputation: 201

Automatically update generated fish scripts (completions, etc)

Let's say I have a completions scripts generated by gh completion -s fish and saved to an appropriate location. The question is: how do I update the script automatically on gh updates? Is there a plugin or should I do some scripting?

Upvotes: 1

Views: 367

Answers (1)

Zanchey
Zanchey

Reputation: 2040

If gh completion -s fish is fast, you can just run it as the script that loads completions. Create a ~/.config/fish/completions/gh.fish with the following contents:

gh completion -s fish | source

Then it will be run on first load in each shell instance, though it won't reload during the lifetime of that instance.

Alternatively, you could set up a scheduled task (eg cron) or trigger depending on the operating system you are using.

Upvotes: 3

Related Questions