Sha256: 830edef22db2bbc125f00ae1184a6780419d5a4dd4667b1ae48fcb7245abe087

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'howami.rb'

class App
  include Methadone::Main
  include Methadone::CLILogging
  include Howami

  main do # Add args you want: |like,so|
    # your program code here
    # You can access CLI options via
    # the options Hash

    if options[:auth]
      Authentication.new.do_interactive_auth
    else
      unless Configuration.has_valid_credentials?
        fatal "You need to authenticate first, please run `howami --auth`"
        exit 1
      end
      fit_obj = Fitbit.new
      Howami::cli_run!(fit_obj)
    end

  end

  # supplemental methods here
  # def do_auth
  #   Howami::Authentication.new.do_interactive_auth
  # end

  # 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")
  on("--auth","Authenticate howami to the Fitbit API")
  #
  # Or, just call OptionParser methods on opts
  #
  # Require an argument
  # arg :some_arg 
  #
  # # Make an argument optional
  # arg :optional_arg, :optional

  version Howami::VERSION

  use_log_level_option

  go!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
howami-0.0.2 bin/howami
howami-0.0.1 bin/howami