Skip to content

Commit

Permalink
Add initial filings command
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed May 11, 2013
1 parent f653419 commit 46aba5b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions bin/filings
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('../lib/filings-cli').run()
7 changes: 6 additions & 1 deletion package.json
@@ -1,13 +1,17 @@
{
"name": "filings",
"descriptions": "SEC filings module",
"version": "0.0.0",
"licenses": [
{
"type": "MIT",
"url": "http://github.com/kevinsawicki/filings/raw/master/LICENSE.md"
}
],
"main": "./lib/filings.js",
"bin": {
"filings": "./bin/filings"
},
"keywords": [
"sec",
"edgar",
Expand Down Expand Up @@ -40,6 +44,7 @@
"dependencies": {
"xpath": "0.0.5",
"xmldom": "~0.1.16",
"ls-archive": "~0.5.0"
"ls-archive": "~0.5.0",
"optimist": "~0.4.0"
}
}
21 changes: 21 additions & 0 deletions src/filings-cli.coffee
@@ -0,0 +1,21 @@
fs = require 'fs'
optimist = require 'optimist'

parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options

module.exports =
run: (args=process.argv[2..]) ->
options = parseOptions(args)
if options.argv.v
console.log JSON.parse(fs.readFileSync('package.json')).version
else if options.argv.h
options.showHelp()
else if command = options.argv._.shift()
console.error "Unrecognized command: #{command}"
else
options.showHelp()

0 comments on commit 46aba5b

Please sign in to comment.