class ChefCLI::Command::Base

def check_license_acceptance

def check_license_acceptance
  # TODO - is this the right version?
  LicenseAcceptance::Acceptor.check_and_persist!("chef-workstation", ChefCLI::VERSION.to_s)
end

def initialize

def initialize
  super
end

def needs_help?(params)

def needs_help?(params)
  params.include?("-h") || params.include?("--help")
end

def needs_version?(params)

def needs_version?(params)
  params.include?("-v") || params.include?("--version")
end

def run_with_default_options(enforce_license, params = [ ])


handled here.
In order to control this behavior, make sure the default options are
optparser overwrites -h / --help options with its own.
def run_with_default_options(enforce_license, params = [ ])
  if needs_help?(params)
    msg(opt_parser.to_s)
    0
  elsif needs_version?(params)
    msg("#{ChefCLI::Dist::PRODUCT} version: #{ChefCLI::VERSION}")
    0
  else
    check_license_acceptance if enforce_license
    run(params)
  end
rescue Chef::Exceptions::ConfigurationError => e
  err("ERROR: #{e.message}\n")
  1
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
  err("ERROR: #{e.message}\n")
  msg(opt_parser)
  1
end