#!/usr/bin/env ruby

$:.unshift(File.expand_path("../lib", __FILE__))

require 'thor'
require 'dotenv'


# Small script to allow executing samples from the command line.
# Each sample is loaded as a subcommand.
#
# Example usage:
#
#     google-api-samples drive upload myfile.txt
#
#
class App < Thor

  # Load all the samples and register them as subcommands
  Dir.glob('./lib/samples/*.rb').each do |file|
    require file
  end

  Samples.constants.each do |const|
    desc const.downcase, "#{const} samples"
    subcommand const.downcase, Samples.const_get(const)
  end

end

Dotenv.load
App.start(ARGV)
