Unverified Commit 4c2bfd68 authored by isabel's avatar isabel Committed by GitHub
Browse files

forgejo-cli: add shell completions (#406291)

parents cfab6b59 7e5847d4
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
{
  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";
  };
}
})