bin/brief in brief-0.0.5 vs bin/brief in brief-1.0.0

- old
+ new

@@ -1,35 +1,22 @@ #!/usr/bin/env ruby -# -lib = File.join(File.dirname(__FILE__), '../lib') -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -begin - require "rubygems" - require 'colored' - require "commander/import" - require "pry" - require "brief" -end +$:.unshift File.join(File.dirname(__FILE__),'..','lib') -program :name, 'Brief' -program :version, Brief::Version -program :description, 'Brief CLI' +require 'rubygems' +require 'brief' +require 'brief/dsl' -command :inspect do |c| - c.syntax = 'brief inspect file [options]' - c.description = 'Debug the parsing of a brief' +$briefcase = Brief::Briefcase.new(root: Dir.pwd()) - c.action do |args, options| - path = Pathname(args.first) - path = path.relative? ? Brief.root.join(path) : path - doc = Brief::Document.new(path) - - doc.elements do |el| - puts el.inspect - end - end -end +if ARGV[0] == "console" + require 'pry' + Pry.start($briefcase) +else + require 'commander/import' -Pathname(lib).join("brief","cli","commands").children.each do |f| - require(File.expand_path(f)) if f.file? + program :name, "Brief" + program :description, "Brief makes writing markdown more productive" + program :version, "0.0.1" + + Brief.load_commands() end