wait_cli

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2021 License: MulanPSL-2.0 Imports: 7 Imported by: 0

README

wait_cli

介绍

Stdin阻塞进程不退出,等待Stdin输出,cobra解析命令行

使用环境
# 开启go mod
GO111MODULE=on
# 配置代理(中国,本地)
GOPROXY=https://goproxy.cn,direct
# gitee.com 不走代理
GONOPROXY=*.gitee.com
GONOSUMDB=*.gitee.com
GOPRIVATE=*.gitee.com
引入
go get  gitee.com/qdmc/wait_cli
使用
### 入口文件 /main.go ###
import (
	cli "gitee.com/qdmc/wait_cli"
	_ "waitCliTest/cmd"
)

func main()  {
	cli.Start()
}

### 你自己命令   /cmd/testCmd.go  ###
package cmd

import (
	"fmt"
	cli "gitee.com/qdmc/wait_cli"
	"github.com/spf13/cobra"
)

func init()  {
	cli.RegisterCmd(TestCmd)
}

var TestCmd = &cobra.Command{
	Use: "test",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Print("\n就是一个测试命令\n")
	},
}

使用场景
项目初期开发
性能测试

Documentation

Overview

* * Create by goland * Author: 墨城 * Create Time: 2021-09-02 14:35 * Maintainers:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCmd

func RegisterCmd(command *cobra.Command)

func Start

func Start()

Types

This section is empty.

Directories

Path Synopsis
* * Create by goland * Author: 墨城 * Create Time: 2021-09-01 10:21 * Maintainers:
* * Create by goland * Author: 墨城 * Create Time: 2021-09-01 10:21 * Maintainers:
* * Create by goland * Author: 墨城 * Create Time: 2021-08-28 14:50 * Maintainers: 公用函数
* * Create by goland * Author: 墨城 * Create Time: 2021-08-28 14:50 * Maintainers: 公用函数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL