Sha256: c425770c4ea018724242c863d8798d2a9dbd82d4aa01071cee60692db3164be9

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

command :write do |c|
  c.syntax = 'brief write PUBLISHER [options]'

  c.option '--file FILE', 'Specify a file to read from. Otherwise we use $EDITOR'

  c.action do |args, options|
    path = case
           when options.file
             Pathname(options.file)
           when (Pathname(args.last).exist? rescue false)
             Pathname(args.pop)
           end


    publisher       = Brief::Publisher.find(args)

    content = ask_editor(publisher.sample)

    if content == publisher.sample
      say "Ignoring editor input, same as sample"
    else
      document = Brief::Document.new(content)
      document.publish(publisher)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brief-0.0.5 lib/brief/cli/commands/write.rb
brief-0.0.4 lib/brief/cli/commands/write.rb