Permalink
Browse files

init

  • Loading branch information...
0 parents commit 74991821efd26b6b0818e5aad1a69aa4e2a79733 @sindresorhus committed Aug 3, 2014
Showing with 169 additions and 0 deletions.
  1. +16 −0 .editorconfig
  2. +1 −0 .gitattributes
  3. +1 −0 .gitignore
  4. +13 −0 .jshintrc
  5. +3 −0 .travis.yml
  6. +26 −0 cli.js
  7. +2 −0 index.js
  8. +21 −0 license
  9. +39 −0 package.json
  10. +40 −0 readme.md
  11. +7 −0 test.js
@@ -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
@@ -0,0 +1 @@
+* text=auto
@@ -0,0 +1 @@
+node_modules
@@ -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
+}
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - '0.10'
@@ -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);
@@ -0,0 +1,2 @@
+'use strict';
+module.exports = process.platform === 'win32' ? (process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH) : process.env.HOME;
@@ -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.
@@ -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"
+ }
+}
@@ -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)
@@ -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.