Improve username detection and other minor fixes
parent
f48cfb4fdf
commit
9a2204cd74
|
@ -43,8 +43,8 @@ class InitCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
'Invalid author string. Must be in the format:'.
|
'Invalid author string. Must be in the format: '.
|
||||||
' John Smith <john@example.com>'
|
'John Smith <john@example.com>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +150,10 @@ EOT
|
||||||
$name = basename($cwd);
|
$name = basename($cwd);
|
||||||
if (isset($git['github.user'])) {
|
if (isset($git['github.user'])) {
|
||||||
$name = $git['github.user'] . '/' . $name;
|
$name = $git['github.user'] . '/' . $name;
|
||||||
|
} elseif (!empty($_SERVER['USERNAME'])) {
|
||||||
|
$name = $_SERVER['USERNAME'] . '/' . $name;
|
||||||
|
} elseif (get_current_user()) {
|
||||||
|
$name = get_current_user() . '/' . $name;
|
||||||
} else {
|
} else {
|
||||||
// package names must be in the format foo/bar
|
// package names must be in the format foo/bar
|
||||||
$name = $name . '/' . $name;
|
$name = $name . '/' . $name;
|
||||||
|
@ -158,7 +162,7 @@ EOT
|
||||||
|
|
||||||
$name = $dialog->askAndValidate(
|
$name = $dialog->askAndValidate(
|
||||||
$output,
|
$output,
|
||||||
$dialog->getQuestion('Package name', $name),
|
$dialog->getQuestion('Package name (<vendor>/<name>)', $name),
|
||||||
function ($value) use ($name) {
|
function ($value) use ($name) {
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return $name;
|
return $name;
|
||||||
|
@ -371,6 +375,6 @@ EOT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($ignoreFile, $contents . $vendor);
|
file_put_contents($ignoreFile, $contents . $vendor. "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue