diff options
author | Benjamin Staffin <benley@gmail.com> | 2018-11-26 14:41:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 14:41:04 -0500 |
commit | 5087dcf24759bf16fd3a7b1330b079d72404d7be (patch) | |
tree | ecaebfacf40667b99ca5753e850a78919ce09154 /pkgs | |
parent | 5294194fe213666750c95313a3c09c8be9003626 (diff) |
stern: Include bash & zsh completion support (#49668)
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/applications/networking/cluster/stern/default.nix | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/pkgs/applications/networking/cluster/stern/default.nix b/pkgs/applications/networking/cluster/stern/default.nix index c5e4ac9d0ba3..75a88d14e4c8 100644 --- a/pkgs/applications/networking/cluster/stern/default.nix +++ b/pkgs/applications/networking/cluster/stern/default.nix @@ -1,4 +1,4 @@ -{ lib, buildGoPackage, fetchFromGitHub }: +{ stdenv, lib, buildGoPackage, fetchFromGitHub }: buildGoPackage rec { name = "stern-${version}"; @@ -15,11 +15,20 @@ buildGoPackage rec { goDeps = ./deps.nix; - meta = with lib; { - description = "Multi pod and container log tailing for Kubernetes"; - homepage = "https://github.com/wercker/stern"; - license = licenses.asl20; - maintainers = with maintainers; [ mbode ]; - platforms = platforms.unix; - }; + # Only build shell completion if we're _not_ cross compiling, + # because it requires executing the compiled stern binary. + postInstall = lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) '' + mkdir -p $bin/share/bash-completion/completions + $bin/bin/stern --completion bash > $bin/share/bash-completion/completions/stern + mkdir -p $bin/share/zsh/site-functions + $bin/bin/stern --completion zsh > $bin/share/zsh/site-functions/_stern + ''; + + meta = with lib; { + description = "Multi pod and container log tailing for Kubernetes"; + homepage = "https://github.com/wercker/stern"; + license = licenses.asl20; + maintainers = with maintainers; [ mbode ]; + platforms = platforms.unix; + }; } |