File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,10 @@ public function ask(
179179 bool $ asList = false ,
180180 array $ validation = [],
181181 ): null |string |array {
182+ if ($ this ->isForced && $ default ) {
183+ return $ default ;
184+ }
185+
182186 if ($ options === null || $ options === []) {
183187 $ component = new TextBoxComponent ($ question , $ default );
184188 } elseif ($ multiple ) {
Original file line number Diff line number Diff line change 77use Tempest \Core \Installer ;
88use Tempest \Core \PublishesFiles ;
99use function Tempest \root_path ;
10+ use function Tempest \Support \str ;
1011
1112final class FrameworkInstaller implements Installer
1213{
@@ -58,15 +59,29 @@ private function installMainNamespace(): void
5859 return ;
5960 }
6061
61- $ appPath = root_path ('app/ ' );
62+ $ appPath = root_path ($ this ->ask ('Which path do you wish to use as your main project directory? ' , default: 'app/ ' ));
63+
64+ $ defaultAppNamespace = str ($ appPath )
65+ ->replaceStart (root_path (), '' )
66+ ->trim ('/ ' )
67+ ->explode ('/ ' )
68+ ->map (fn (string $ part ) => ucfirst ($ part ))
69+ ->implode ('\\' )
70+ ->append ('\\' )
71+ ->toString ();
72+
73+ $ appNamespace = str ($ this ->ask ('Which namespace do you wish to use? ' , default: $ defaultAppNamespace ))
74+ ->trim ('\\' )
75+ ->append ('\\' )
76+ ->toString ();
6277
6378 if (! is_dir ($ appPath )) {
64- mkdir ($ appPath );
79+ mkdir ($ appPath, recursive: true );
6580 }
6681
6782 $ this ->composer
6883 ->addNamespace (
69- ' App \\' ,
84+ $ appNamespace ,
7085 $ appPath ,
7186 )
7287 ->save ();
You can’t perform that action at this time.
0 commit comments