#!/usr/bin/env ruby require 'rubygems' require 'mdqt/cli' require 'mdqt/version' require 'commander' Commander.configure do program :name, 'mdqt' program :version, MDQT::VERSION program :description, 'MDQ SAML metadata client' global_option '--verbose' default_command :help command :version do |c| c.syntax = 'mdqt version' c.description = 'Display version information' c.action do |args, options| say "mdqt version #{MDQT::VERSION}" end end command :get do |c| c.syntax = 'mdqt get [options] entityidentifier ' c.description = 'Download one entity record or an aggregate of entity records' c.option '--service URL', String, 'MDQ service to search for entities. Defaults to MDQT_SERVICE or MDQ_BASE_URL env variables' c.option '--cache', "Cache downloads and try to fetch from cache where appropriate" #c.option '--verify-with PATH', String, 'Validate downloads using specified certificate' #c.option '--stdin', 'accept one or more entity ids from STDIN' c.option '--all', 'Request all entity records' c.action do |args, options| options.default MDQT::CLI::Defaults.cli_defaults options.default({service: MDQT::CLI::Defaults.base_url }) if options.service.nil? MDQT::CLI::Get.run(args, options) end end end