function _drush_no_autocomplete_validate_argument in No Autocomplete 7
Same name and namespace in other branches
- 8 no_autocomplete.drush.inc \_drush_no_autocomplete_validate_argument()
Validate the argument.
Parameters
array $option: The option to set ('on' or 'off').
Return value
bool A boolean indicating the success of the validation.
1 call to _drush_no_autocomplete_validate_argument()
- drush_no_autocomplete_na_login_validate in ./
no_autocomplete.drush.inc - Implements drush_hook_COMMAND_validate().
File
- ./
no_autocomplete.drush.inc, line 66 - Drush commands related to the No Autocomplete module.
Code
function _drush_no_autocomplete_validate_argument(array $option) {
// Check for only one argument.
if (count($option) > 1) {
return drush_set_error('NO_AUTOCOMPLETE_INVALID_ARGUMENT', dt('This command use only one argument.'));
}
// Available options.
$available_options = array(
'on',
'off',
);
// Check for correct argument.
if (isset($option[0]) && !in_array($option[0], $available_options)) {
return drush_set_error('NO_AUTOCOMPLETE_INVALID_ARGUMENT', dt("You must specify as argument 'on' or 'off'"));
}
return TRUE;
}