diff options
author | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2023-09-07 01:45:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 01:45:25 +0200 |
commit | 5ccf77493226487676780a43a2748cb10ea34d01 (patch) | |
tree | 0bb127873dca97420c21c234e682b753d5cd8d7b /pkgs/applications/office | |
parent | 58c62c79f8c79419b6c8c96469e736a23201bb03 (diff) | |
parent | 58a476519e5878ae1467452e15c77dd913c21fe2 (diff) |
Merge pull request #252783 from jerith666/timetrap-auto-complete
timetrap: add shell completions
Diffstat (limited to 'pkgs/applications/office')
-rw-r--r-- | pkgs/applications/office/timetrap/default.nix | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/pkgs/applications/office/timetrap/default.nix b/pkgs/applications/office/timetrap/default.nix index 579c9e115be8d..7ece5e9b4b030 100644 --- a/pkgs/applications/office/timetrap/default.nix +++ b/pkgs/applications/office/timetrap/default.nix @@ -1,11 +1,49 @@ -{ lib, bundlerApp, bundlerUpdateScript }: +{ stdenv +, lib +, pkgs +, bundlerEnv +, bundlerApp +, bundlerUpdateScript +, installShellFiles +}: -bundlerApp { - pname = "timetrap"; - gemdir = ./.; - exes = [ "t" "timetrap" ]; +let + ttBundlerApp = bundlerApp { + pname = "timetrap"; + gemdir = ./.; + exes = [ "t" "timetrap" ]; - passthru.updateScript = bundlerUpdateScript "timetrap"; + passthru.updateScript = bundlerUpdateScript "timetrap"; + }; + + ttGem = bundlerEnv { + pname = "timetrap"; + gemdir = ./.; + }; + +in + +stdenv.mkDerivation { + name = "timetrap"; + + dontUnpack = true; + + nativeBuildInputs = [ installShellFiles ]; + + installPhase = '' + mkdir $out; + cd $out; + + mkdir bin; pushd bin; + ln -vs ${ttBundlerApp}/bin/t; + ln -vs ${ttBundlerApp}/bin/timetrap; + popd; + + for c in t timetrap; do + installShellCompletion --cmd $c --bash ${ttGem}/lib/ruby/gems/*/gems/timetrap*/completions/bash/*; + installShellCompletion --cmd $c --zsh ${ttGem}/lib/ruby/gems/*/gems/timetrap*/completions/zsh/*; + done; + ''; meta = with lib; { description = "A simple command line time tracker written in ruby"; |