2013-07-24 16 views
19

Nie jestem pewien, na jakim poziomie istnieje ta terminologia, ale w php-framework Laravel znajduje się narzędzie linii poleceń o nazwie Artisan, które jest używane do tworzenia cronjobs. (aka commands) Po utworzeniu polecenia. Możesz określić argumenty i opcje w następujący sposób:Jaka jest różnica między Argumentami a Opcjami?

/** 
* 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), 
     ); 
    } 

Jaka jest różnica między tymi dwoma?

+0

Lol Właśnie przeczytałem moje własne stare pytanie lubię "Jaka jest różnica między argumentami i opiniami." Filozoficznie. – Himmators

Odpowiedz

22

Spójrz pomocą 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. 

Argument jest coś, co zwykle trzeba zapewnić co najmniej jeden, w tym przypadku trzeba podać nazwę migracji lub polecenie zgłosi błąd.

Opcja jest oczywiście opcjonalna, coś, czego używasz do modyfikowania zachowania polecenia.

Powiązane problemy