def self.included(other)
other.module_eval do
def self.takes_team(opts={})
if opts[:argument]
argument :team_name, "Name of a team", ["-t", "--team-name NAME"], :allow_nil => true, :covered_by => :team_id
else
option ["-t", "--team-name NAME"], "Name of a team", :covered_by => :team_id
end
option ["--team-id ID"], "ID of a team", :covered_by => :team_name
end
def self.takes_domain(opts={})
if opts[:argument]
argument :namespace, "Name of a domain", ["-n", "--namespace NAME"], :allow_nil => true, :default => :from_local_git
else
option ["-n", "--namespace NAME"], "Name of a domain", :default => :from_local_git
end
end
def self.takes_membership_container(opts={})
if opts && opts[:argument]
if opts && opts[:writable]
argument :namespace, "Name of a domain", ["-n", "--namespace NAME"], :allow_nil => true, :default => :from_local_git
else
argument :target, "The name of a domain, or an application name with domain (domain or domain/application)", ["--target NAME_OR_PATH"], :allow_nil => true, :covered_by => [:application_id, :namespace, :app]
end
end
option ["-n", "--namespace NAME"], "Name of a domain"
option ["-a", "--app NAME"], "Name of an application" unless opts && opts[:writable]
option ["-t", "--team-name NAME"], "Name of a team"
option ["--team-id ID"], "ID of a team"
end
def self.takes_application(opts={})
if opts[:argument]
argument :app, "Name of an application", ["-a", "--app NAME"], :allow_nil => true, :default => :from_local_git, :covered_by => :application_id
else
option ["-a", "--app NAME"], "Name of an application", :default => :from_local_git, :covered_by => :application_id
end
option ["-n", "--namespace NAME"], "Name of a domain", :default => :from_local_git
option ["--application-id ID"], "ID of an application", :hide => true, :default => :from_local_git, :covered_by => :app
end
end
end