Commit 9331708d authored by Janik H's avatar Janik H Committed by Yaya
Browse files

containerlab: add shell completions

parent 78c4c230
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:

buildGoModule rec {
@@ -14,6 +15,8 @@ buildGoModule rec {
    hash = "sha256-Wo6Dfcdax8EjZRP5JBKrnxpFTVx0GV+7uaDgBY/zg6I=";
  };

  nativeBuildInputs = [ installShellFiles ];

  vendorHash = "sha256-uaYeFzG74VTUrtql6mSi+LNh6IjDomixrWwGQMgmONc=";

  ldflags = [
@@ -24,6 +27,14 @@ buildGoModule rec {
    "-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; {
    description = "Container-based networking lab";
    homepage = "https://containerlab.dev/";