Sha256: d16b7475bb51445b0aa7c887f2a158757cf6245019b0b64a6a3590f964126153

Contents?: true

Size: 675 Bytes

Versions: 26

Compression:

Stored size: 675 Bytes

Contents

command 'write' do |c|
  c.syntax = 'brief write MODEL_TYPE [OPTIONS]'
  c.description = 'Create a new document for a given model type'

  c.action do |args, _options|
    string_args = args.select { |a| a.is_a?(String) }
    model_class = Brief::Model.lookup_class_from_args(string_args)

    base_content = ''

    if model_class && model_class.example_body.to_s.length > 0
      base_content = model_class.example_body
    else
      # document_contents = model_class.inspect + model_class.example_body.to_s
    end

    document_contents = ask_editor(base_content)
    file = ask('enter a name for this file:', String)

    puts file
    puts document_contents
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
brief-1.8.11 lib/brief/cli/write.rb
brief-1.8.10 lib/brief/cli/write.rb
brief-1.8.9 lib/brief/cli/write.rb
brief-1.8.8 lib/brief/cli/write.rb
brief-1.8.6 lib/brief/cli/write.rb
brief-1.8.5 lib/brief/cli/write.rb
brief-1.8.4 lib/brief/cli/write.rb
brief-1.8.3 lib/brief/cli/write.rb
brief-1.8.2 lib/brief/cli/write.rb
brief-1.8.1 lib/brief/cli/write.rb
brief-1.8.0 lib/brief/cli/write.rb
brief-1.7.3 lib/brief/cli/write.rb
brief-1.7.2 lib/brief/cli/write.rb
brief-1.7.1 lib/brief/cli/write.rb
brief-1.7.0 lib/brief/cli/write.rb
brief-1.6.1 lib/brief/cli/write.rb
brief-1.6.0 lib/brief/cli/write.rb
brief-1.5.2 lib/brief/cli/write.rb
brief-1.5.1 lib/brief/cli/write.rb
brief-1.5.0 lib/brief/cli/write.rb