common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
955 stars 90 forks source link

Autoload fish completions and fix Makefile #645

Closed Hawkbawk closed 2 months ago

Hawkbawk commented 2 months ago

What changed?

The fish completion generation script now writes the completions to $HOME/.config/fish/completions/granted.fish, meaning that fish will now autoload the completions, instead of requiring users to manually load the completions.

Additionally, a reference to a deleted Makefile task was deleted to fix the cli-act-prod task.

Why?

fish uses the file name of completion files to determine which command the completions belong to when autoloading.. The previous file name mean that fish wasn't autoloading completions. Additionally, we can use the path library built-in to Go to handle constructing the appropriate path, rather than do string concatenation ourselves.

The assume-binary that was referenced as prerequisite for the cli-act-prod task no longer exists so to fix the task, it was removed.

How did you test it?

I built the CLI locally, generated the completions by running dgranted completion --shell=fish, then opened a new fish shell and saw that the completions had been autoloaded for dgranted.

Potential risks

If a user is relying on the previous filename for a script, that script will break, assuming they also delete the previous file. However, given that they were likely referencing the completions file to load the completions upon shell startup anyways, this commit will actually help them remove a line from their shell config.

Is patch release candidate?

Yes. This commit doesn't change any APIs.

Link to relevant docs PRs

N/A

Hawkbawk commented 2 months ago

Happy to help! Thanks for the quick turnaround.