def do_move_options(type)
      options = OpenStruct.new
      opt_parser = OptionParser.new do |opts|
        if type == 'publish'
          opts.on('-d', '--keep-draft', "Keep draft post") do |d|
            options.keep_draft = d
          end
        else
          opts.on('-p', '--keep-post', "Do not delete post") do |p|
            options.keep_post = p
          end
        end

        opts.on('-t', '--keep-timestamp', "Keep existing timestamp") do |t|
          options.keep_timestamp = t
        end
      end

      opt_parser.parse! @params
      options
    end
def do_move_options(type)
      options = OpenStruct.new
      opt_parser = OptionParser.new do |opts|
        if type == 'publish'
          opts.on('-d', '--keep-draft', "Keep draft post") do |d|
            options.keep_draft = d
          end
        else
          opts.on('-p', '--keep-post', "Do not delete post") do |p|
            options.keep_post = p
          end
        end

        opts.on('-t', '--keep-timestamp', "Keep existing timestamp") do |t|
          options.keep_timestamp = t
        end
      end

      opt_parser.parse! @params
      options
    end
def do_move_options ( type ) options = OpenStruct . new opt_parser = OptionParser . new do | opts | if type == 'publish' opts . on ( '-d' , '--keep-draft' , "Keep draft post" ) do | d | options . keep_draft = d end else opts . on ( '-p' , '--keep-post' , "Do not delete post" ) do | p | options . keep_post = p end end opts . on ( '-t' , '--keep-timestamp' , "Keep existing timestamp" ) do | t | options . keep_timestamp = t end end opt_parser . parse! @params options end
pass a string, either publish or unpublish
pass a string either publish or unpublish