From 98e7404249147420d562a2463fad90281fedb9ff Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Fri, 30 Sep 2016 11:02:26 -0400 Subject: [PATCH] Fixed some paths that needed to be relative. Added some example commands to the main. --- bin/apex | 41 +++++++++++++++-------------------------- lib/apex.rb | 2 +- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/bin/apex b/bin/apex index f3bd959..5987898 100755 --- a/bin/apex +++ b/bin/apex @@ -2,41 +2,30 @@ require 'optparse' require 'methadone' -require 'apex.rb' +require_relative '../lib/apex.rb' class App include Methadone::Main include Methadone::CLILogging - main do # Add args you want: |like,so| - # your program code here - # You can access CLI options via - # the options Hash + main do |needed, maybe| + options[:switch] + options[:flag] end - # supplemental methods here - - # Declare command-line interface here - - # description "one line description of your app" - # - # Accept flags via: - # on("--flag VAL","Some flag") - # options[flag] will contain VAL - # - # Specify switches via: - # on("--[no-]switch","Some switch") - # - # Or, just call OptionParser methods on opts - # - # Require an argument - # arg :some_arg - # - # # Make an argument optional - # arg :optional_arg, :optional - + description "APEX reference implementation for the APEX protocol." version Apex::VERSION + # Proxy to an OptionParser instance's on method + on("--[no]-switch", "Toggles the switch") + on("--flag VALUE", "Sets the flag.") + + arg :needed + arg :maybe, :optional + + defaults_from_env_var 'SOME_VAR' + defaults_from_config_file '.apex.rc' + use_log_level_option :toggle_debug_on_signal => 'USR1' go! diff --git a/lib/apex.rb b/lib/apex.rb index c87980e..0b9db71 100644 --- a/lib/apex.rb +++ b/lib/apex.rb @@ -1,4 +1,4 @@ -require "apex/version" +require_relative "apex/version" module Apex # Your code goes here... -- GitLab