#!/usr/bin/env ruby $:.unshift(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')) require "gli" require "connfu/version" require "connfu/cli/generator" include GLI program_desc "connfu-client provides an easy way to manage and the fetch events in any of your connFu applications." version Connfu::VERSION desc "Be verbose my friend" switch :v desc "Use scaffold to create a basic application that listens to all the available connFu channels" long_desc <" usage << "\n\nOptions:" c.switches.each do |s| usage << "\n -#{s[0]}: #{s[1].description}" end c.flags.each do |f| usage << "\n -#{f[0]}: #{f[1].description}. Default value: #{f[1].default_value}" end usage << "\n\n" puts usage raise "" end puts " #{green("create")} #{args[0]}" Connfu::Cli::Generator.run(args[0], options[:c], options[:f]) puts " #{green("create")} #{options[:f]}" puts " #{green("Application created!!")}" puts "\n" # Your command logic here # If you have any errors, just raise them # raise "that command made no sense" end end pre do |global, command, options, args| puts "Executing #{command.name}" if global[:v] true end post do |global, command, options, args| puts "Executed #{command.name}" if global[:v] end on_error do |exception| # Error logic here # return false to skip default error handling true end def green(text) "\e[32m#{text}\e[0m" end exit GLI.run(ARGV)