mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-10 21:01:41 +00:00
update
This commit is contained in:
15
node_modules/osenv/LICENSE
generated
vendored
Normal file
15
node_modules/osenv/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
63
node_modules/osenv/README.md
generated
vendored
Normal file
63
node_modules/osenv/README.md
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
# 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'.
|
72
node_modules/osenv/osenv.js
generated
vendored
Normal file
72
node_modules/osenv/osenv.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
var isWindows = process.platform === 'win32'
|
||||
var path = require('path')
|
||||
var exec = require('child_process').exec
|
||||
var osTmpdir = require('os-tmpdir')
|
||||
var osHomedir = require('os-homedir')
|
||||
|
||||
// looking up envs is a bit costly.
|
||||
// Also, sometimes we want to have a fallback
|
||||
// Pass in a callback to wait for the fallback on failures
|
||||
// After the first lookup, always returns the same thing.
|
||||
function memo (key, lookup, fallback) {
|
||||
var fell = false
|
||||
var falling = false
|
||||
exports[key] = function (cb) {
|
||||
var val = lookup()
|
||||
if (!val && !fell && !falling && fallback) {
|
||||
fell = true
|
||||
falling = true
|
||||
exec(fallback, function (er, output, stderr) {
|
||||
falling = false
|
||||
if (er) return // oh well, we tried
|
||||
val = output.trim()
|
||||
})
|
||||
}
|
||||
exports[key] = function (cb) {
|
||||
if (cb) process.nextTick(cb.bind(null, null, val))
|
||||
return val
|
||||
}
|
||||
if (cb && !falling) process.nextTick(cb.bind(null, null, val))
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
memo('user', function () {
|
||||
return ( isWindows
|
||||
? process.env.USERDOMAIN + '\\' + process.env.USERNAME
|
||||
: process.env.USER
|
||||
)
|
||||
}, 'whoami')
|
||||
|
||||
memo('prompt', function () {
|
||||
return isWindows ? process.env.PROMPT : process.env.PS1
|
||||
})
|
||||
|
||||
memo('hostname', function () {
|
||||
return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME
|
||||
}, 'hostname')
|
||||
|
||||
memo('tmpdir', function () {
|
||||
return osTmpdir()
|
||||
})
|
||||
|
||||
memo('home', function () {
|
||||
return osHomedir()
|
||||
})
|
||||
|
||||
memo('path', function () {
|
||||
return (process.env.PATH ||
|
||||
process.env.Path ||
|
||||
process.env.path).split(isWindows ? ';' : ':')
|
||||
})
|
||||
|
||||
memo('editor', function () {
|
||||
return process.env.EDITOR ||
|
||||
process.env.VISUAL ||
|
||||
(isWindows ? 'notepad.exe' : 'vi')
|
||||
})
|
||||
|
||||
memo('shell', function () {
|
||||
return isWindows ? process.env.ComSpec || 'cmd'
|
||||
: process.env.SHELL || 'bash'
|
||||
})
|
76
node_modules/osenv/package.json
generated
vendored
Normal file
76
node_modules/osenv/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"osenv@0.1.5",
|
||||
"/Users/tatiana/selfdefined"
|
||||
]
|
||||
],
|
||||
"_from": "osenv@0.1.5",
|
||||
"_id": "osenv@0.1.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
|
||||
"_location": "/osenv",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "osenv@0.1.5",
|
||||
"name": "osenv",
|
||||
"escapedName": "osenv",
|
||||
"rawSpec": "0.1.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.1.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nopt"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
|
||||
"_spec": "0.1.5",
|
||||
"_where": "/Users/tatiana/selfdefined",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/osenv/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"os-homedir": "^1.0.0",
|
||||
"os-tmpdir": "^1.0.0"
|
||||
},
|
||||
"description": "Look up environment settings specific to different operating systems",
|
||||
"devDependencies": {
|
||||
"tap": "^11.1.0"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"osenv.js"
|
||||
],
|
||||
"homepage": "https://github.com/npm/osenv#readme",
|
||||
"keywords": [
|
||||
"environment",
|
||||
"variable",
|
||||
"home",
|
||||
"tmpdir",
|
||||
"path",
|
||||
"prompt",
|
||||
"ps1"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "osenv.js",
|
||||
"name": "osenv",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/osenv.git"
|
||||
},
|
||||
"scripts": {
|
||||
"postpublish": "git push origin --all; git push origin --tags",
|
||||
"postversion": "npm publish",
|
||||
"preversion": "npm test",
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.1.5"
|
||||
}
|
Reference in New Issue
Block a user