summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/simple/otpmenu.nix
blob: b35e1601f3e98739a068290fcdf28232a4ce2143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{ dmenu, gnused, pass, writeDashBin, xdotool }:

writeDashBin "otpmenu" ''
  set -efu

  x=$(
    ${pass}/bin/pass git ls-files '*/otp.gpg' \
      | ${gnused}/bin/sed 's:/otp\.gpg$::' \
      | ${dmenu}/bin/dmenu -f -p OTP
  )

  otp=$(${pass}/bin/pass otp code "$x/otp")

  printf %s "$otp" | ${xdotool}/bin/xdotool type -f -
''