summaryrefslogtreecommitdiff
path: root/src/main_compgen.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-06-11 10:14:53 +0100
committerPhil Jones <philj56@gmail.com>2022-06-11 10:14:53 +0100
commitc0cd4cdf78886040528b16fad084a14165a16384 (patch)
tree82788f09527c91060cea22246f1af9a2572ce655 /src/main_compgen.c
parent7c31982244f179cb2f51bb1d81b21ad4efd649ba (diff)
Add compgen caching.
A list of commands is now stored in $XDG_CACHE_HOME/.cache/tofi-compgen, and regenerated as necessary.
Diffstat (limited to 'src/main_compgen.c')
-rw-r--r--src/main_compgen.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main_compgen.c b/src/main_compgen.c
index a62bc11..743d2cc 100644
--- a/src/main_compgen.c
+++ b/src/main_compgen.c
@@ -4,9 +4,7 @@
int main()
{
- struct string_vec commands = compgen();
- for (size_t i = 0; i < commands.count; i++) {
- printf("%s\n", commands.buf[i]);
- }
+ struct string_vec commands = compgen_cached();
+ string_vec_save(&commands, stdout);
string_vec_destroy(&commands);
}