Permalink
Browse files

got command line options ... proper > frank runner as well :P

  • Loading branch information...
1 parent 2d84f5b commit 740276437395fafda24933a3d10f92675262dbb6 @msuarz msuarz committed Aug 26, 2012
Showing with 17 additions and 19 deletions.
  1. +3 −4 docs/src/frank.coffee
  2. +11 −14 src/readers/settings.coffee
  3. +3 −1 src/settings.coffee
View
7 docs/src/frank.coffee
@@ -1,8 +1,7 @@
-{ frank } = require '../../src/frankendoc'
+{ exec } = require 'child_process'
class @Frank
- '> frank @path': (path) ->
- settings.docs.root = path
- frank()
+ '> frank @args': (args, done) ->
+ exec 'coffee src/frank ' + args, (err, @out) -> done err
View
25 src/readers/settings.coffee
@@ -1,32 +1,29 @@
fs = require 'fs'
path = require 'path'
+{ argv } = require 'optimist'
_ = require 'underscore'
{ defaults } = require '../settings'
@read = ->
- set_defaults()
+ global.settings = {}
+ merge settings, defaults
+ set_root_folder()
merge_user_settings()
+ merge settings, argv
###
-# Defaults
+# Root Folder
###
-set_defaults = ->
- global.settings = {}
- merge settings, defaults
- set_docs_defaults()
- set_code_defaults()
-
-set_docs_defaults = ->
+set_root_folder = ->
+ return unless argv._.length
+ settings.docs.root = argv._[0]
ext = path.extname settings.docs.root
if ext.length
settings.docs.root = path.dirname settings.docs.root
settings.docs.type = ext
-
-set_code_defaults = ->
- settings.code ?= {}
- settings.code.root ?= settings.docs.root
+ settings.code.root = settings.docs.root
###
# User settings
@@ -42,7 +39,7 @@ user_settings = -> require(user_settings_file()).settings
merge = (one, another) ->
for property, value of another
- if _.isObject value and one[property]?
+ if _.isObject(value) and _.isObject(one[property])
merge one[property], value
else
one[property] = value
View
4 src/settings.coffee
@@ -11,7 +11,9 @@
'''
docs:
source: 'files'
- root: process.argv[2] or '.'
+ root: '.'
type: '.txt'
multiline_arg: '"""'
report: 'console'
+ code:
+ root: '.'

0 comments on commit 7402764

Please sign in to comment.