diff options
author | Martin Weinelt <mweinelt@users.noreply.github.com> | 2024-01-15 17:10:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 17:10:32 +0100 |
commit | e3528ac5517c68ef67bce66b9dce5433a402ceda (patch) | |
tree | 8ddc015922862cb8a84b10363fb3d33561c4c866 | |
parent | 4d06a1f1b44fc57655048035851fab1736a09c36 (diff) | |
parent | 36111f0a0f5f8c821c96f8ab5b2dc66445e27856 (diff) | |
download | nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.tar nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.tar.gz nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.tar.bz2 nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.tar.lz nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.tar.xz nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.tar.zst nixlib-e3528ac5517c68ef67bce66b9dce5433a402ceda.zip |
Merge pull request #275400 from pedorich-n/esphome-completion
esphome: install shell completion
-rw-r--r-- | pkgs/tools/misc/esphome/default.nix | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/pkgs/tools/misc/esphome/default.nix b/pkgs/tools/misc/esphome/default.nix index a8ab91f8f329..4baf50a063e7 100644 --- a/pkgs/tools/misc/esphome/default.nix +++ b/pkgs/tools/misc/esphome/default.nix @@ -2,6 +2,7 @@ , callPackage , python3Packages , fetchFromGitHub +, installShellFiles , platformio , esptool , git @@ -10,7 +11,7 @@ let python = python3Packages.python.override { packageOverrides = self: super: { - esphome-dashboard = self.callPackage ./dashboard.nix {}; + esphome-dashboard = self.callPackage ./dashboard.nix { }; }; }; in @@ -28,6 +29,8 @@ python.pkgs.buildPythonApplication rec { nativeBuildInputs = with python.pkgs; [ setuptools + argcomplete + installShellFiles ]; postPatch = '' @@ -98,9 +101,20 @@ python.pkgs.buildPythonApplication rec { $out/bin/esphome --help > /dev/null ''; + postInstall = + let + argcomplete = lib.getExe' python3Packages.argcomplete "register-python-argcomplete"; + in + '' + installShellCompletion --cmd esphome \ + --bash <(${argcomplete} --shell bash esphome) \ + --zsh <(${argcomplete} --shell zsh esphome) \ + --fish <(${argcomplete} --shell fish esphome) + ''; + passthru = { dashboard = python.pkgs.esphome-dashboard; - updateScript = callPackage ./update.nix {}; + updateScript = callPackage ./update.nix { }; }; meta = with lib; { |