Skip to content

Commit

Permalink
Merge pull request #1 from anandthakker/master
Browse files Browse the repository at this point in the history
Add CLI
  • Loading branch information
Scisco committed May 14, 2015
2 parents aab23ca + dce998a commit 090b82a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ gdalinfo.remote('http://example.com/somefile.TIF', function(err, metadata) {

```

#### From Command Line

```bash
npm install -g gdalinfo-json
gdalinfo-json somefile.TIF
```

### Example output

```json
Expand Down
18 changes: 18 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node
'use strict';

var gdalinfo = require('./');

if (process.argv.length < 3) {
console.log('Usage: ', process.argv[0], process.argv[1], ' FILENAME|URL');
process.exit();
}

gdalinfo.local(process.argv[2], function(err, metadata) {
if (err) {
console.error(err);
process.exit(1);
}
console.log(JSON.stringify(metadata));
process.exit();
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.4.1",
"description": "gdalinfo output in json",
"main": "index.js",
"bin": "cli.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha"
},
Expand Down

0 comments on commit 090b82a

Please sign in to comment.