diff options
| author | hachem <im@hachem.wtf> | 2026-10-08 11:50:02 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-10-08 11:50:02 +0200 |
| commit | ef104148057ab98f80b1560405b5c02768457096 (patch) | |
| tree | 47e75bc81aacb2e035e7cd43be9616b677b01d04 /gils/tail.rv | |
| parent | 5f6deca073728d0dafa2cd47d841b28d54af3aaf (diff) | |
feat: colors + better ps1
Diffstat (limited to 'gils/tail.rv')
| -rw-r--r-- | gils/tail.rv | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gils/tail.rv b/gils/tail.rv index 4a661b4..c1ca124 100644 --- a/gils/tail.rv +++ b/gils/tail.rv @@ -14,13 +14,13 @@ fn file_lines(path) do end const context = env.ctx -if context.argv:len() < 2 do puts("usage: tail [n] <path>\n") end +if context.argv:len() < 2 do fail("usage: tail [n] <path>\n") end else do let limit = 10 let path_arg = context.argv[1] if (context.argv:len() >= 3 and parse_pid(context.argv[1]) >= 0) do limit = parse_pid(context.argv[1]) path_arg = context.argv[2] end const lines = file_lines(expand_path(path_arg)) - if lines == :nil do puts("tail: no such file\n") end + if lines == :nil do fail("tail: no such file\n") end else do let start = lines:len() - limit if start < 0 do start = 0 end |
