Skip to content

Commit 7b80da0

Browse files
committed
script: updated launch scripts
1 parent 98ee367 commit 7b80da0

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed

sf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#! /bin/sh
2+
php ./src/iTXTech/SimpleFramework/SimpleFramework.php $@

start.cmd renamed to sf.cmd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ if exist SimpleFramework.phar (
1818
if exist bin\mintty.exe (
1919
start "" bin\mintty.exe -o Columns=88 -o Rows=32 -o AllowBlinking=0 -o FontQuality=3 -o Font="Consolas" -o FontHeight=10 -o CursorType=0 -o CursorBlinks=1 -h error -t "SimpleFramework" -w max %PHP_BINARY% %FRAMEWORK_FILE% --enable-ansi %*
2020
) else (
21-
powershell %PHP_BINARY% %FRAMEWORK_FILE% --enable-ansi %*
22-
pause
21+
powershell %PHP_BINARY% %FRAMEWORK_FILE% %*
2322
)

src/iTXTech/SimpleFramework/Framework.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,19 @@ private function processCommandLineOptions(array $argv) : bool{
151151
try{
152152
$cmd = (new Parser())->parse($this->options, $argv);
153153
if($cmd->hasOption("help")){
154-
$t = (new HelpFormatter())->generateHelp("sf", $this->options, true);
154+
$t = (new HelpFormatter())->generateHelp("sf", $this->options);
155155
echo $t;
156156
exit(0);
157157
}
158158

159159
if($cmd->hasOption("version")){
160-
echo Framework::PROG_NAME . " " . Framework::PROG_VERSION .
161-
" [" . Framework::CODENAME . "]" . PHP_EOL .
162-
"Implementing API " . Framework::API_LEVEL . PHP_EOL;
160+
Util::println(Framework::PROG_NAME . " " . Framework::PROG_VERSION .
161+
" \"" . Framework::CODENAME . "\" [PHP " . PHP_VERSION . "]");
162+
Util::println(Framework::PROG_NAME . " API " . Framework::API_LEVEL);
163+
Util::println(str_repeat("-", 30));
164+
foreach(["curl", "Phar", "pthreads", "yaml", "swoole"] as $ext){
165+
Util::println(Util::generateExtensionInfo($ext));
166+
}
163167
exit(0);
164168
}
165169

@@ -185,7 +189,7 @@ private function processCommandLineOptions(array $argv) : bool{
185189
}
186190

187191
}catch(\Throwable $e){
188-
echo $e->getMessage() . PHP_EOL;
192+
Util::println($e->getMessage());
189193
$t = (new HelpFormatter())->generateHelp("sf", $this->options, true);
190194
echo $t;
191195
exit(1);

src/iTXTech/SimpleFramework/Util/Util.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,26 @@ public static function getCliOptBool(string $token) : bool{
209209
}
210210
return false;
211211
}
212+
213+
public static function println(string $str){
214+
echo $str . PHP_EOL;
215+
}
216+
217+
/**
218+
* @param string $ext
219+
*
220+
* @return string
221+
* @throws \ReflectionException
222+
*/
223+
public static function generateExtensionInfo(string $ext) : string{
224+
$info = $ext . " => ";
225+
if(extension_loaded($ext)){
226+
$extension = new \ReflectionExtension($ext);
227+
$info .= $extension->getVersion();
228+
}else{
229+
$info .= "not installed";
230+
}
231+
232+
return $info;
233+
}
212234
}

start.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)