GithubHelp home page GithubHelp logo

gocli's Introduction

gocli

初始化项目

# 初始化 git 仓库
$ git init

# 初始化 cobra 的项目结构
$ cobra-cli init

发布版本与打tag

在进行版本发布时,通常的流程是先完成代码的提交和推送,确保代码已经上传到远程仓库的主分支(例如master分支)。这包括执行以下命令:

$ git add .  
$ git commit -m "update"
$ git push origin master

这些命令将暂存的文件添加到提交中,创建一个新的提交并将其推送到远程仓库的master分支。

然后,可以使用以下命令创建一个新的标签并将其推送到远程仓库:

$ git tag -a v1.0.2 -m "Version 1.0.2"
$ git push origin v1.0.2

这些命令会创建一个名为v1.0.2的标签,并将其关联到最新的提交。然后将标签推送到远程仓库,使其在远程仓库中可见。

总结:先完成代码提交和推送,确保代码上传到主分支,然后再创建和推送标签。这样可以确保标签是基于已提交的代码创建的,并与特定的代码版本关联起来。

编译程序并注入版本信息

$ cd gocli/
$ make build

运行二进制程序

$ ./gocli
A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.

Usage:
  gocli [flags]
  gocli [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  start       Start the project
  version     Print the version number

Flags:
  -h, --help      help for gocli
  -v, --version   Print the version number

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

$ ./gocli version
gocli version information: 
  Version: v1.0.2
  Git Commit: c4a1566
  Build Time: Thu, 22 Jun 2023 16:39:42 +0800
  Go version: go1.20.4
  OS/Arch: darwin/arm64

$ ./gocli -v
gocli v1.0.2

$ ./gocli start
Starting the project...

gocli's People

Contributors

pokeyaro avatar

Watchers

 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.