1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2025-12-22 03:57:03 +00:00

Integrate subpackage

This commit is contained in:
teru
2017-07-25 11:19:25 +09:00
parent 2bb46731d0
commit 552ed95a0f
25 changed files with 48 additions and 49 deletions

30
cmd/mailfull/main.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
}