Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 3 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # osenv
  2. Look up environment settings specific to different operating systems.
  3. ## Usage
  4. ```javascript
  5. var osenv = require('osenv')
  6. var path = osenv.path()
  7. var user = osenv.user()
  8. // etc.
  9. // Some things are not reliably in the env, and have a fallback command:
  10. var h = osenv.hostname(function (er, hostname) {
  11. h = hostname
  12. })
  13. // This will still cause it to be memoized, so calling osenv.hostname()
  14. // is now an immediate operation.
  15. // You can always send a cb, which will get called in the nextTick
  16. // if it's been memoized, or wait for the fallback data if it wasn't
  17. // found in the environment.
  18. osenv.hostname(function (er, hostname) {
  19. if (er) console.error('error looking up hostname')
  20. else console.log('this machine calls itself %s', hostname)
  21. })
  22. ```
  23. ## osenv.hostname()
  24. The machine name. Calls `hostname` if not found.
  25. ## osenv.user()
  26. The currently logged-in user. Calls `whoami` if not found.
  27. ## osenv.prompt()
  28. Either PS1 on unix, or PROMPT on Windows.
  29. ## osenv.tmpdir()
  30. The place where temporary files should be created.
  31. ## osenv.home()
  32. No place like it.
  33. ## osenv.path()
  34. An array of the places that the operating system will search for
  35. executables.
  36. ## osenv.editor()
  37. Return the executable name of the editor program. This uses the EDITOR
  38. and VISUAL environment variables, and falls back to `vi` on Unix, or
  39. `notepad.exe` on Windows.
  40. ## osenv.shell()
  41. The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'
  42. or 'cmd'.