blob: cb6672ce08a9b5f7e244a061f808815be3ce52fe (
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
28
|
{
writeTextFile,
python3,
lib,
}:
writeTextFile {
name = "nowrap";
text = ''
#!${python3.interpreter}
import sys
import os
cols = os.get_terminal_size().columns
for line in sys.stdin:
line = line.removesuffix("\n")
print(line[:cols])
'';
executable = true;
destination = "/bin/nowrap";
meta = with lib; {
description = "Truncates lines from stdin such that they are no wider than the terminals width";
mainProgram = "nowrap";
};
}
|