lib/brief/cli/render.rb in brief-1.8.9 vs lib/brief/cli/render.rb in brief-1.8.10

- old
+ new

@@ -5,10 +5,12 @@ c.option '--root PATH', String, 'The briefcase root' c.option '--output PATH', String, 'Save the output to the specified path' c.option '--app APP', String, 'Use the specified app to get our models etc' c.option '--config PATH', String, 'Use the specified config file' c.option '--include-raw', nil, 'Whether or not to include the raw content' + c.option '--type STRING', String, 'What type of document should this be?' + c.option '--all', 'Render all of the things' c.action do |args, options| options.default(root: Pathname(Brief.pwd)) o = { @@ -20,13 +22,15 @@ briefcase = Brief::Briefcase.new(o) index = 0 - rendered = if args.empty? + rendered = if options.all briefcase.all_models.map do |model| model.document.to_html(script: true, content: !!(options.include_raw), skip_preamble: (index += 1) > 1) end + elsif args.empty? && stdin = STDIN.read + stdin else args.map do |a| Dir[briefcase.root.join(a)].map do |f| doc = Brief::Document.new(f).in_briefcase(briefcase) doc.to_html(script: true, content: !!(options.include_raw), skip_preamble: (index += 1) > 1)