1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2025-12-23 12:37:09 +00:00

Move Meta to cmd package

This commit is contained in:
teru
2017-07-25 11:40:51 +09:00
parent 5a178c350b
commit 2e87209ad2
26 changed files with 90 additions and 60 deletions

View File

@@ -4,11 +4,14 @@ Command mailfull is a CLI application using the mailfull package.
package main
import (
"bytes"
"flag"
"fmt"
"os"
"path/filepath"
"github.com/directorz/mailfull-go"
"github.com/directorz/mailfull-go/cmd"
"github.com/mitchellh/cli"
)
@@ -30,7 +33,7 @@ func main() {
Args: os.Args[1:],
}
meta := Meta{
meta := cmd.Meta{
UI: &cli.BasicUi{
Reader: os.Stdin,
Writer: os.Stdout,
@@ -142,3 +145,17 @@ func main() {
os.Exit(exitCode)
}
// 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
}