default-shell
Advanced tools
Comparing version 1.0.1 to 2.0.0
23
index.js
@@ -1,8 +0,6 @@ | ||
'use strict'; | ||
module.exports = (() => { | ||
const env = process.env; | ||
import process from 'node:process'; | ||
import {userInfo} from 'node:os'; | ||
if (process.platform === 'darwin') { | ||
return env.SHELL || '/bin/bash'; | ||
} | ||
const defaultShell = (() => { | ||
const {env} = process; | ||
@@ -13,3 +11,16 @@ if (process.platform === 'win32') { | ||
try { | ||
const {shell} = userInfo(); | ||
if (shell) { | ||
return shell; | ||
} | ||
} catch {} | ||
if (process.platform === 'darwin') { | ||
return env.SHELL || '/bin/zsh'; | ||
} | ||
return env.SHELL || '/bin/sh'; | ||
})(); | ||
export default defaultShell; |
{ | ||
"name": "default-shell", | ||
"version": "1.0.1", | ||
"description": "Get the user's default shell", | ||
"license": "MIT", | ||
"repository": "sindresorhus/default-shell", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"default", | ||
"shell", | ||
"sh", | ||
"zsh", | ||
"bash", | ||
"cmd", | ||
"cmd.exe", | ||
"comspec", | ||
"env", | ||
"environment", | ||
"var", | ||
"variables", | ||
"get", | ||
"user" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "default-shell", | ||
"version": "2.0.0", | ||
"description": "Get the user's default shell", | ||
"license": "MIT", | ||
"repository": "sindresorhus/default-shell", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"default", | ||
"shell", | ||
"sh", | ||
"zsh", | ||
"bash", | ||
"cmd", | ||
"comspec", | ||
"env", | ||
"environment", | ||
"variables", | ||
"get", | ||
"user" | ||
], | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# default-shell [![Build Status](https://travis-ci.org/sindresorhus/default-shell.svg?branch=master)](https://travis-ci.org/sindresorhus/default-shell) | ||
# default-shell | ||
> Get the user's default [shell](https://en.wikipedia.org/wiki/Shell_(computing)) | ||
## Install | ||
@@ -12,9 +11,8 @@ | ||
## Usage | ||
```js | ||
const defaultShell = require('default-shell'); | ||
import defaultShell from 'default-shell'; | ||
// OS X | ||
// macOS | ||
console.log(defaultShell); | ||
@@ -27,6 +25,1 @@ //=> '/bin/bash' | ||
``` | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2625
19
Yes
24