@@ -153,6 +153,11 @@ public function createRpmPackage(string $architecture, array $binaryDependencies
153153 throw new RuntimeException (sprintf ('Directory "%s" was not created ' , "{$ packageFolder }/empty/ " ));
154154 }
155155
156+ // Generate autocompletion
157+ $ completionFile = TEMP_DIR . '/frankenphp.bash ' ;
158+ $ ldLibraryPath = 'LD_LIBRARY_PATH= ' . BUILD_LIB_PATH ;
159+ shell ()->exec ($ ldLibraryPath . ' ' . BUILD_BIN_PATH . '/frankenphp completion bash | sed "s/caddy/frankenphp/g" > ' . $ completionFile );
160+
156161 $ fpmArgs = [...$ fpmArgs , ...[
157162 '--depends ' , "$ phpEmbedName " ,
158163 '--before-install ' , "{$ packageFolder }/rhel/preinstall.sh " ,
@@ -165,6 +170,7 @@ public function createRpmPackage(string $architecture, array $binaryDependencies
165170 '--config-files ' , '/etc/frankenphp/Caddyfile ' ,
166171 '--config-files ' , '/etc/frankenphp/Caddyfile.d ' ,
167172 BUILD_BIN_PATH . '/frankenphp=/usr/bin/frankenphp ' ,
173+ $ completionFile . '=/usr/share/bash-completion/completions/frankenphp ' ,
168174 "{$ packageFolder }/rhel/frankenphp.service=/usr/lib/systemd/system/frankenphp.service " ,
169175 "{$ packageFolder }/Caddyfile=/etc/frankenphp/Caddyfile " ,
170176 "{$ packageFolder }/content/=/usr/share/frankenphp " ,
@@ -331,6 +337,9 @@ public function createDebPackage(string $architecture, array $binaryDependencies
331337 }
332338
333339 $ patchPackageFolder = BASE_PATH . '/src/package/frankenphp ' ;
340+ $ completionFile = TEMP_DIR . '/frankenphp ' . $ frankenphpSuffix . '.bash ' ;
341+ $ ldLibraryPath = 'LD_LIBRARY_PATH= ' . BUILD_LIB_PATH ;
342+ shell ()->exec ($ ldLibraryPath . ' ' . BUILD_BIN_PATH . '/frankenphp completion bash | sed "s/caddy/frankenphp/g" > ' . $ completionFile );
334343
335344 $ fpmArgs = [...$ fpmArgs , ...[
336345 '--depends ' , $ phpEmbedName ,
@@ -341,6 +350,7 @@ public function createDebPackage(string $architecture, array $binaryDependencies
341350 '--rpm-user ' , 'frankenphp ' ,
342351 '--rpm-group ' , 'frankenphp ' ,
343352 BUILD_BIN_PATH . '/frankenphp=/usr/bin/frankenphp ' . $ frankenphpSuffix ,
353+ $ completionFile . '=/usr/share/bash-completion/completions/frankenphp ' . $ frankenphpSuffix ,
344354 "{$ packageFolder }/debian/frankenphp.service=/usr/lib/systemd/system/frankenphp {$ frankenphpSuffix }.service " ,
345355 "{$ packageFolder }/Caddyfile=/etc/frankenphp/Caddyfile " ,
346356 "{$ packageFolder }/content/=/usr/share/frankenphp " ,
@@ -494,12 +504,20 @@ public function createApkPackage(string $architecture, array $binaryDependencies
494504
495505 $ alpineFolder = BASE_PATH . '/src/package/frankenphp ' ;
496506
507+ $ completionFile = TEMP_DIR . '/frankenphp ' . $ frankenphpSuffix . '.bash ' ;
508+ $ ldLibraryPath = 'LD_LIBRARY_PATH= ' . BUILD_LIB_PATH ;
509+ shell ()->exec ($ ldLibraryPath . ' ' . BUILD_BIN_PATH . '/frankenphp completion bash | sed "s/caddy/frankenphp/g" > ' . $ completionFile );
510+
497511 // Build contents
498512 $ contents = [
499513 [
500514 'src ' => BUILD_BIN_PATH . '/frankenphp ' ,
501515 'dst ' => '/usr/bin/frankenphp ' . $ frankenphpSuffix ,
502516 ],
517+ [
518+ 'src ' => $ completionFile ,
519+ 'dst ' => '/usr/share/bash-completion/completions/frankenphp ' . $ frankenphpSuffix ,
520+ ],
503521 [
504522 'src ' => "{$ alpineFolder }/alpine/frankenphp.openrc " ,
505523 'dst ' => "/etc/init.d/frankenphp {$ frankenphpSuffix }" ,
0 commit comments