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