on master help sign in
Merge pull request #315 from obsidiansystems/upstream-optparse

`addOptparseApplicativeCompletionScripts` is upstream

commitb39f15b12c7e1cd735f47da9a4dbcb1ce38abd09 authorAli Abrar <aliabrar@gmail.com> dateTue 8 Oct 2019, 15:20 (7 years ago) parentc1010c791eb60e
1 file changed+1−21
default.nix+1−21
default.nix+1−21
@@ -65,31 +65,11 @@ let
6565 (self: super: let
6666 pkgs = self.callPackage ({ pkgs }: pkgs) {};
6767 haskellLib = pkgs.haskell.lib;
68− #TODO: Upstream
69− # Modify a Haskell package to add completion scripts for the given
70− # executable produced by it. These completion scripts will be picked up
71− # automatically if the resulting derivation is installed, e.g. by
72− # `nix-env -i`.
73− addOptparseApplicativeCompletionScripts = exeName: pkg: haskellLib.overrideCabal pkg (drv: {
74− postInstall = (drv.postInstall or "") + ''
75− BASH_COMP_DIR="$out/share/bash-completion/completions"
76− mkdir -p "$BASH_COMP_DIR"
77− "$out/bin/${exeName}" --bash-completion-script "$out/bin/${exeName}" >"$BASH_COMP_DIR/ob"
78−
79− ZSH_COMP_DIR="$out/share/zsh/vendor-completions"
80− mkdir -p "$ZSH_COMP_DIR"
81− "$out/bin/${exeName}" --zsh-completion-script "$out/bin/${exeName}" >"$ZSH_COMP_DIR/_ob"
82−
83− FISH_COMP_DIR="$out/share/fish/vendor_completions.d"
84− mkdir -p "$FISH_COMP_DIR"
85− "$out/bin/${exeName}" --fish-completion-script "$out/bin/${exeName}" >"$FISH_COMP_DIR/ob.fish"
86− '';
87− });
8868 in {
8969 # Dynamic linking with split objects dramatically increases startup time (about
9070 # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`.
9171 obelisk-command = haskellLib.overrideCabal
92− (addOptparseApplicativeCompletionScripts "ob"
72+ (haskellLib.addOptparseApplicativeCompletionScripts "ob"
9373 (haskellLib.justStaticExecutables super.obelisk-command))
9474 (drv: {
9575 buildTools = (drv.buildTools or []) ++ [ pkgs.buildPackages.makeWrapper ];