faas-cli: add shell completion and version test
This commit is contained in:
parent
55eb086779
commit
7ab32908cc
@ -4,6 +4,9 @@
|
|||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, git
|
, git
|
||||||
|
, installShellFiles
|
||||||
|
, testers
|
||||||
|
, faas-cli
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
faasPlatform = platform:
|
faasPlatform = platform:
|
||||||
@ -24,12 +27,10 @@ buildGoModule rec {
|
|||||||
sha256 = "sha256-iUS8bhTZc7oy7qy0ydmbVW3BNa/lZ2Q+kYefBKrNRyc=";
|
sha256 = "sha256-iUS8bhTZc7oy7qy0ydmbVW3BNa/lZ2Q+kYefBKrNRyc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
vendorSha256 = null;
|
||||||
|
|
||||||
CGO_ENABLED = 0;
|
CGO_ENABLED = 0;
|
||||||
|
|
||||||
vendorSha256 = null;
|
|
||||||
|
|
||||||
subPackages = [ "." ];
|
subPackages = [ "." ];
|
||||||
|
|
||||||
ldflags = [
|
ldflags = [
|
||||||
@ -39,14 +40,25 @@ buildGoModule rec {
|
|||||||
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.targetPlatform}"
|
"-X github.com/openfaas/faas-cli/commands.Platform=${faasPlatform stdenv.targetPlatform}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
wrapProgram "$out/bin/faas-cli" \
|
wrapProgram "$out/bin/faas-cli" \
|
||||||
--prefix PATH : ${lib.makeBinPath [ git ]}
|
--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; {
|
meta = with lib; {
|
||||||
homepage = "https://github.com/openfaas/faas-cli";
|
|
||||||
description = "Official CLI for OpenFaaS ";
|
description = "Official CLI for OpenFaaS ";
|
||||||
|
homepage = "https://github.com/openfaas/faas-cli";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ welteki techknowlogick ];
|
maintainers = with maintainers; [ welteki techknowlogick ];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user