Skip to content

Commit

Permalink
faas-cli: add shell completion and version test
Browse files Browse the repository at this point in the history
  • Loading branch information
superherointj committed Sep 22, 2022
1 parent 55eb086 commit 7ab3290
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions pkgs/development/tools/faas-cli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
, fetchFromGitHub
, makeWrapper
, git
, installShellFiles
, testers
, faas-cli
}:
let
faasPlatform = platform:
Expand All @@ -24,12 +27,10 @@ buildGoModule rec {
sha256 = "sha256-iUS8bhTZc7oy7qy0ydmbVW3BNa/lZ2Q+kYefBKrNRyc=";
};

nativeBuildInputs = [ makeWrapper ];
vendorSha256 = null;

CGO_ENABLED = 0;

vendorSha256 = null;

subPackages = [ "." ];

ldflags = [
Expand All @@ -39,14 +40,25 @@ buildGoModule rec {
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.targetPlatform}"
];

nativeBuildInputs = [ makeWrapper installShellFiles ];

postInstall = ''
wrapProgram "$out/bin/faas-cli" \
--prefix PATH : ${lib.makeBinPath [ git ]}
installShellCompletion --cmd metal \
--bash <($out/bin/faas-cli completion --shell bash) \
--zsh <($out/bin/faas-cli completion --shell zsh)
'';

passthru.tests.version = testers.testVersion {
command = "${faas-cli}/bin/faas-cli version --short-version --warn-update=false";
package = faas-cli;
};

meta = with lib; {
homepage = "https://github.com/openfaas/faas-cli";
description = "Official CLI for OpenFaaS ";
homepage = "https://github.com/openfaas/faas-cli";
license = licenses.mit;
maintainers = with maintainers; [ welteki techknowlogick ];
};
Expand Down

0 comments on commit 7ab3290

Please sign in to comment.