Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

shell.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. //
  2. // ShellJS
  3. // Unix shell commands on top of Node's API
  4. //
  5. // Copyright (c) 2012 Artur Adib
  6. // http://github.com/arturadib/shelljs
  7. //
  8. var common = require('./src/common');
  9. //@
  10. //@ All commands run synchronously, unless otherwise stated.
  11. //@
  12. //@include ./src/cd
  13. var _cd = require('./src/cd');
  14. exports.cd = common.wrap('cd', _cd);
  15. //@include ./src/pwd
  16. var _pwd = require('./src/pwd');
  17. exports.pwd = common.wrap('pwd', _pwd);
  18. //@include ./src/ls
  19. var _ls = require('./src/ls');
  20. exports.ls = common.wrap('ls', _ls);
  21. //@include ./src/find
  22. var _find = require('./src/find');
  23. exports.find = common.wrap('find', _find);
  24. //@include ./src/cp
  25. var _cp = require('./src/cp');
  26. exports.cp = common.wrap('cp', _cp);
  27. //@include ./src/rm
  28. var _rm = require('./src/rm');
  29. exports.rm = common.wrap('rm', _rm);
  30. //@include ./src/mv
  31. var _mv = require('./src/mv');
  32. exports.mv = common.wrap('mv', _mv);
  33. //@include ./src/mkdir
  34. var _mkdir = require('./src/mkdir');
  35. exports.mkdir = common.wrap('mkdir', _mkdir);
  36. //@include ./src/test
  37. var _test = require('./src/test');
  38. exports.test = common.wrap('test', _test);
  39. //@include ./src/cat
  40. var _cat = require('./src/cat');
  41. exports.cat = common.wrap('cat', _cat);
  42. //@include ./src/to
  43. var _to = require('./src/to');
  44. String.prototype.to = common.wrap('to', _to);
  45. //@include ./src/toEnd
  46. var _toEnd = require('./src/toEnd');
  47. String.prototype.toEnd = common.wrap('toEnd', _toEnd);
  48. //@include ./src/sed
  49. var _sed = require('./src/sed');
  50. exports.sed = common.wrap('sed', _sed);
  51. //@include ./src/grep
  52. var _grep = require('./src/grep');
  53. exports.grep = common.wrap('grep', _grep);
  54. //@include ./src/which
  55. var _which = require('./src/which');
  56. exports.which = common.wrap('which', _which);
  57. //@include ./src/echo
  58. var _echo = require('./src/echo');
  59. exports.echo = _echo; // don't common.wrap() as it could parse '-options'
  60. //@include ./src/dirs
  61. var _dirs = require('./src/dirs').dirs;
  62. exports.dirs = common.wrap("dirs", _dirs);
  63. var _pushd = require('./src/dirs').pushd;
  64. exports.pushd = common.wrap('pushd', _pushd);
  65. var _popd = require('./src/dirs').popd;
  66. exports.popd = common.wrap("popd", _popd);
  67. //@include ./src/ln
  68. var _ln = require('./src/ln');
  69. exports.ln = common.wrap('ln', _ln);
  70. //@
  71. //@ ### exit(code)
  72. //@ Exits the current process with the given exit code.
  73. exports.exit = process.exit;
  74. //@
  75. //@ ### env['VAR_NAME']
  76. //@ Object containing environment variables (both getter and setter). Shortcut to process.env.
  77. exports.env = process.env;
  78. //@include ./src/exec
  79. var _exec = require('./src/exec');
  80. exports.exec = common.wrap('exec', _exec, {notUnix:true});
  81. //@include ./src/chmod
  82. var _chmod = require('./src/chmod');
  83. exports.chmod = common.wrap('chmod', _chmod);
  84. //@
  85. //@ ## Non-Unix commands
  86. //@
  87. //@include ./src/tempdir
  88. var _tempDir = require('./src/tempdir');
  89. exports.tempdir = common.wrap('tempdir', _tempDir);
  90. //@include ./src/error
  91. var _error = require('./src/error');
  92. exports.error = _error;
  93. //@
  94. //@ ## Configuration
  95. //@
  96. exports.config = common.config;
  97. //@
  98. //@ ### config.silent
  99. //@ Example:
  100. //@
  101. //@ ```javascript
  102. //@ var sh = require('shelljs');
  103. //@ var silentState = sh.config.silent; // save old silent state
  104. //@ sh.config.silent = true;
  105. //@ /* ... */
  106. //@ sh.config.silent = silentState; // restore old silent state
  107. //@ ```
  108. //@
  109. //@ Suppresses all command output if `true`, except for `echo()` calls.
  110. //@ Default is `false`.
  111. //@
  112. //@ ### config.fatal
  113. //@ Example:
  114. //@
  115. //@ ```javascript
  116. //@ require('shelljs/global');
  117. //@ config.fatal = true;
  118. //@ cp('this_file_does_not_exist', '/dev/null'); // dies here
  119. //@ /* more commands... */
  120. //@ ```
  121. //@
  122. //@ If `true` the script will die on errors. Default is `false`.