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

Rework completion #584

Merged
merged 2 commits into from
Jul 26, 2018
Merged

Rework completion #584

merged 2 commits into from
Jul 26, 2018

Conversation

Morganamilo
Copy link
Contributor

Bash seperates on whitespace, so the fish completion file
actually works for bash and zsh. So remove the concept of shells
entirley and just use the singular aur_sh.cache file.

If for some reason output without the repository data is needed, the
user could always just pipe it into awk like so
yay -Pc | awk '{print $1}'. Or perhaps a --quiet option could be added
where yay will strip the output itself.

The completion cache now updates when installing AUR packages. This is
done as a goroutine with no wait groups. This ensures the program will
never hang if there is a problem.

The completion is stil updated during -Pc but as long as an AUR package
has been installed recently it should not need to update.

The cache will now also wait 7 days instead of 2 before refreshing.
A refresh can be forced using -Pcc.

Make the completion refresh time configurable
The default setting is 7 days. The user can specify a different time in
days. -1 can be set to never refresh while 0 can be used to always
refresh.

Alternative to #539

@Morganamilo
Copy link
Contributor Author

--completionrefreshtime is quite the mouthful. A better name would be appreciated.

@Morganamilo
Copy link
Contributor Author

I've already got more commits on the way but I'll make this one the last one for this release.

@Jguer
Copy link
Owner

Jguer commented Jul 25, 2018

Getting a name for that is a bit of a pain. A few alternatives I don't like as much as the present option:

  • cacheduration (can be misinterpreted with pkg cache
  • completioninterval

@Morganamilo
Copy link
Contributor Author

completioninterval is a bit long but an improvement over completionrefreshtime.

@Morganamilo
Copy link
Contributor Author

Also because there is now only one completion cache and it how has the fish format, the current aur_sh cache will need to be refreshed to get the proper formatting. There's a couple solutions I see.

  • As well as the 7 day and file not exist check. Force a refresh if file.lastmodified is before current date
  • Keep the aur_fish.cache file and use that for every shell. Instead using aur_sh.cache
  • Wait for the 7 days to be up and it will take care of itself, also suggest users run yay -Pcc

@Jguer
Copy link
Owner

Jguer commented Jul 26, 2018

aur_sh is actually a non descriptive name because it contains both repo and aur pkgs, I would move it to sh.cache and deprecate all others

@Morganamilo
Copy link
Contributor Author

Good point, didn't think of that.

@Morganamilo Morganamilo force-pushed the completion-slow branch 2 times, most recently from 56f67fe to 14e4a33 Compare July 26, 2018 12:46
Bash seperates on whitespace, so the fish completion file
actually works for bash and zsh. So remove the concept of shells
entirley and just use the singular aur_sh.cache file.

If for some reason output without the repository data is needed, the
user could always just pipe it into awk like so
`yay -Pc | awk '{print $1}'`. Or perhaps a --quiet option could be added
where yay will strip the output itself.

The completion cache now updates when installing AUR packages. This is
done as a goroutine with no wait groups. This ensures the program will
never hang if there is a problem.

The completion is stil updated during -Pc but as long as an AUR package
has been installed recently it should not need to update.

The cache will now also wait 7 days instead of 2 before refreshing.
A refresh can be forced using -Pcc.
The default setting is 7 days. The user can specify a different time in
days. -1 can be set to never refresh while 0 can be used to always
refresh.
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

Successfully merging this pull request may close these issues.

2 participants