Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

GoFrame框架提供了功能强大的gf命令行开发辅助工具,是框架发展的一个重要组成部分,工具地址:

...

...

工具安装请参考仓库页面。工具安装成功后,可以通过gf或者gf -h查看所有支持的命令。复杂的命令可以通过

...

gf COMMAND -h查看更详细的使用帮助信息,例如:gf

...

gen

...

-h

...

工具运行初始化时将会自动打开Go Modules特性并设置反向代理地址为 https://goproxy.cn

当前帮助文档以gf cli v0.7.5版本为例进行简单的介绍,详细的介绍信息请查看命令行帮助信息。本章内容信息可能会有滞后,最新的具体详细介绍请查看工具帮助信息。

...

工具职责

  1. 简化工程开发,提高开发效率
  2. 支持框架工程设计规范准确落地

注意事项

  1. 部分命令需要您先安装好Golang基础的开发环境,环境安装具体请参考 环境安装 章节。
  2. 最新的CLI工具版本会随着最新的框架版本走。

配置支持

工具的所有命令均同时支持命令行及配置文件配置参数,以提高易用性。当给定命令行参数时优先读取命令行参数,如果命令行参数不存在时,自动读取配置文件中对应的参数名称。

配置文件路径优先查找当前目录下的hack目录(hack/config.yaml),其次按照框架默认的配置路径检索配置文件。框架默认的配置文件检索路径请参考章节:配置管理-文件配置

配置文件的格式示例:

Code Block
languageyml
# GoFrame CLI tool configuration.
gfcli:
  gen:
    dao:
    - link:            "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
      tables:          "user"
      removePrefix:    "gf_"
      descriptionTag:  true
      

...

noModelComment: 

...

 

...

true

 

...

 

...

docker:
    

...

build: "-a amd64 -s linux -p temp"
  

...

 

...

 

...

tagPrefixes:
 

...

 

...

 

...

 

...

- 

...

ccr.ccs.tencentyun.com/xxx
    

...

- hkccr.ccs.tencentyun.com/xxx
    - sgccr.ccs.tencentyun.com/xxx

注意以上配置示例仅供参考,具体配置项请参考具体命令帮助。

工具调试

当在工具的使用中遇到问题时,可以尝试打开工具的调试模式获得更详细的工具执行日志信息,打开工具调试模式可以通过debug命令行选项开启,例如:

Code Block
languagexml
gf 

...

build main.go --debug


Tip

由于gf工具也是使用GoFrame框架开发,因此调试信息的开启也是同框架方式一致,更详细的介绍请参考框架介绍文档:调试模式

命令总览

当前帮助文档以gf cli v2.0.0版本为例进行简单的介绍,详细的介绍信息请查看命令行帮助信息。本章内容信息可能会有滞后,最新的具体详细介绍请查看工具帮助信息。

Code Block
languagexml
$ gf
USAGE
   gf COMMAND [OPTION]

COMMAND
   env 

...

       show 

...

current 

...

Golang 

...

environment variables
   run        running go codes with hot-compiled-like feature

...


   gen 

...

       

...

automatically 

...

generate 

...

go 

...

files 

...

for dao/dto/entity/pb/pbentity...
   init 

...

      create 

...

and 

...

initialize 

...

an 

...

empty 

...

GoFrame 

...

project
   

...

pack       packing any file/directory to a resource file, or a go file

...


...

   build      cross-building go project for lots of platforms

...


   

...

docker     

...

build 

...

docker image for current 

...

GoFrame project
   

...

install    install gf binary to system (might need root/admin permission)
   

...

version    show version information of current binary

...



OPTION
   

...

-y, --yes        all yes for all command without prompt ask
   -v, -

...

-

...

version    show 

...

version 

...

information 

...

of 

...

current binary
   -d, -

...

-

...

debug      show 

...

internal detailed debugging information

...

   

...

-h, --help       more information about this command

ADDITIONAL
    Use "gf COMMAND -h" for details about a command.  

相关文档

Children Display
alltrue
excerptTypesimple










Panel
titleContent Menu

Table of Contents