forgejo-cli: add shell completions (#406291)

This commit is contained in:
isabel
2025-05-12 12:56:43 +01:00
committed by GitHub
+24 -10
View File
@@ -1,32 +1,36 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitea,
pkg-config,
installShellFiles,
writableTmpDirAsHomeHook,
libgit2,
oniguruma,
openssl,
zlib,
}:
let
version = "0.3.0";
in
rustPlatform.buildRustPackage {
rustPlatform.buildRustPackage (finalAttrs: {
pname = "forgejo-cli";
inherit version;
version = "0.3.0";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "Cyborus";
repo = "forgejo-cli";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-8KPR7Fx26hj5glKDjczCLP6GgQBUsA5TpjhO5UZOpik=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-kW7Pexydkosaufk1e8P5FaY+dgkeeTG5qgJxestWkVs=";
nativeBuildInputs = [ pkg-config ];
nativeBuildInputs = [
pkg-config
installShellFiles
writableTmpDirAsHomeHook # Needed for shell completions
];
buildInputs = [
libgit2
@@ -40,15 +44,25 @@ rustPlatform.buildRustPackage {
BUILD_TYPE = "nixpkgs";
};
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd fj \
--bash <($out/bin/fj completion bash) \
--fish <($out/bin/fj completion fish) \
--zsh <($out/bin/fj completion zsh)
'';
meta = {
description = "CLI application for interacting with Forgejo";
homepage = "https://codeberg.org/Cyborus/forgejo-cli";
changelog = "https://codeberg.org/Cyborus/forgejo-cli/releases/tag/v${version}";
changelog = "https://codeberg.org/Cyborus/forgejo-cli/releases/tag/v${finalAttrs.version}";
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [ isabelroses ];
maintainers = with lib.maintainers; [
awwpotato
isabelroses
];
mainProgram = "fj";
};
}
})