command

package
v0.0.0-...-fd23dd1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2019 License: OSL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ConfigArea is the Root config area
	ConfigArea *config.Area

	// DiCmd shows dependency injection information
	DiCmd = &cobra.Command{
		Use:   "di",
		Short: "Dependency Injection Debug output (for all or selected contexts)",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("\nContainer for Routed Contexts:")
			fmt.Println()
			for _, routeConfig := range ConfigArea.GetFlatContexts() {
				if contextName != "" && contextName != routeConfig.Name {
					continue
				}
				bu, _ := routeConfig.Configuration.Get("prefixrouter.baseurl")
				baseurl, _ := bu.(string)
				if baseURL != "" && baseURL != baseurl {
					continue
				}
				fmt.Println()
				fmt.Println("********************************************")
				fmt.Println("Routed Context  - Baseurl:" + baseurl + " Contextpath: [" + routeConfig.Name + "]")
				routeConfig.Injector.Debug()
				fmt.Println()
			}
		},
	}
)
View Source
var (
	// RoutingConfCmd to show routing configuration information
	RoutingConfCmd = &cobra.Command{
		Use:   "routeconf",
		Short: "Print the routing configs from the contexts",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("\nContext with Routing Config:")
			fmt.Println()
			for _, routeConfig := range ConfigArea.GetFlatContexts() {
				bu, _ := routeConfig.Configuration.Get("prefixrouter.baseurl")
				baseurl := bu.(string)
				fmt.Println(baseurl + " [" + routeConfig.Name + "]")
				for _, route := range routeConfig.Routes {
					fmt.Printf("  * %s > %s \n", route.Path, route.Controller)
				}
			}
		},
	}

	// RouterCmd to show router information
	RouterCmd = &cobra.Command{
		Use:   "routes",
		Short: "Print the routes registered",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("\nRoutes:")
			fmt.Println()
			routesHelper := ConfigArea.GetInitializedInjector().GetInstance(routesHelper{}).(*routesHelper)
			routesHelper.printRoutes()
		},
	}

	// DataControllerCmd to shows registered data controller information
	DataControllerCmd = &cobra.Command{
		Use:   "datacontroller",
		Short: "Print the datacontroller handlers registered. Datacontrollers can be called in Templates and also via Ajax",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("Datacontroller:")
			fmt.Println()
			routesHelper := ConfigArea.GetInitializedInjector().GetInstance(routesHelper{}).(*routesHelper)
			routesHelper.printDataHandlers()
		},
	}
)
View Source
var (
	TplfuncsCmd = &cobra.Command{
		Use:   "tplfuncs",
		Short: "Debug Template Functions",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("\nContainer for Routed Contexts:")
			fmt.Println()
			for _, routeConfig := range ConfigArea.GetFlatContexts() {
				if contextName != "" && contextName != routeConfig.Name {
					continue
				}
				bu, _ := routeConfig.Configuration.Get("prefixrouter.baseurl")
				baseurl, ok := bu.(string)
				if !ok {
					continue
				}
				if baseURL != "" && baseURL != baseurl {
					continue
				}
				fmt.Println()
				fmt.Println("********************************************")
				fmt.Println("Routed Context  - Baseurl:" + baseurl + " Contextpath: [" + routeConfig.Name + "]")

				fmt.Println("Functions")

				fmt.Println()
				fmt.Println("Context Functions")

				fmt.Println()
			}
		},
	}
)
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version number of Flamingo",
	Long:  `All software has versions. This is Flamingo's`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("Flamingo Console v%s -- HEAD\n", framework.VERSION)
	},
}

VersionCmd shows the Flamingo version

Functions

func ConfigCmd

func ConfigCmd(area *config.Area) *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL