diff options
author | Linnnus <[email protected]> | 2024-11-16 13:36:59 +0100 |
---|---|---|
committer | Linnnus <[email protected]> | 2024-11-16 13:36:59 +0100 |
commit | c9af4dd8d83bd02b9507fe9e056fa0ac5f608540 (patch) | |
tree | 242cb2dfbf59adbc66da8a4a6b69f4f7531db3c0 /pkgs/nowrap | |
parent | 18336d643163a6b339f6198c7f53b109ee58bdf7 (diff) |
pkgs: Add nowrap
Diffstat (limited to 'pkgs/nowrap')
-rw-r--r-- | pkgs/nowrap/default.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/nowrap/default.nix b/pkgs/nowrap/default.nix new file mode 100644 index 0000000..cb6672c --- /dev/null +++ b/pkgs/nowrap/default.nix @@ -0,0 +1,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"; + }; +} |