// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( "errors" "fmt" "os" "strings" "go.wit.com/lib/fhelp" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) func workingDirToRepo() *gitpb.Repo { wd, _ := os.Getwd() for repo := range me.forge.Repos.IterAll() { if strings.HasPrefix(repo.FullPath, wd) { return repo } } return nil } func doAdd() (string, error) { var s string var err error wd, _ := os.Getwd() found := gitpb.NewRepos() for repo := range me.forge.Repos.IterAll() { if strings.HasPrefix(repo.FullPath, wd) { found.Append(repo) } } if found.Len() > 0 { footer := me.forge.PrintDefaultTB(found) log.Info(footer) return "This directory is already in a known repository", nil } s = fmt.Sprintf("Scan this directory (%s) for new .git repos?", wd) if !fhelp.QuestionUser(s) { // s, err = doModeMaster() err = errors.New("todo: scan dir") } else { err = errors.New("not acked") } return s, err }