meissadia/tumblr_draftking

View on GitHub
lib/draftking/cli/commands/movedrafts.rb

Summary

Maintainability
A
0 mins
Test Coverage
module DK
  class CLI < Thor
    desc 'movedrafts, md', 'Move drafts to queue.'
    long_desc <<-LONGDESC
    `md` will move posts from your Drafts to your Queue.

    Note:
    - Old tags are removed by default. Pass -k option to preserve them.
    - Previous comments are be removed by default. Pass -K option to preserve them.
    - New tags will be generated by from the comment contents. Use -t <tags> for additional tagging.
    LONGDESC
    option :limit,         type: :numeric, aliases: :l, desc: Options.op_strings[:limit]
    option :blog,          type: :string,  aliases: :b, desc: Options.op_strings[:blog]
    option :key_text,      type: :string,  aliases: :f, desc: Options.op_strings[:key_text]
    option :comment,       type: :string,  aliases: :c, desc: Options.op_strings[:comment]
    option :add_tags,      type: :string,  aliases: :t, desc: Options.op_strings[:add_tags]
    option :simulate,      type: :boolean, aliases: :s, desc: Options.op_strings[:simulate]
    option :publish,       type: :boolean, aliases: :p, desc: Options.op_strings[:publish]
    option :mute,          type: :boolean, aliases: :m, desc: Options.op_strings[:mute]
    option :keep_tags,     type: :boolean, aliases: :k, desc: Options.op_strings[:keep_tags]
    option :keep_comments, type: :boolean, aliases: :K, desc: Options.op_strings[:keep_comments]
    option :greedy,        type: :boolean, aliases: :g, desc: Options.op_strings[:greedy]
    option :show_pi,       type: :boolean, desc: Options.op_strings[:show_pi], default: true
    option :credit,        type: :boolean, desc: Options.op_strings[:credit],  default: true
    option :tags,          type: :boolean, desc: Options.op_strings[:tags],    default: true
    option :config,        type: :string,  desc: Options.op_strings[:config]
    def movedrafts
      configured?
      opts   = process_options(options)
      dk     = get_dk_instance(opts)
      dk.drafts_to_queue(opts)
    end
    map 'md' => :movedrafts
  end
end