completions: add zsh completion for riverctl

This commit is contained in:
novakne
2021-03-13 17:06:39 +01:00
committed by Isaac Freund
parent eb1dd401f8
commit c9a4dde331
2 changed files with 112 additions and 0 deletions

View File

@ -31,6 +31,12 @@ pub fn build(b: *zbs.Builder) !void {
"Set to true to install bash completion for riverctl. Defaults to true.",
) orelse true;
const zsh_completion = b.option(
bool,
"zsh-completion",
"Set to true to install zsh completion for riverctl. Defaults to true.",
) orelse true;
const examples = b.option(bool, "examples", "Set to true to build examples") orelse false;
const resolved_prefix = try std.fs.path.resolve(b.allocator, &[_][]const u8{b.install_prefix.?});
@ -101,6 +107,13 @@ pub fn build(b: *zbs.Builder) !void {
);
}
if (zsh_completion) {
b.installFile(
"completions/zsh/_riverctl",
"share/zsh/site-functions/_riverctl",
);
}
if (examples) {
inline for (.{ "status", "options" }) |example_name| {
const example = b.addExecutable(example_name, "example/" ++ example_name ++ ".zig");