util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2016 License: MIT Imports: 9 Imported by: 0

README

Ayi util

  • util application, ie: static server, like python's simple http server
  • util functions

Applications

static
  • Ayi static will start a static http server in current folder on port 8888
  • Ayi static -port=3000 start server on port 3000

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DummyCommand = cli.Command{
	Name:  "util-dummy",
	Usage: "dummy util command",
	Action: func(c *cli.Context) {
		println("util command is working!")
	},
}

DummyCommand for test if the package is working

View Source
var ServeStaticCommand = cli.Command{
	Name:  "static",
	Usage: "serve static files",
	Flags: []cli.Flag{

		cli.IntFlag{
			Name:  "port",
			Value: 8888,
			Usage: "the port to listen on",
		},
	},
	Action: func(c *cli.Context) {
		viper.SetDefault("base", ".")
		viper.Set("port", c.Int("port"))
		ServeStatic()
	},
}

ServeStaticCommand serve static file in current folder

Functions

func ByteIndex

func ByteIndex(s string, c byte) int

ByteIndex is copied from https://golang.org/src/net/parser.go

func RemoveLine

func RemoveLine(fileName string, lineToRemove int) error

RemoveLine will remove one line from file, line number starts from 1

func ServeStatic

func ServeStatic()

ServeStatic start a static server use folder as public directory on port

Types

This section is empty.

Jump to

Keyboard shortcuts

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