From 5d362c2335eee327aab027625b0095bf2d87468c Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 15 May 2020 13:47:00 +0200 Subject: [PATCH] fly: use completion generator There's no need to ship the pre-generated completions in the nixpkgs tree anymore. --- .../tools/continuous-integration/fly/default.nix | 12 +++++------- .../tools/continuous-integration/fly/fly.bash | 10 ---------- 2 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 pkgs/development/tools/continuous-integration/fly/fly.bash diff --git a/pkgs/development/tools/continuous-integration/fly/default.nix b/pkgs/development/tools/continuous-integration/fly/default.nix index 216121c8bd3f..bea8c4908510 100644 --- a/pkgs/development/tools/continuous-integration/fly/default.nix +++ b/pkgs/development/tools/continuous-integration/fly/default.nix @@ -1,4 +1,4 @@ -{ buildGoModule, fetchFromGitHub, lib, writeText }: +{ buildGoModule, fetchFromGitHub, stdenv, lib, writeText }: buildGoModule rec { pname = "fly"; @@ -20,12 +20,10 @@ buildGoModule rec { -X github.com/concourse/concourse.Version=${version} ''; - # The fly.bash file included with this derivation can be replaced by a - # call to `fly completion bash` once the `completion` subcommand has - # made it into a release. Similarly, `fly completion zsh` will provide - # zsh completions. https://github.com/concourse/concourse/pull/4012 - postInstall = '' - install -D -m 444 ${./fly.bash} $out/share/bash-completion/completions/fly + postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' + mkdir -p $out/share/{bash-completion/completions,zsh/site-functions} + $out/bin/fly completion --shell bash > $out/share/bash-completion/completions/fly + $out/bin/fly completion --shell zsh > $out/share/zsh/site-functions/_fly ''; meta = with lib; { diff --git a/pkgs/development/tools/continuous-integration/fly/fly.bash b/pkgs/development/tools/continuous-integration/fly/fly.bash deleted file mode 100644 index a9acc5f70a40..000000000000 --- a/pkgs/development/tools/continuous-integration/fly/fly.bash +++ /dev/null @@ -1,10 +0,0 @@ -# credits: -# https://godoc.org/github.com/jessevdk/go-flags#hdr-Completion -# https://github.com/concourse/concourse/issues/1309#issuecomment-452893900 -_fly_compl() { - args=("${COMP_WORDS[@]:1:$COMP_CWORD}") - local IFS=$'\n' - COMPREPLY=($(GO_FLAGS_COMPLETION=1 ${COMP_WORDS[0]} "${args[@]}")) - return 0 -} -complete -F _fly_compl fly