예제 #1
0
파일: wui.go 프로젝트: ContiGuy/conti-gui
	"conti-gui/srv"
)

var (
	baseDir = "/tmp"

	// wuiCmd represents the wui command
	wuiCmd = &cobra.Command{
		Use:   "wui",
		Short: "serve the Web UI",
		Long:  `Run a web server which presents the Web UI for conti-gui`,
		RunE: func(cmd *cobra.Command, args []string) error {

			//			baseDir := "/tmp"
			htmlFiles_l := []string{"index.html", "wui/index.html"}
			jts := srv.NewJobTypeServer(baseDir)
			return jts.ServeGin(33333, //-- baseDir,
				htmlFiles_l)

		},
	}
)

func init() {
	RootCmd.AddCommand(wuiCmd)

	// Here you will define your flags and configuration settings.

	// Cobra supports Persistent Flags which will work for this command
	// and all subcommands, e.g.:
	// wuiCmd.PersistentFlags().String("foo", "", "A help for foo")
예제 #2
0
파일: test.go 프로젝트: ContiGuy/conti-gui
		//	Run: func(cmd *cobra.Command, args []string) {
		//		// TODO: Work your own magic here
		//		fmt.Println("test called")
		//	},

		RunE: func(cmd *cobra.Command, args []string) error {

			//			baseDir := "/tmp"
			htmlFiles_l := []string{"index.html", "wui/index.html"}
			baseDir := filepath.Join(testBaseDir, "test")
			os.MkdirAll(baseDir, 0777)
			tmpDir, err := ioutil.TempDir(baseDir, "system-test-")
			if err != nil {
				return err
			}
			jts := srv.NewJobTypeServer(tmpDir)
			return jts.ServeTestGin(htmlFiles_l)

			//		jts := srv.NewJobTypeServer()
			//		return jts.ServeGin(33333, baseDir, htmlFiles_l)
		},
	}
)

func init() {
	RootCmd.AddCommand(testCmd)

	// Here you will define your flags and configuration settings.

	// Cobra supports Persistent Flags which will work for this command
	// and all subcommands, e.g.: