summaryrefslogtreecommitdiff
path: root/pkgs/inbox-review.nix
blob: a65cd06bee5428508ff1e997fe6888705c176250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  pkgs
}: let
  inbox = "~/Sync/vault/inbox";
in pkgs.writers.writeNuBin "inboxreview" /*nu*/ ''
  let inbox = "${inbox}" | path expand
  
  let iota_paths = ls $inbox | get name

  $iota_paths | each {|path|
    let contents = $path | open

    print $"\n(ansi purple)($contents)(ansi reset)\n"

    let deletion_confirmation = match (input "Delete? [Y/n] ") {
      "" => true,
      "Y" => true,
      "y" => true,
      "n" => false,
      _ => false,
    }

    if $deletion_confirmation {
      rm $path
    }
  }
''