Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 3, 2014
0 parents commit 7499182
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
@@ -0,0 +1,16 @@
# editorconfig.org
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* text=auto
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
13 changes: 13 additions & 0 deletions .jshintrc
@@ -0,0 +1,13 @@
{
"node": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"immed": true,
"newcap": true,
"noarg": true,
"undef": true,
"unused": "vars",
"strict": true
}
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
language: node_js
node_js:
- '0.10'
26 changes: 26 additions & 0 deletions cli.js
@@ -0,0 +1,26 @@
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var userHome = require('./');

function help() {
console.log([
pkg.description,
'',
'Example',
' $ user-home',
' /Users/sindresorhus'
].join('\n'));
}

if (process.argv.indexOf('--help') !== -1) {
help();
return;
}

if (process.argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}

process.stdout.write(userHome);
2 changes: 2 additions & 0 deletions index.js
@@ -0,0 +1,2 @@
'use strict';
module.exports = process.platform === 'win32' ? (process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH) : process.env.HOME;
21 changes: 21 additions & 0 deletions license
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
39 changes: 39 additions & 0 deletions package.json
@@ -0,0 +1,39 @@
{
"name": "user-home",
"version": "0.0.0",
"description": "Get the path to the user home directory",
"license": "MIT",
"repository": "sindresorhus/user-home",
"bin": {
"user-home": "cli.js"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js",
"cli.js"
],
"keywords": [
"cli",
"bin",
"user",
"home",
"homedir",
"dir",
"directory",
"folder",
"path"
],
"devDependencies": {
"ava": "0.0.3"
}
}
40 changes: 40 additions & 0 deletions readme.md
@@ -0,0 +1,40 @@
# user-home [![Build Status](https://travis-ci.org/sindresorhus/user-home.svg?branch=master)](https://travis-ci.org/sindresorhus/user-home)

> Get the path to the user home directory

## Install

```sh
$ npm install --save user-home
```


## Usage

```js
var userHome = require('user-home');

console.log(userHome);
//=> /Users/sindresorhus
```


## CLI

```sh
$ npm install --global user-home
```

```sh
$ user-home --help

Example
$ user-home
/Users/sindresorhus
```


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)
7 changes: 7 additions & 0 deletions test.js
@@ -0,0 +1,7 @@
'use strict';
var test = require('ava');
var userHome = require('./');

test(function (t) {
t.assert(userHome.length > 0);
});

0 comments on commit 7499182

Please sign in to comment.