forked from gogf/gf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move command tool from repo gf-cli to sub folder
- Loading branch information
Showing
33 changed files
with
3,528 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# GF-CLI | ||
English | [简体中文](README_ZH.MD) | ||
|
||
`gf` is a powerful CLI tool for building [GoFrame](https://goframe.org) application with convenience. | ||
|
||
## 1. Install | ||
|
||
> You might need setting the goproxy to make through building. | ||
1. Latest version | ||
``` | ||
go install github.com/gogf/gf/tool/gf@latest | ||
``` | ||
1. Specified version | ||
``` | ||
go install github.com/gogf/gf/tool/[email protected] | ||
``` | ||
1. Database `sqlite` and `oracle` are not support in `gf gen` command in default as it needs `cgo` and `gcc`, you can manually make some changes to the source codes and do the building. | ||
## 2. Commands | ||
```html | ||
$ gf | ||
USAGE | ||
gf COMMAND [ARGUMENT] [OPTION] | ||
COMMAND | ||
env show current Golang environment variables | ||
get install or update GF to system in default... | ||
gen automatically generate go files for ORM models... | ||
mod extra features for go modules... | ||
run running go codes with hot-compiled-like feature... | ||
init initialize an empty GF project at current working directory... | ||
help show more information about a specified command | ||
pack packing any file/directory to a resource file, or a go file... | ||
build cross-building go project for lots of platforms... | ||
docker create a docker image for current GF project... | ||
swagger swagger feature for current project... | ||
update update current gf binary to latest one (might need root/admin permission) | ||
install install gf binary to system (might need root/admin permission) | ||
version show current binary version info | ||
OPTION | ||
-y all yes for all command without prompt ask | ||
-?,-h show this help or detail for specified command | ||
-v,-i show version information | ||
ADDITIONAL | ||
Use 'gf help COMMAND' or 'gf COMMAND -h' for detail about a command, which has '...' | ||
in the tail of their comments. | ||
``` | ||
|
||
## 3. FAQ | ||
|
||
### 1). Command `gf run` returns `pipe: too many open files` | ||
|
||
Please use `ulimit -n 65535` to enlarge your system configuration for max open files for current terminal shell session, and then `gf run`. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# GF-CLI | ||
[English](README.MD) | 简体中文 | ||
|
||
`gf`是一款强大的[GoFrame](https://goframe.org)开发工具链,使得我们开发基于`GoFrame`框架的项目更加便捷。 | ||
|
||
## 1. 安装 | ||
|
||
1. 最新版本 | ||
``` | ||
go install github.com/gogf/gf/tool/gf@latest | ||
``` | ||
1. 指定版本 | ||
``` | ||
go install github.com/gogf/gf/tool/[email protected] | ||
``` | ||
> 注意:在`gf gen`命令中,由于`sqlite`和`oracle`数据库需要`cgo`和`gcc`支持,因此预编译的二进制中不提供对这两个数据库的支持,您需要手动修改源码,去掉对应源码文件中指定数据库类型的`import`注释后手动编译支持。 | ||
## 2. 命令 | ||
```html | ||
$ gf | ||
USAGE | ||
gf COMMAND [ARGUMENT] [OPTION] | ||
COMMAND | ||
env show current Golang environment variables | ||
get install or update GF to system in default... | ||
gen automatically generate go files for ORM models... | ||
mod extra features for go modules... | ||
run running go codes with hot-compiled-like feature... | ||
init initialize an empty GF project at current working directory... | ||
help show more information about a specified command | ||
pack packing any file/directory to a resource file, or a go file... | ||
build cross-building go project for lots of platforms... | ||
docker create a docker image for current GF project... | ||
swagger swagger feature for current project... | ||
update update current gf binary to latest one (might need root/admin permission) | ||
install install gf binary to system (might need root/admin permission) | ||
version show current binary version info | ||
OPTION | ||
-y all yes for all command without prompt ask | ||
-?,-h show this help or detail for specified command | ||
-v,-i show version information | ||
ADDITIONAL | ||
Use 'gf help COMMAND' or 'gf COMMAND -h' for detail about a command, which has '...' | ||
in the tail of their comments. | ||
``` | ||
|
||
## 3. 文档 | ||
|
||
完善详尽的中文文档请参考`GoFrame`官网板块:[开发工具](https://itician.org/pages/viewpage.action?pageId=1114260) | ||
|
||
## 4. FAQ | ||
|
||
### 1). `gf run` 命令报错 `pipe: too many open files` | ||
|
||
请执行`ulimit -n 65535`命令扩展您当前终端会话支持的最大文件打开数,随后再执行`gf run`。需要注意的是该命令仅对当前终端会话有效。 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package boot | ||
|
||
import ( | ||
"github.com/gogf/gf/os/genv" | ||
_ "github.com/gogf/gf/tool/gf/packed" | ||
|
||
"github.com/gogf/gf/os/gfile" | ||
"github.com/gogf/gf/text/gstr" | ||
) | ||
|
||
func init() { | ||
// Force using configuration file in current working directory. | ||
// In case of source environment. | ||
genv.Set("GF_GCFG_PATH", gfile.Pwd()) | ||
handleZshAlias() | ||
} | ||
|
||
// zsh alias "git fetch" conflicts checks. | ||
func handleZshAlias() { | ||
home, err := gfile.Home() | ||
if err == nil { | ||
zshPath := gfile.Join(home, ".zshrc") | ||
if gfile.Exists(zshPath) { | ||
aliasCommand := `alias gf=gf` | ||
content := gfile.GetContents(zshPath) | ||
if !gstr.Contains(content, aliasCommand) { | ||
_ = gfile.PutContentsAppend(zshPath, "\n"+aliasCommand+"\n") | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.