Merge pull request #275400 from pedorich-n/esphome-completion

esphome: install shell completion
This commit is contained in:
Martin Weinelt 2024-01-15 17:10:32 +01:00 committed by GitHub
commit e3528ac551
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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; {