-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatch.nu
More file actions
executable file
·25 lines (22 loc) · 806 Bytes
/
Copy pathwatch.nu
File metadata and controls
executable file
·25 lines (22 loc) · 806 Bytes
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
#!/usr/bin/nu
def main [
target = 'prd_dissertation.pdf'
] {
let graph = snakemake --detailed-summary -j1 |
from tsv |
insert input { $in | get 'input-file(s)' | if $in == '-' { [] } else { split row ',' } } |
select output_file input |
each { |it| { $it.output_file: $it.input } } |
into record
# get leaf nodes (inputs)
mut files = $graph | get $target
mut replaceable = $files | where $it in $graph
while ($replaceable | is-not-empty) {
for $r in $replaceable {
$files = $files | where $it != $r | $in ++ ($graph | get $r) | uniq
}
$replaceable = $files | where $it in $graph
}
print $"Watching ($files) to build ($target)"
$files | str join (char newline) | entr snakemake -j4 $target
}