Class: Bunto::Commands::Draft
- Inherits:
-
Command
- Object
- Command
- Bunto::Commands::Draft
- Defined in:
- lib/bunto/commands/draft.rb
Defined Under Namespace
Classes: DraftFileInfo
Class Method Summary collapse
Class Method Details
.init_with_program(prog) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/bunto/commands/draft.rb', line 4 def self.init_with_program(prog) prog.command(:draft) do |c| c.syntax 'draft NAME' c.description 'Creates a new draft post with the given NAME' .each {|opt| c.option *opt } c.action { |args, | process args, } end end |
.options ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/bunto/commands/draft.rb', line 15 def self. [ ['extension', '-x EXTENSION', '--extension EXTENSION', 'Specify the file extension'], ['layout', '-l LAYOUT', '--layout LAYOUT', "Specify the draft layout"], ['force', '-f', '--force', 'Overwrite a draft if it already exists'] ] end |
.process(args = [], options = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/bunto/commands/draft.rb', line 24 def self.process(args = [], = {}) params = Compose::ArgParser.new args, params.validate! draft = DraftFileInfo.new params Compose::FileCreator.new(draft, params.force?).create! end |