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:
30
cmd/mailfull/main.go
Normal file
30
cmd/mailfull/main.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user