Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Sep 7, 2018
0 parents commit 399422d
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# editorconfig.org
root = true

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

# Use tabs in JavaScript and JSON.
[**.{js, json}]
indent_style = tab
indent_size = 4

# Use spaces in YAML.
[**.{yml,yaml}]
indent_style = spaces
indent_size = 2
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
Thumbs.db

.nvm-version
node_modules
npm-debug.log
pnpm-debug.log

package-lock.json
shrinkwrap.yaml
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sudo: false
language: node_js
node_js:
- 'stable'
- '8'
39 changes: 39 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env node
'use strict'

const mri = require('mri')

const pkg = require('./package.json')

const argv = mri(process.argv.slice(2), {
boolean: [
'help', 'h',
'version', 'v',
'json', 'j'
]
})

if (argv.help || argv.h) {
process.stdout.write(`
Usage:
cat gtfs-rt-feed.pbf | print-gtfs-rt
Options:
--json -j Output JSON instead of a pretty represenation.
Examples:
curl 'https://example.org/gtfs-rt.pbf' | print-gtfs-rt
\n`)
process.exit(0)
}

if (argv.version || argv.v) {
process.stdout.write(`print-gtfs-rt v${pkg.version}\n`)
process.exit(0)
}

const showError = (err) => {
if (process.env.NODE_ENV === 'dev') console.error(err)
else console.error(err.message || (err + ''))
process.exit(1)
}

// todo
5 changes: 5 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Copyright (c) 2018, Jannis R

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
35 changes: 35 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "print-gtfs-rt-cli",
"description": "Read a GTFS Realtime feed from stdin, print human-readable or as JSON.",
"version": "1.0.0",
"files": [
"cli.js"
],
"bin": {
"print-gtfs-rt": "./cli.js"
},
"keywords": [
"gtfs",
"general transit feed specification",
"gtfs-rt",
"realtime",
"feed",
"command line",
"cli"
],
"author": "Jannis R <mail@jannisr.de>",
"homepage": "https://github.com/derhuerst/fetch-gtfs-rt-cli",
"repository": "derhuerst/fetch-gtfs-rt-cli",
"bugs": "https://github.com/derhuerst/fetch-gtfs-rt-cli/issues",
"license": "ISC",
"engines": {
"node": ">=8"
},
"dependencies": {
"mri": "^1.1.1"
},
"scripts": {
"test": "echo todo; exit 1",
"prepublishOnly": "npm test"
}
}
35 changes: 35 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# print-gtfs-rt-cli

**Read a [GTFS Realtime](https://developers.google.com/transit/gtfs-realtime/) feed from stdin, print human-readable or as JSON.**

[![npm version](https://img.shields.io/npm/v/print-gtfs-rt-cli.svg)](https://www.npmjs.com/package/print-gtfs-rt-cli)
[![build status](https://api.travis-ci.org/derhuerst/print-gtfs-rt-cli.svg?branch=master)](https://travis-ci.org/derhuerst/print-gtfs-rt-cli)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/print-gtfs-rt-cli.svg)
[![chat with me on Gitter](https://img.shields.io/badge/chat%20with%20me-on%20gitter-512e92.svg)](https://gitter.im/derhuerst)
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)


## Installing

```shell
npm install -g print-gtfs-rt-cli
```

Or use [`npx`](https://npmjs.com/package/npx). ✨


## Usage

```
Usage:
cat gtfs-rt-feed.pbf | print-gtfs-rt
Options:
--json -j Output JSON instead of a pretty represenation.
Examples:
curl 'https://example.org/gtfs-rt.pbf' | print-gtfs-rt
```


## Contributing

If you have a question or have difficulties using `print-gtfs-rt-cli`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/print-gtfs-rt-cli/issues).

0 comments on commit 399422d

Please sign in to comment.