以下ddl
action 'ant', :description => "Runs ant in the application directory" do
input :application,
:prompt => "Application(s)",
:description => "Application's instance name(s)",
:type => :string,
:validation => '^[a-z0-9_,\-]+$',
:maxlength => 500,
:optional => false
可以在代理内部使用来获取命令行参数application
# entry point for the ant target
action 'ant' do
# find eligible applications
applications = request[:application].split(',').select{|a| valid_application?(a) }
可以使用mco <agentname> -a applicationname1,applicationname2
启动命令命令,依此类推。发出mco <agentname> --help
给了我:
$ mco ehyp --help
Manage an <internal> application
Application Options
-a, --application APPLICATION Application to manage
我找不到-a
或--application
和request[:application]
之间的“链接”。它在哪里定义了如何解释这些命令行开关?
答案 0 :(得分:0)
在MCollective::Application
中定义了它:
option :application,
:description => 'Application to manage',
:arguments => ['-a', '--application APPLICATION'],
:required => true
option :destination,
:description => 'Ant target ("destination") to call',
:arguments => ['-d', '--destination TARGET'],
:required => true