Improve bee command lines

Clean and improve some of the command option descriptions
This commit is contained in:
areski 2014-12-18 17:19:34 +01:00
parent f00aeaed36
commit 6b85a2c475
7 changed files with 49 additions and 56 deletions

View File

@ -24,22 +24,23 @@ import (
var cmdApiapp = &Command{
// CustomFlags: true,
UsageLine: "api [appname]",
Short: "create an api application base on beego framework",
Long: `
create an api application base on beego framework
Short: "create an API beego application",
Long: `
Create an API beego application.
bee api [appname] [-tables=""] [-driver=mysql] [-conn=root:@tcp(127.0.0.1:3306)/test]
-tables: a list of table names separated by ',', default is empty, indicating all tables
-driver: [mysql | postgres | sqlite], the default is mysql
-tables: a list of table names separated by ',' (default is empty, indicating all tables)
-driver: [mysql | postgres | sqlite] (default: mysql)
-conn: the connection string used by the driver, the default is ''
e.g. for mysql: root:@tcp(127.0.0.1:3306)/test
e.g. for postgres: postgres://postgres:postgres@127.0.0.1:5432/postgres
if conn is empty will create a example api application. otherwise generate api application based on an existing database.
In the current path, will create a folder named [appname]
If 'conn' argument is empty, bee api creates an example API application,
when 'conn' argument is provided, bee api generates an API application based
on the existing database.
In the appname folder has the follow struct:
The command 'api' creates a folder named [appname] and inside the folder deploy
the following files/directories structure:
conf
app.conf

10
bale.go
View File

@ -30,13 +30,15 @@ var cmdBale = &Command{
UsageLine: "bale",
Short: "packs non-Go files to Go source files",
Long: `
bale packs non-Go files to Go source files and
Bale command compress all the static files in to a single binary file.
auto-generate unpack function to main package then run it
This is usefull to not have to carry static files including js, css, images
and views when publishing a project.
during the runtime.
auto-generate unpack function to main package then run it during the runtime.
This is mainly used for zealots who are requiring 100% Go code.
This is mainly used for zealots who are requiring 100% Go code.`,
`,
}
func init() {

View File

@ -31,22 +31,22 @@ var cmdMigrate = &Command{
Long: `
bee migrate [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
run all outstanding migrations
-driver: [mysql | postgresql | sqlite], the default is mysql
-driver: [mysql | postgresql | sqlite] (default: mysql)
-conn: the connection string used by the driver, the default is root:@tcp(127.0.0.1:3306)/test
bee migrate rollback [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
rollback the last migration operation
-driver: [mysql | postgresql | sqlite], the default is mysql
-driver: [mysql | postgresql | sqlite] (default: mysql)
-conn: the connection string used by the driver, the default is root:@tcp(127.0.0.1:3306)/test
bee migrate reset [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
rollback all migrations
-driver: [mysql | postgresql | sqlite], the default is mysql
-driver: [mysql | postgresql | sqlite] (default: mysql)
-conn: the connection string used by the driver, the default is root:@tcp(127.0.0.1:3306)/test
bee migrate refresh [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
rollback all migrations and run them all again
-driver: [mysql | postgresql | sqlite], the default is mysql
-driver: [mysql | postgresql | sqlite] (default: mysql)
-conn: the connection string used by the driver, the default is root:@tcp(127.0.0.1:3306)/test
`,
}
@ -56,7 +56,7 @@ var mConn docValue
func init() {
cmdMigrate.Run = runMigration
cmdMigrate.Flag.Var(&mDriver, "driver", "database driver: mysql, postgresql, etc.")
cmdMigrate.Flag.Var(&mDriver, "driver", "database driver: mysql, postgresql, sqlite, etc.")
cmdMigrate.Flag.Var(&mConn, "conn", "connection string used by the driver to connect to a database instance")
}
@ -376,6 +376,6 @@ CREATE TABLE migrations (
rollback_statements longtext COMMENT 'SQL statment for rolling back migration',
status ENUM('update', 'rollback') COMMENT 'update indicates it is a normal migration while rollback means this migration is rolled back',
PRIMARY KEY (id_migration)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
) ENGINE=InnoDB DEFAULT CHARSET=utf8
`
)

15
new.go
View File

@ -23,13 +23,12 @@ import (
var cmdNew = &Command{
UsageLine: "new [appname]",
Short: "create an application base on beego framework",
Short: "Create a Beego application",
Long: `
create an application base on beego framework,
Creates a Beego application for the given app name in the current directory.
which in the current path with folder named [appname].
The [appname] folder has following structure:
The command 'new' creates a folder named [appname] and inside the folder deploy
the following files/directories structure:
|- main.go
|- conf
@ -313,9 +312,9 @@ var indextpl = `<!DOCTYPE html>
</header>
<footer>
<div class="author">
Official website:
<a href="http://{{.Website}}">{{.Website}}</a> /
Contact me:
Official website:
<a href="http://{{.Website}}">{{.Website}}</a> /
Contact me:
<a class="email" href="mailto:{{.Email}}">{{.Email}}</a>
</div>
</footer>

21
pack.go
View File

@ -37,22 +37,23 @@ import (
var cmdPack = &Command{
CustomFlags: true,
UsageLine: "pack",
Short: "compress an beego project",
Short: "Compress a beego project into a single file",
Long: `
compress an beego project
Pack is used to compress a beego project into a single file.
This eases the deployment by extracting the zip file to a server.
-p app path. default is current path
-b build specify platform app. default true
-p app path (default is the current path).
-b build specify platform app (default: true).
-ba additional args of go build
-be=[] additional ENV Variables of go build. eg: GOARCH=arm
-o compressed file output dir. default use current path
-f="" format. [ tar.gz / zip ]. default tar.gz
-exp="" relpath exclude prefix. default: .
-exs="" relpath exclude suffix. default: .go:.DS_Store:.tmp
-f="" format: tar.gz, zip (default: tar.gz)
-exp="" relpath exclude prefix (default: .).
-exs="" relpath exclude suffix (default: .go:.DS_Store:.tmp).
all path use : as separator
-exr=[] file/directory name exclude by Regexp. default: ^.
-fs=false follow symlink. default false
-ss=false skip symlink. default false
-exr=[] file/directory name exclude by Regexp (default: ^).
-fs=false follow symlink (default: false).
-ss=false skip symlink (default: false)
default embed symlink into compressed file
-v=false verbose
`,

18
run.go
View File

@ -24,23 +24,11 @@ import (
var cmdRun = &Command{
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true]",
Short: "run the app which can hot compile",
Short: "run the app and start a Web server for development",
Long: `
start the appname throw exec.Command
Run command will supervise the file system of the beego project using inotify,
it will recompile and restart the app after any modifications.
then start a inotify watch for current dir
when the file has changed bee will auto go build and restart the app
file changed
|
check if it's go file
|
yes no
| |
go build do nothing
|
restart app
`,
}

View File

@ -13,13 +13,15 @@ import (
var cmdVersion = &Command{
UsageLine: "version",
Short: "show the bee & beego version",
Short: "show the Bee, Beego and Go version",
Long: `
show the bee & beego version
show the Bee, Beego and Go version
bee version
bee: 1.1.1
beego: 1.2
bee :1.2.3
beego :1.4.2
Go :go version go1.3.3 linux/amd64
`,
}