Sha256: 65067f1bc9734be1c671ba02017fb770e0392228e27b7ee33670758cc6608402

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'

begin
  require 'dotenv'
  Dotenv.load
rescue LoadError
end

require 'zoho_hub/cli/callback_server'
require 'zoho_hub/cli/read_modules'

command = ARGV[0]

def print_commands
  commands = [
    ['callback-server', 'run a http server to serve as oauth callback to get a refresh token'],
    ['read-modules', 'read the configuration from Zoho CRM and save it locally']
  ]

  largest_name = commands.map(&:first).max_by(&:length)
  left_pad = largest_name.length + 5

  commands.each do |command|
    $stdout.print "   #{command.first}".ljust(left_pad)
    $stdout.puts command.last
  end
end

case command
when 'callback-server'
  ZohoHub::Cli::CallbackServer.new.run(ARGV[1..-1])
when 'read-modules'
  ZohoHub::Cli::ReadModules.new.run(ARGV[1..-1])
else
  $stdout.puts 'Usage:'
  $stdout.puts "    zoho_hub [command] [options]\n"
  $stdout.puts 'where <command> is one of:'

  print_commands
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zoho_hub-0.4.2 bin/zoho_hub
zoho_hub-0.4.1 bin/zoho_hub
zoho_hub-0.4.0 bin/zoho_hub
zoho_hub-0.3.0 bin/zoho_hub