containerlab: add shell completions

This commit is contained in:
Janik H 2023-07-27 14:36:34 +02:00 committed by Yaya
parent 78c4c230ac
commit 9331708da6

View File

@ -1,6 +1,7 @@
{ lib { lib
, buildGoModule , buildGoModule
, fetchFromGitHub , fetchFromGitHub
, installShellFiles
}: }:
buildGoModule rec { buildGoModule rec {
@ -14,6 +15,8 @@ buildGoModule rec {
hash = "sha256-Wo6Dfcdax8EjZRP5JBKrnxpFTVx0GV+7uaDgBY/zg6I="; hash = "sha256-Wo6Dfcdax8EjZRP5JBKrnxpFTVx0GV+7uaDgBY/zg6I=";
}; };
nativeBuildInputs = [ installShellFiles ];
vendorHash = "sha256-uaYeFzG74VTUrtql6mSi+LNh6IjDomixrWwGQMgmONc="; vendorHash = "sha256-uaYeFzG74VTUrtql6mSi+LNh6IjDomixrWwGQMgmONc=";
ldflags = [ ldflags = [
@ -24,6 +27,14 @@ buildGoModule rec {
"-X" "github.com/srl-labs/containerlab/cmd.date=1970-01-01T00:00:00Z" "-X" "github.com/srl-labs/containerlab/cmd.date=1970-01-01T00:00:00Z"
]; ];
postInstall = ''
local INSTALL="$out/bin/containerlab"
installShellCompletion --cmd containerlab \
--bash <($out/bin/containerlab completion bash) \
--fish <($out/bin/containerlab completion fish) \
--zsh <($out/bin/containerlab completion zsh)
'';
meta = with lib; { meta = with lib; {
description = "Container-based networking lab"; description = "Container-based networking lab";
homepage = "https://containerlab.dev/"; homepage = "https://containerlab.dev/";