Sha256: 63aa750c90c3d233317fe39368433b1ffc175c82ca9e7087102b86a911bca61e

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

require "thor"
require "yaml"
require_relative "client"
require_relative "version"

module Hackpad
  module Cli
    class Runner < Thor

      class_option :configdir,
        aliases: "-c",
        default: File.join(ENV["HOME"], ".hackpad-cli/"),
        desc: "Path to the hackpad-cli directory to use."

      class_option :workspace,
        aliases: "-w",
        default: "default",
        desc: "Name of the workspace to use."

      class_option :refresh,
        aliases: "-r",
        type: 'boolean',
        default: false,
        desc: "Add this if you want refresh the cache."

      class_option :urls,
        aliases: "-u",
        type: 'boolean',
        default: false,
        desc: "Displays urls rather than pad ids."

      class_option :plain,
        aliases: "-p",
        type: 'boolean',
        default: false,
        desc: "Add this if you don't want colors."

      default_task :help

      desc "search [term]", "Lists available pads matching [term]."
      def search(term)
        Hackpad::Cli::Client.new(options).search term
      end

      desc "list", "Lists available pads."
      def list
        Hackpad::Cli::Client.new(options).list
      end

      desc "check", "Checks differences between local cache and remote list."
      def check
        Hackpad::Cli::Client.new(options).check
      end

      desc "info [pad_id]", "gets info for the pad <pad_id>."
      def info(pad)
        Hackpad::Cli::Client.new(options).info pad
      end

      desc "show [pad_id] [format]", "shows pad <pad_id> in format [html,txt,md] (default txt)."
      def show(pad,format='txt')
        Hackpad::Cli::Client.new(options).show pad, format
      end

      desc "version", "Displays the hackpad-cli version."
      def version
        puts Hackpad::Cli::VERSION
      end


      desc "colors", "displays colorize color matrix.", hide: true
      def colors
        require 'colorize'
        String.color_matrix ' xoxo '
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackpad-cli-0.0.7 lib/hackpad/cli/runner.rb