Basic command line utilities, the Node.js way
This project is an implementation of the GNU Coreutils commands in Javascript, adding an object-oriented design and some Node.js stream features while we were there :-)
This project has got inspiration and stolen borrowed code fragments from
shelljs and
bashful projects, and has implemented
some ideas from TermKit. The main
characteristic diferences from GNU Coreutils are
- objects, not text: standard coreutils are independent programs where the
only one interface with the exterior world are character streams derived from
the usage on a terminal, so this text needs to be parsed each time between
commands. Coreutils.js is designed as a library of functions, so high-level
objects can be passed between them, and each one of them implement an
inspect
method to be used when printing their content on a terminal to show their usual behaviour. - streams, not lists: for commands that generates a list of values,
Coreutils.js return a Stream object instead of an Array (split data in time
instead of space) since they are easily convertible between them and has a
better performance and offers more flexibility for big data sets, reason why the
Streams API is the standard interface in Node.js modules allowing them to be
connected to others. Also each returned stream has an added
type
attribute to show the type of their contents and help to process them later.
- cat needs show-nonprinting
- cksum
- comm
- csplit
- cut
- expand
- fmt
- fold
- head needs implement bytes counting
- join
- md5sum
- nl
- od
- paste
- pr
- ptx
- sha1sum
- sort
- split
- sum
- tac
- tail
- tr
- unexpand
- uniq
- wc
- chgrp
- chmod
- chown
- cp
- dd
- df
- dir
- dircolors
- du
- install
- ln
- ls
- mkdir
-
mkfifo -
mknod - mv
- rm
- rmdir
-
sync - touch
- vdir
- basename
- chroot
- date needs arguments
- dirname
- echo needs escape of backslash
- env
- expr
- groups
- hostname
- id
- logname
- pathchk
- printenv
- printf
- sleep
- tee
- test needs fd open on terminal and inline operators
-
tty -
users -
who -
whoami - yes
-
nice - nohup
-
su -
stty - uname
- alias
- bg
- cd needs arguments
- command
-
false - fc
- fg
- getopts
- jobs
- kill
- newgrp
- pwd
- read
-
true - umask
- unalias
- wait
- bind
- builtin
- caller
- compgen
- complete
- compopt
- coproc
- declare
- dirs
- disown
- enable
- eval
- exec
- exit
- export
- hash
- help
- history
- let
- local
- logout
- mapfile
- popd
- printf
- pushd
- readarray
- readonly
- set
- shift
- shopt
- source
- suspend
- time
- times
- trap
- type
- typeset
- ulimit
- unset
- free
- grep needs arguments
- shasum
- sha256sum
- uptime