Sha256: 73eb1b2201750269fde53152ac6e837d889ff4ab757e3f46baa572e390dc1c98

Contents?: true

Size: 1.43 KB

Versions: 296

Compression:

Stored size: 1.43 KB

Contents

# osenv

Look up environment settings specific to different operating systems.

## Usage

```javascript
var osenv = require('osenv')
var path = osenv.path()
var user = osenv.user()
// etc.

// Some things are not reliably in the env, and have a fallback command:
var h = osenv.hostname(function (er, hostname) {
  h = hostname
})
// This will still cause it to be memoized, so calling osenv.hostname()
// is now an immediate operation.

// You can always send a cb, which will get called in the nextTick
// if it's been memoized, or wait for the fallback data if it wasn't
// found in the environment.
osenv.hostname(function (er, hostname) {
  if (er) console.error('error looking up hostname')
  else console.log('this machine calls itself %s', hostname)
})
```

## osenv.hostname()

The machine name.  Calls `hostname` if not found.

## osenv.user()

The currently logged-in user.  Calls `whoami` if not found.

## osenv.prompt()

Either PS1 on unix, or PROMPT on Windows.

## osenv.tmpdir()

The place where temporary files should be created.

## osenv.home()

No place like it.

## osenv.path()

An array of the places that the operating system will search for
executables.

## osenv.editor() 

Return the executable name of the editor program.  This uses the EDITOR
and VISUAL environment variables, and falls back to `vi` on Unix, or
`notepad.exe` on Windows.

## osenv.shell()

The SHELL on Unix, which Windows calls the ComSpec.  Defaults to 'bash'
or 'cmd'.

Version data entries

296 entries across 133 versions & 23 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/osenv/README.md
disco_app-0.18.0 test/dummy/node_modules/fsevents/node_modules/osenv/README.md
disco_app-0.18.0 test/dummy/node_modules/osenv/README.md
disco_app-0.18.2 test/dummy/node_modules/osenv/README.md
disco_app-0.16.1 test/dummy/node_modules/osenv/README.md
disco_app-0.15.2 test/dummy/node_modules/osenv/README.md
disco_app-0.18.4 test/dummy/node_modules/osenv/README.md
disco_app-0.18.1 test/dummy/node_modules/osenv/README.md
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/osenv/README.md
disco_app-0.14.0 test/dummy/node_modules/osenv/README.md
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/osenv/README.md
tang-0.2.1 spec/tang_app/node_modules/osenv/README.md
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/osenv/README.md
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/osenv/README.md
ruby2js-4.0.4 lib/tasks/testrails/node_modules/osenv/README.md
ruby2js-4.0.3 lib/tasks/testrails/node_modules/osenv/README.md
tang-0.2.0 spec/tang_app/node_modules/osenv/README.md
tang-0.1.0 spec/tang_app/node_modules/osenv/README.md
tang-0.0.9 spec/tang_app/node_modules/osenv/README.md
enju_library-0.3.8 spec/dummy/node_modules/fsevents/node_modules/osenv/README.md