1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2026-01-24 20:15:58 +00:00
This commit is contained in:
teru
2017-07-25 11:22:11 +09:00
parent 552ed95a0f
commit b884655a7c
3 changed files with 162 additions and 162 deletions

30
cmd/mailfull/meta.go Normal file
View File

@@ -0,0 +1,30 @@
package main
import (
"bytes"
"flag"
"github.com/mitchellh/cli"
)
// Meta is for `*Command` struct.
type Meta struct {
UI *cli.BasicUi
CmdName string
SubCmdName string
Version string
}
// noCommitFlag returns true if `pargs` has "-n" flag.
// `pargs` is overwrites with non-flag arguments.
func noCommitFlag(pargs *[]string) (bool, error) {
nFlag := false
flagSet := flag.NewFlagSet("", flag.ContinueOnError)
flagSet.SetOutput(&bytes.Buffer{})
flagSet.BoolVar(&nFlag, "n", nFlag, "")
err := flagSet.Parse(*pargs)
*pargs = flagSet.Args()
return nFlag, err
}