Skip to content

Commit

Permalink
Merge, style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Apr 9, 2014
1 parent 16f5e12 commit af98e3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
28 changes: 17 additions & 11 deletions geojsonio.js
Expand Up @@ -7,13 +7,15 @@ var concat = require('concat-stream'),
fs = require('fs'),
GitHubApi = require('github'),
github = new GitHubApi({
version: "3.0.0",
protocol: "https"
version: '3.0.0',
protocol: 'https'
});
argv = require('minimist')(process.argv.slice(2));
MAX_URL_LEN = 150e3;

if (argv.help || argv.h || !(argv._[0] || !tty.isatty(0))) return help();
if (argv.help || argv.h || !(argv._[0] || !tty.isatty(0))) {
return help();
}

((argv._[0] && fs.createReadStream(argv._[0])) || process.stdin).pipe(concat(openData));

Expand All @@ -23,16 +25,18 @@ function openData(body) {
JSON.stringify(JSON.parse(body.toString()))));
} else {
github.gists.create({
"description": "",
"public": true,
"files": {
"map.geojson": {"content": JSON.stringify(JSON.parse(body.toString()))}
}
description: '',
public: true,
files: {
'map.geojson': {
content: JSON.stringify(JSON.parse(body.toString()))
}
}
}, function (err, res) {
if (err) {
console.error("Unable to create Gist:" + JSON.stringify(res));
console.error('Unable to create Gist:' + JSON.stringify(res));
} else {
displayResource("#id=gist:/" + res.id);
displayResource('#id=gist:/' + res.id);
}
});
}
Expand All @@ -48,4 +52,6 @@ function displayResource(path) {
}
}

function help() { fs.createReadStream(path.join(__dirname, 'README.md')).pipe(process.stdout); }
function help() {
fs.createReadStream(path.join(__dirname, 'README.md')).pipe(process.stdout);
}
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -27,5 +27,8 @@
"opener": "~1.3.0",
"concat-stream": "~1.0.1",
"minimist": "0.0.2"
},
"devDependencies": {
"github": "~0.1.15"
}
}

0 comments on commit af98e3a

Please sign in to comment.