Node, : node-kexec.
, ( CoffeeScript):
page = (cb)->
if process.env['_PAGINATED']?
return cb()
pager = process.env.PAGER || 'less --chop-long-lines'
pager = pager.replace /less(\s|$)/, 'less --RAW-CONTROL-CHARS$1'
process.env['PAGINATED_COLUMNS'] = term.columns
process.env['_PAGINATED'] = 'yes'
escapeShellArg = (cmd)-> "'" + cmd.replace(/\'/g, "'\\''") + "'"
params = process.argv.slice()
params = params.map (arg)-> escapeShellArg arg
params.push '|'
params.push pager
log.debug "!! Forking and exec'ing to pager: `#{pager}`"
log.wtf "-- Invocation via `sh -c`:", params.join ' '
kexec params.join ' '
, ; - page(print_help_text) ( ).
: , , , ; , , page(), ; , . ( , .) , , , page(), , .
( , Node, exec, Ruby's. :P)
Nota bene: , --[no-]pager. , .
, , , ; kexec package.json optionalDependencies, try/catch ( , optional), . , , - , , .