Coder Social home page Coder Social logo

ginny-cli's Introduction

ginny-cli

Ginny command line tool.

Install

系统需要安装 Go,在 $GOPATH 目录下执行以下命令安装。成功后一个名为 ginny 的二进制可执行文件会被安装至 $GOPATH/bin/ 文件夹中。

注意: 该命令行工具支持MacOs、Linux系统,windows系统请使用gitBash或者Cygwin

方法一:

go install github.com/goriller/ginny-cli/ginny@latest

方法二:编译安装

git clone github.com/goriller/ginny-cli.git

# mac:
cd ginny-cli/ginny && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ginny
cp -f ginny $GOPATH/bin/

# linux
cd ginny-cli/ginny && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ginny
cp -f ginny $GOPATH/bin/


# windows
cd ginny-cli/ginny && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ginny
cp -f ginny $GOPATH/bin/

Dependencies

  • protoc:

    Mac OS:

    brew install protoc

    如果没有安装homebrew,也可以使用下面下载二进制包的方法

    Windwos及其他系统:

    进入protobuf release 页面,选择适合自己操作系统的压缩包文件下载 解压缩后将bin/protoc二进制文件移动到环境变量的任意path下,如$GOPATH/bin,这里不建议直接将其和系统的一下path放在一起。

  • protoc-gen-go:

    // mac
    cd $GOPATH && go install github.com/golang/protobuf/protoc-gen-go@latest
  • go wire:

    cd $GOPATH && go get github.com/google/wire/cmd/wire
  • protoc-gen-validate:

    cd $GOPATH && go install github.com/envoyproxy/protoc-gen-validate@latest
  • goimports:

    cd $GOPATH && go get golang.org/x/tools/cmd/goimports
  • mockgen:

    参考 https://github.com/golang/mock 进行安装

    cd $GOPATH && go install github.com/golang/mock/[email protected]
  • make

    Mac OS以及Linux系统一般都具备make命令,解决windows执行make命令的问题: How to run "make" command in gitbash in windows?

Usage

Command line tool for Ginny project bestpractice

Usage:
  ginny [flags]
  ginny [command]

Available Commands:
  completion  generate the autocompletion script for the specified shell
  help        Help about any command
  new         Create a new Ginny project
  component   Create component file
  service     Create service file by proto file

Flags:
  -h, --help   help for ginny

Use "ginny [command] --help" for more information about a command.

创建项目

根据 ginny-template 模板创建新项目

Create a new Ginny project from template

Usage:
  ginny new [flags]

Flags:
      --grpc            Create a grpc service project
  -h, --help            help for new
  -m, --module string   Define the project module, ex: github.com/demo

可根据参数创建http 或者 grpc服务的项目,默认创建http 项目

$ ginny new hellodemo

还可以定制项目 module地址:

$ ginny new hellodemo -m github.com/xxx/hellodemo

proto服务层service

$ ginny service 

创建的service文件在项目 internal/service目录。proto协议增加接口后,可以重复执行此命令生成方法实现模板。

创建其他扩展

例如 repo、logic等:

$ ginny component user -t repo

创建的user_repo文件在项目 internal/repo目录

ginny-cli's People

Contributors

richenlin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.