This commit is contained in:
alessio 2016-12-19 23:27:53 +01:00
parent 1301e832c7
commit 2aec84cb05
4 changed files with 43 additions and 40 deletions

View File

@ -130,6 +130,7 @@ func main() {
&cli.BoolFlag{Name: "no-server", Usage: "Disables the web panel"}, &cli.BoolFlag{Name: "no-server", Usage: "Disables the web panel"},
&cli.BoolFlag{Name: "no-config", Value: false, Usage: "Uses the config settings"}, &cli.BoolFlag{Name: "no-config", Value: false, Usage: "Uses the config settings"},
&cli.BoolFlag{Name: "open", Usage: "Automatically opens the web panel"}, &cli.BoolFlag{Name: "open", Usage: "Automatically opens the web panel"},
&cli.IntFlag{Name: "port", Usage: "Sets the web panel port"},
&cli.BoolFlag{Name: "test", Value: false, Usage: "Enables the tests"}, &cli.BoolFlag{Name: "test", Value: false, Usage: "Enables the tests"},
}, },
Action: func(p *cli.Context) error { Action: func(p *cli.Context) error {

View File

@ -468,40 +468,41 @@ type bintree struct {
Func func() (*asset, error) Func func() (*asset, error)
Children map[string]*bintree Children map[string]*bintree
} }
var _bintree = &bintree{nil, map[string]*bintree{ var _bintree = &bintree{nil, map[string]*bintree{
"assets": &bintree{nil, map[string]*bintree{ "assets": {nil, map[string]*bintree{
"app": &bintree{nil, map[string]*bintree{ "app": {nil, map[string]*bintree{
"components": &bintree{nil, map[string]*bintree{ "components": {nil, map[string]*bintree{
"index.html": &bintree{assetsAppComponentsIndexHtml, map[string]*bintree{}}, "index.html": {assetsAppComponentsIndexHtml, map[string]*bintree{}},
"project": &bintree{nil, map[string]*bintree{ "project": {nil, map[string]*bintree{
"index.html": &bintree{assetsAppComponentsProjectIndexHtml, map[string]*bintree{}}, "index.html": {assetsAppComponentsProjectIndexHtml, map[string]*bintree{}},
}}, }},
"projects": &bintree{nil, map[string]*bintree{ "projects": {nil, map[string]*bintree{
"index.html": &bintree{assetsAppComponentsProjectsIndexHtml, map[string]*bintree{}}, "index.html": {assetsAppComponentsProjectsIndexHtml, map[string]*bintree{}},
}}, }},
}}, }},
}}, }},
"assets": &bintree{nil, map[string]*bintree{ "assets": {nil, map[string]*bintree{
"css": &bintree{nil, map[string]*bintree{ "css": {nil, map[string]*bintree{
"app.css": &bintree{assetsAssetsCssAppCss, map[string]*bintree{}}, "app.css": {assetsAssetsCssAppCss, map[string]*bintree{}},
}}, }},
"img": &bintree{nil, map[string]*bintree{ "img": {nil, map[string]*bintree{
"svg": &bintree{nil, map[string]*bintree{ "svg": {nil, map[string]*bintree{
"github-logo.svg": &bintree{assetsAssetsImgSvgGithubLogoSvg, map[string]*bintree{}}, "github-logo.svg": {assetsAssetsImgSvgGithubLogoSvg, map[string]*bintree{}},
"ic_cached_black_48px.svg": &bintree{assetsAssetsImgSvgIc_cached_black_48pxSvg, map[string]*bintree{}}, "ic_cached_black_48px.svg": {assetsAssetsImgSvgIc_cached_black_48pxSvg, map[string]*bintree{}},
"ic_delete_sweep_black_48px.svg": &bintree{assetsAssetsImgSvgIc_delete_sweep_black_48pxSvg, map[string]*bintree{}}, "ic_delete_sweep_black_48px.svg": {assetsAssetsImgSvgIc_delete_sweep_black_48pxSvg, map[string]*bintree{}},
"ic_error_black_48px.svg": &bintree{assetsAssetsImgSvgIc_error_black_48pxSvg, map[string]*bintree{}}, "ic_error_black_48px.svg": {assetsAssetsImgSvgIc_error_black_48pxSvg, map[string]*bintree{}},
"ic_file_download_black_48px.svg": &bintree{assetsAssetsImgSvgIc_file_download_black_48pxSvg, map[string]*bintree{}}, "ic_file_download_black_48px.svg": {assetsAssetsImgSvgIc_file_download_black_48pxSvg, map[string]*bintree{}},
"ic_more_vert_black_48px.svg": &bintree{assetsAssetsImgSvgIc_more_vert_black_48pxSvg, map[string]*bintree{}}, "ic_more_vert_black_48px.svg": {assetsAssetsImgSvgIc_more_vert_black_48pxSvg, map[string]*bintree{}},
"ic_swap_vertical_circle_black_48px.svg": &bintree{assetsAssetsImgSvgIc_swap_vertical_circle_black_48pxSvg, map[string]*bintree{}}, "ic_swap_vertical_circle_black_48px.svg": {assetsAssetsImgSvgIc_swap_vertical_circle_black_48pxSvg, map[string]*bintree{}},
}}, }},
}}, }},
"js": &bintree{nil, map[string]*bintree{ "js": {nil, map[string]*bintree{
"all.js": &bintree{assetsAssetsJsAllJs, map[string]*bintree{}}, "all.js": {assetsAssetsJsAllJs, map[string]*bintree{}},
"all.min.js": &bintree{assetsAssetsJsAllMinJs, map[string]*bintree{}}, "all.min.js": {assetsAssetsJsAllMinJs, map[string]*bintree{}},
}}, }},
}}, }},
"index.html": &bintree{assetsIndexHtml, map[string]*bintree{}}, "index.html": {assetsIndexHtml, map[string]*bintree{}},
}}, }},
}} }}
@ -551,4 +552,3 @@ func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1) cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
} }

View File

@ -48,6 +48,9 @@ func render(c echo.Context, path string, mime int) error {
// Start the web server // Start the web server
func (s *Server) Start(p *cli.Context) (err error) { func (s *Server) Start(p *cli.Context) (err error) {
if p.Int("port") != 0 {
s.Settings.Server.Port = p.Int("port")
}
if !p.Bool("no-server") && s.Enabled { if !p.Bool("no-server") && s.Enabled {
e := echo.New() e := echo.New()
e.Use(middleware.Gzip()) e.Use(middleware.Gzip())

View File

@ -3,6 +3,7 @@ package cli
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/fsnotify/fsnotify"
"log" "log"
"math/big" "math/big"
"os" "os"
@ -13,8 +14,6 @@ import (
"sync" "sync"
"syscall" "syscall"
"time" "time"
"github.com/fsnotify/fsnotify"
) )
// Watching method is the main core. It manages the livereload and the watching // Watching method is the main core. It manages the livereload and the watching