cliset

package module
v0.0.0-...-8a94db3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 5 Imported by: 2

README

package cliset

go get github.com/Qs-F/cliset

cliset is a helping tool for developing cli in Golang.
Supporting you on Output/Input.

Installation

go get github.com/Qs-F/cliset

Design

cliset.Warn(string)

cliset.IsPiped() (bool)

cliset.Arg() // Return arguments from line or line is empty try to return piped value

cliset.RegSubcommand // Register sub command by flag name

Documentation

Overview

copyright 2016 CreatorQsF, de-liKeR MIT License `cliset` package provides some useful tools for developing cli tool in Golang.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPiped

func IsPiped() bool

func LowRegSubcmd

func LowRegSubcmd(subcmd, flagName string)

func LowSubcmd

func LowSubcmd(subcmd string) (bool, int)

Subcmd returns 2 values, first type is bool and second one is int. First return value will be true when given subcommand name in argument is setted. Second value returns the number of nth element of `os.Args` which is value of builtin package `os` If there is no matched subcommand, second value will be 0. So first you need to check first bool value.

func PipeValue

func PipeValue() (s string, err error)

func RegSubcmd

func RegSubcmd(subcmd, flagName string)

RegSubcmd register your subcommand as alias of builtin flag package's flag. Before run `flag.Parse()`, RegSubcmd must be put. To use, 2 arguments needed. Set subcommand name in first argumanet. Set flag package's flag name last argument.

Types

type InMessage

type InMessage struct {
	Pipe string
	Args []string
}

func GetMsg

func GetMsg() *InMessage

type OutMessage

type OutMessage struct {
	Body []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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