Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 21, 2021
1 parent d487f85 commit a8d5c2d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function configure()
->addArgument('name', InputArgument::REQUIRED)
->addOption('dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release')
->addOption('git', null, InputOption::VALUE_NONE, 'Initialize a Git repository')
->addOption('branch', null, InputOption::VALUE_REQUIRED, 'Set your branch name, defaults to "main"')
->addOption('branch', null, InputOption::VALUE_REQUIRED, 'The branch that should be created for a new repository', 'main')
->addOption('github', null, InputOption::VALUE_OPTIONAL, 'Create a new repository on GitHub', false)
->addOption('organization', null, InputOption::VALUE_REQUIRED, 'The GitHub organization to create the new repository for')
->addOption('jet', null, InputOption::VALUE_NONE, 'Installs the Laravel Jetstream scaffolding')
Expand Down Expand Up @@ -211,7 +211,7 @@ protected function createRepository(string $directory, InputInterface $input, Ou
$branch = $input->getOption('branch') ?: 'main';

$commands = [
"git init -q -b $branch .",
"git init -q -b {$branch} .",
'git add .',
'git commit -q -m "Set up a fresh Laravel app"',
];
Expand Down Expand Up @@ -267,14 +267,12 @@ protected function pushToGitHub(string $name, string $directory, InputInterface
chdir($directory);

$name = $input->getOption('organization') ? $input->getOption('organization')."/$name" : $name;

$flags = $input->getOption('github') ?: '--private';

$branch = $input->getOption('branch') ?: 'main';

$commands = [
"gh repo create $name -y $flags",
"git -c credential.helper= -c credential.helper='!gh auth git-credential' push -q -u origin $branch",
"gh repo create {$name} -y {$flags}",
"git -c credential.helper= -c credential.helper='!gh auth git-credential' push -q -u origin {$branch}",
];

$this->runCommands($commands, $input, $output, ['GIT_TERMINAL_PROMPT' => 0]);
Expand Down

0 comments on commit a8d5c2d

Please sign in to comment.