Skip to content

Commit fa49b98

Browse files
committed
Add helpful links and star prompt after install
1 parent 53555f6 commit fa49b98

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ If you have found an issue with the documentation or would like to contribute pl
1313
## License
1414

1515
Coilpack is open-sourced software licensed under the MIT license.
16+
17+
## Helpful Links
18+
19+
- [ExpressionEngine](https://expressionengine.com/)
20+
- [ExpressionEngine Github](https://github.com/expressionengine/expressionengine)
21+
- [ExpressionEngine Slack](https://expressionengine.com/blog/join-us-in-slack)

src/Commands/CoilpackCommand.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public function handle(): int
5555

5656
$this->updateRoutesFile();
5757

58+
$this->askForStar();
59+
5860
return self::SUCCESS;
5961
}
6062

@@ -242,4 +244,31 @@ public function installRelease($release)
242244
}
243245
}
244246
}
247+
248+
protected function askForStar()
249+
{
250+
$url = 'https://github.com/expressionengine/coilpack';
251+
$question = "We're thrilled that you have chosen to use Coilpack! \n Would you like to tell others by starring our repo? (y/n)";
252+
$response = strtolower($this->ask($question, 'n'));
253+
254+
// If we don't get a "y" or "yes" we're done
255+
if (! in_array($response, ['y', 'yes'])) {
256+
return;
257+
}
258+
259+
// Choose the proper command to open the url based on the current operating system
260+
$openUrlCommands = [
261+
'Darwin' => 'open',
262+
'Linux' => 'xdg-open',
263+
'Windows' => 'start',
264+
];
265+
266+
$command = array_key_exists(PHP_OS_FAMILY, $openUrlCommands) ? $openUrlCommands[PHP_OS_FAMILY] : null;
267+
268+
if (! $command) {
269+
$this->info("Oops, this is embarrassing. \n We can't open the url on your operating system but you can still star the repo: $url");
270+
}
271+
272+
exec("$command $url");
273+
}
245274
}

0 commit comments

Comments
 (0)