public function do_actions()
 {
     $module_directory = HaddockProjectOrganisation_ModuleDirectoriesHelper::get_module_directory_from_cli_choice();
     echo 'Creating an input validator for the ' . $module_directory->get_title() . ' module.' . PHP_EOL;
     $new_input_validator_name = CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the name of the input validator: ', new InputValidation_InputValidatorNameValidator());
     InputValidation_InputValidatorsHelper::create_input_validator($new_input_validator_name, $module_directory);
 }
 public function do_actions()
 {
     $module_directory = HaddockProjectOrganisation_ModuleDirectoriesHelper::get_module_directory_from_cli_choice();
     echo 'Setting the camel case root for the ' . $module_directory->get_title() . ' module.' . PHP_EOL;
     $camel_case_root = CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the upper camel case root: ', new HaddockProjectOrganisation_ModuleDirectoryCamelCaseRootValidator());
     HaddockProjectOrganisation_ModuleDirectoriesCamelCaseRootsHelper::set_camel_case_root($camel_case_root, $module_directory);
 }
 public function do_actions()
 {
     $module_directory = HaddockProjectOrganisation_ModuleDirectoriesHelper::get_module_directory_from_cli_choice();
     echo 'Creating a file class for the ' . $module_directory->get_title() . ' module.' . PHP_EOL;
     $new_file_class_name = CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the name of the file class: ', new FileSystem_FileClassNameValidator());
     FileSystem_FileClassesHelper::create_file_class($new_file_class_name, $module_directory);
 }
 private function get_host()
 {
     if ($this->has_arg('host')) {
         return $this->get_arg('host');
     } else {
         return CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the host name:' . PHP_EOL, new Database_HostNameValidator());
     }
 }
 private function get_default_location()
 {
     if ($this->has_arg('default-location')) {
         return $this->get_arg('default-location');
     } else {
         return CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the default location:' . PHP_EOL, new PublicHTML_DefaultLocationValidator());
     }
 }
 private function get_server_address()
 {
     if ($this->has_arg('server-address')) {
         return $this->get_arg('server-address');
     } else {
         return CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the server-address:' . PHP_EOL, new PublicHTML_ServerAddressValidator());
     }
 }
 public function do_actions()
 {
     /*
      * Get the module directory.
      */
     $module_directory = HaddockProjectOrganisation_ModuleDirectoriesHelper::get_module_directory_from_cli_choice();
     echo 'Creating a CLI script for the ' . $module_directory->get_title() . ' module.' . PHP_EOL;
     $new_script_name = CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the name of the script: ', new CLIScripts_NewScriptNameValidator());
     CLIScripts_CLIScriptsHelper::create_cli_script($new_script_name, $module_directory);
 }
 /**
  * Gets the name of the directory that the user wants to be
  * the target of the script that implements this class.
  *
  * The directory can be set with a command line, if not
  * then the user is asked.
  *
  * @return string The name of the directory.
  */
 protected function get_directory()
 {
     $validator = new FileSystem_ExistingDirectoryRelativeToProjectRootValidator();
     if ($this->has_arg('directory')) {
         $directory = $this->get_arg('directory');
         try {
             $validator->validate($directory);
         } catch (InputValidation_InvalidInputException $e) {
             fwrite(STDERR, $e->getMessage() . PHP_EOL);
             exit;
         }
     } else {
         $directory = CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the name of the directory:' . PHP_EOL, $validator);
     }
     return $directory;
 }
 public static function get_validated_input($question, InputValidation_Validator $validator)
 {
     #while (TRUE) {
     #	try {
     #		echo $question;
     #
     #		$answer = trim(fgets(STDIN));
     #
     #		if ($validator->validate($answer)) {
     #			return $answer;
     #		}
     #	} catch (InputValidation_InvalidInputException $e) {
     #		echo $e->getMessage() . "\n";
     #
     #		continue;
     #	}
     #}
     return CLIScripts_UserInterrogationHelper::get_validated_input($question, $validator);
 }
 public function do_actions()
 {
     $page_class_name = CLIScripts_UserInterrogationHelper::get_validated_input('Please enter the name of page class: ' . PHP_EOL, new SiteTexts_PageClassNameValidator());
     SiteTexts_PagesHelper::set_page_class_name($page_class_name);
 }