NitoriConsole

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

README

NitoriConsole

Golang控制台库

通过数行代码即可快速的创建一个带有控制台的程序

🎬 如何使用

安装
go get -u github.com/nyancatda/NitoriConsole
例子
package main

import (
	"fmt"

	"github.com/nyancatda/NitoriConsole"
	"github.com/nyancatda/NitoriConsole/Command"
)

func main() {
	// 注册命令
	Command.Add("say", "Say String", func(CommandStr string) {
		// 解析命令参数
		_, CommandBody := Command.Parse(CommandStr)

		// 打印参数
		fmt.Println(CommandBody[0])
	})

	// 启动控制台
	NitoriConsole.Start("$ ", false, func(err error) {
		fmt.Println(err)
	})
}

效果
go run .

$ help
---------------- Help ----------------
say Say String
--------------------------------------
$ say suki
suki

📖 许可证

项目采用Mozilla Public License Version 2.0协议开源

二次修改源代码需要开源修改后的代码,对源代码修改之处需要提供说明文档

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-07-19 15:49:39 * @LastEditTime: 2022-07-19 17:37:27 * @LastEditors: NyanCatda * @Description: 控制台模块 * @FilePath: \NitoriConsole\Console.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(Prompt string, Newline bool, Error func(error))

*

  • @description: 启动控制台
  • @param {string} Prompt 提示符号,例如$
  • @param {bool} Newline 是否在打印提示符号前换行
  • @param {func(error)} Error 错误回调函数
  • @return {*}

Types

This section is empty.

Directories

Path Synopsis
* @Author: NyanCatda * @Date: 2022-07-19 16:05:50 * @LastEditTime: 2022-07-19 17:03:36 * @LastEditors: NyanCatda * @Description: 添加命令模块 * @FilePath: \NitoriConsole\Command\Add.go
* @Author: NyanCatda * @Date: 2022-07-19 16:05:50 * @LastEditTime: 2022-07-19 17:03:36 * @LastEditors: NyanCatda * @Description: 添加命令模块 * @FilePath: \NitoriConsole\Command\Add.go
* @Author: NyanCatda * @Date: 2022-07-19 17:06:36 * @LastEditTime: 2022-07-19 17:34:40 * @LastEditors: NyanCatda * @Description: 打印Help信息 * @FilePath: \NitoriConsole\Help\Print.go
* @Author: NyanCatda * @Date: 2022-07-19 17:06:36 * @LastEditTime: 2022-07-19 17:34:40 * @LastEditors: NyanCatda * @Description: 打印Help信息 * @FilePath: \NitoriConsole\Help\Print.go

Jump to

Keyboard shortcuts

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