Overview

Namespaces

  • None
  • Peg
    • Cli
      • Commands
    • Config
    • Custom
      • Command
        • Action
          • Generate
          • Parse
      • CommandLine
      • Config
      • Localization
      • Utilities
    • Lib
      • Definitions
        • Element
      • Generator
      • Lexers
      • Plugins
      • Signals
        • Data
          • Definitions
          • Lexers
        • Type
  • PHP

Classes

  • Generate
  • Help
  • Init
  • Parse
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: /**
 3:  * @author Jefferson González
 4:  * @license MIT
 5:  * @link http://github.com/peg-org/peg-custom Source code.
 6:  */
 7: 
 8: namespace Peg\Custom\Command;
 9: 
10: use Peg\Custom\CommandLine\Option;
11: use Peg\Custom\CommandLine\OptionType;
12: 
13: /**
14:  * In charge of initializing a directory to produce an extension.
15:  */
16: class Init extends \Peg\Custom\CommandLine\Command
17: {
18: 
19:     public function __construct()
20:     {
21:         parent::__construct("init");
22: 
23:         $this->description = t("Populates a directory with skeleton files in preparation for generating an extension source code.");
24: 
25:         $this->RegisterAction(new Action\Init());
26: 
27:         $author = new Option(array(
28:             "long_name"     => "authors",
29:             "short_name"    => "a",
30:             "type"          => OptionType::STRING,
31:             "required"      => true,
32:             "description"   => t("A comma seperated list of main authors going to be working on the extension.") . "\n" .
33:             t("Example:") . " --authors \"" . t("Author1, Author2") . "\"",
34:             "default_value" => ""
35:         ));
36: 
37:         $this->AddOption($author);
38: 
39:         $contributors = new Option(array(
40:             "long_name"     => "contributors",
41:             "short_name"    => "c",
42:             "type"          => OptionType::STRING,
43:             "required"      => false,
44:             "description"   => t("A comma seperated list of contributors.") . "\n" .
45:             t("Example:") . " --contributors \"" . t("Contributor1, Contributor2") . "\"",
46:             "default_value" => ""
47:         ));
48: 
49:         $this->AddOption($contributors);
50: 
51:         $name = new Option(array(
52:             "long_name"     => "name",
53:             "short_name"    => "n",
54:             "type"          => OptionType::STRING,
55:             "required"      => false,
56:             "description"   => t("A name for the extension that overrides current working directory name."),
57:             "default_value" => ""
58:         ));
59: 
60:         $this->AddOption($name);
61: 
62:         $version = new Option(array(
63:             "long_name"     => "initial-version",
64:             "short_name"    => "i",
65:             "type"          => OptionType::STRING,
66:             "required"      => false,
67:             "description"   => t("Set the extension version. Default: 0.1."),
68:             "default_value" => "0.1"
69:         ));
70: 
71:         $this->AddOption($version);
72:         
73:         $config_type = new Option(array(
74:             "long_name"     => "config-type",
75:             "short_name"    => "t",
76:             "type"          => OptionType::STRING,
77:             "required"      => false,
78:             "description"   => t("Set the configuration file type. Default: json.")
79:                 . "\n" . t("Allowed values:") . " json, ini",
80:             "default_value" => "json"
81:         ));
82: 
83:         $this->AddOption($config_type);
84: 
85:         $force = new Option(array(
86:             "long_name"     => "force",
87:             "short_name"    => "f",
88:             "type"          => OptionType::FLAG,
89:             "required"      => false,
90:             "description"   => t("Forces the initialization of a directory by overriding all it's content. Use with caution."),
91:             "default_value" => ""
92:         ));
93: 
94:         $this->AddOption($force);
95:     }
96: 
97: }
PEG Api API documentation generated by ApiGen 2.8.0