2013-07-24 10 views
19

私はこの用語がどのレベルにあるのかは分かりませんが、PHPフレームワークのLaravelにはcronjobを作成するために使用されているArtisanというコマンドラインツールがあります。 (別名コマンド)コマンドを作成するとき。引数ANDを次のように指定できます。引数とオプションの違いは何ですか?

/** 
* Get the console command arguments. 
* 
* @return array 
*/ 
protected function getArguments() 
{ 
    return array(
     array('example', InputArgument::REQUIRED, 'An example argument.'), 
    ); 
} 

/** 
    * Get the console command options. 
    * 
    * @return array 
    */ 
    protected function getOptions() 
    { 
     return array(
      array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null), 
     ); 
    } 

2つの違いは何ですか?

+0

私はちょうど "議論と意見の違いは何ですか?"のような私自身の古い質問を読んでいます。確かにPhilosofical。 – Himmators

答えて

22

artisan migrate:makeヘルプを見てみましょう:

Usage: 
migrate:make [--bench[="..."]] [--create] [--package[="..."]] [--path[="..."]] [--table[="..."]] name 

Arguments: 
name     The name of the migration 

Options: 
--bench    The workbench the migration belongs to. 
--create    The table needs to be created. 
--package    The package the migration belongs to. 
--path    Where to store the migration. 
--table    The table to migrate. 
--help (-h)   Display this help message. 
--quiet (-q)   Do not output any message. 
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 
--version (-V)  Display this application version. 
--ansi    Force ANSI output. 
--no-ansi    Disable ANSI output. 
--no-interaction (-n) Do not ask any interactive question. 
--env     The environment the command should run under. 

引数を使用すると、通常は、移行名またはコマンドでエラーが発生します提供する必要があり、この場合には、少なくとも一つを提供する必要があるものです。

オプションは、明らかにオプションですが、コマンドの動作を変更するために使用するものです。

関連する問題