func parseArgsRemoteAndID(args []string) (string, int64, error) {
	if !git.InsideGitRepo() {
		return "", 0, nil
	}
	remote, num, err := parseArgsStringAndID(args)
	if err != nil {
		return "", 0, err
	}
	ok, err := git.IsRemote(remote)
	if err != nil {
		return "", 0, err
	} else if !ok && remote != "" {
		switch len(args) {
		case 1:
			return "", 0, errors.Errorf("%s is not a valid remote or number", args[0])
		default:
			return "", 0, errors.Errorf("%s is not a valid remote", args[0])
		}
	}
	if remote == "" {
		remote = defaultRemote
	}
	rn, err := git.PathWithNamespace(remote)
	if err != nil {
		return "", 0, err
	}
	return rn, num, nil
}
parseArgsRemoteAndID is used by commands to parse command line arguments.
This function returns a remote name and number.
package cmd
import (
	"fmt"
	"os"
	"os/exec"
	"strconv"
	"strings"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
	flag "github.com/spf13/pflag"
	"github.com/spf13/viper"
	gitconfig "github.com/tcnksm/go-gitconfig"
	gitlab "github.com/xanzy/go-gitlab"
	"github.com/zaquestion/lab/internal/config"
	"github.com/zaquestion/lab/internal/git"
	lab "github.com/zaquestion/lab/internal/gitlab"
	"golang.org/x/crypto/ssh/terminal"
)
var (
	commandPrefix string
	useHTTP bool
)
func flagConfig(fs *flag.FlagSet) {
	fs.VisitAll(func(f *flag.Flag) {
		var (
			configValue  interface{}
			configString string
		)
		switch f.Value.Type() {
		case "bool":
			configValue = getMainConfig().GetBool(commandPrefix + f.Name)
			configString = strconv.FormatBool(configValue.(bool))
		case "string":
			configValue = getMainConfig().GetString(commandPrefix + f.Name)
			configString = configValue.(string)
		case "stringSlice":
			configValue = getMainConfig().GetStringSlice(commandPrefix + f.Name)
			configString = strings.Join(configValue.([]string), " ")
		case "int":
			log.Fatal("ERROR: found int flag, use string instead: ", f.Value.Type(), f)
		case "stringArray":
			configString = ""
		default:
			log.Fatal("ERROR: found unidentified flag: ", f.Value.Type(), f)
		}
		if f.Changed {
			return
		}
		if configString != "" && configString != f.DefValue {
			f.Value.Set(configString)
		}
	})
}
func getCurrentBranchMR(rn string) int {
	currentBranch, err := git.CurrentBranch()
	if err != nil {
		return 0
	}
	return getBranchMR(rn, currentBranch)
}
func getBranchMR(rn, branch string) int {
	var num int = 0
	mrBranch, err := git.UpstreamBranch(branch)
	if err != nil {
		mrBranch = branch
	}
	mrs, err := lab.MRList(rn, gitlab.ListProjectMergeRequestsOptions{
		ListOptions: gitlab.ListOptions{
			PerPage: 10,
		},
		Labels:       mrLabels,
		State:        &mrState,
		OrderBy:      gitlab.String("updated_at"),
		SourceBranch: gitlab.String(mrBranch),
	}, -1)
	if err != nil {
		log.Fatal(err)
	}
	if len(mrs) > 0 {
		num = mrs[0].IID
	}
	return num
}
func getMainConfig() *viper.Viper {
	return config.MainConfig
}