@@ -21,24 +21,24 @@ type BaseEntities struct {
2121 Models register.ModelRegister
2222}
2323
24- // Start method will start the main Go-Web HTTP Server.
25- func Start (args []string , entities BaseEntities ) {
26- c := kernel .BuildCommandContainer ()
27- myFigure := figure .NewFigure ("Go-Web" , "graffiti" , true )
28- myFigure .Print ()
29-
30- fmt .
Println (
"Go-Web CLI tool - Author: [email protected] " )
24+ // Start will run the HTTP web server
25+ func Start (e BaseEntities ) {
26+ startup (e )
27+ kernel .RunServer ()
28+ }
3129
32- registerBaseEntities (entities )
30+ // StartCommand method runs specific CLI command
31+ func StartCommand (args []string , e BaseEntities ) {
32+ startup (e )
3333
34+ c := kernel .BuildCommandContainer ()
3435 cmd := kernel .Commands .List [args [0 ]]
3536 if cmd == nil {
3637 fmt .Println ("Command not found!" )
3738 os .Exit (1 )
3839 }
3940
4041 rc := reflect .ValueOf (cmd )
41- // Set args if exists
4242 if len (args ) == 2 {
4343 reflect .Indirect (rc ).FieldByName ("Args" ).SetString (args [1 ])
4444 }
@@ -49,9 +49,16 @@ func Start(args []string, entities BaseEntities) {
4949 }
5050}
5151
52- // Register base entities in Go-Web kernel
52+ func startup (e BaseEntities ) {
53+ myFigure := figure .NewFigure ("Go-Web" , "graffiti" , true )
54+ myFigure .Print ()
55+ fmt .
Println (
"Go-Web CLI tool - Author: [email protected] " )
56+ RegisterBaseEntities (e )
57+ }
58+
59+ // RegisterBaseEntities base entities in Go-Web kernel
5360// This method will register: Controllers, Models, CLI commands, Services and middleware
54- func registerBaseEntities (entities BaseEntities ) {
61+ func RegisterBaseEntities (entities BaseEntities ) {
5562 kernel .Controllers = entities .Controllers
5663 kernel .Middleware = entities .Middlewares
5764 kernel .Models = entities .Models
0 commit comments