Add nl utility etc.
This commit is contained in:
parent
5de50196ea
commit
1b57bc6fa3
4 changed files with 18 additions and 4 deletions
6
echo.nim
6
echo.nim
|
|
@ -2,8 +2,10 @@ import cligen, sequtils
|
|||
import common
|
||||
|
||||
proc main(strings:seq[string], newline=true) =
|
||||
if newline: writeLine(stdout, strings.foldl(a & " " & b))
|
||||
else: write(stdout, strings.foldl(a & " " & b))
|
||||
if newline:
|
||||
writeLine(stdout, strings.foldl(a & " " & b))
|
||||
else:
|
||||
write(stdout, strings.foldl(a & " " & b))
|
||||
flushFile(stdout)
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ requires "nim >= 0.19.0"
|
|||
requires "cligen >= 0.9.19"
|
||||
requires "stint >= 0.0.1"
|
||||
|
||||
bin = @["add", "cat", "cp", "div", "echo", "factor", "false", "head", "mkdir", "mul", "pwd", "rm", "seq", "shuf", "sleep", "sub", "tee", "touch", "true", "yes"]
|
||||
bin = @["add", "cat", "cp", "div", "echo", "factor", "false", "head", "mkdir", "mul", "nl", "pwd", "rm", "seq", "shuf", "sleep", "sub", "tee", "touch", "true", "yes"]
|
||||
|
||||
binDir = "bin"
|
||||
|
|
|
|||
11
nl.nim
Normal file
11
nl.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import cligen
|
||||
import common
|
||||
|
||||
proc main(files:seq[string], lineIncrement=1) =
|
||||
for file in files:
|
||||
var lineNr = 0
|
||||
for line in lines(file):
|
||||
lineNr += lineIncrement
|
||||
writeLine(stdout, $(lineNr) & line)
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
3
shuf.nim
3
shuf.nim
|
|
@ -3,6 +3,7 @@ import common
|
|||
|
||||
proc main(files:seq[string]) =
|
||||
for file in files:
|
||||
echo ""
|
||||
for line in lines(file):
|
||||
echo line
|
||||
|
||||
dispatch(main, version=("version", nimbaseVersion))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue