summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-16 11:41:29 -0600
committerJeff Carr <[email protected]>2024-02-16 11:41:29 -0600
commitbd62a89a670eab24ff5fd7b1ed155b89dde08157 (patch)
tree1c51c281bcdb04f7f383c0549db0a6bb17e9a8cc /unix.go
parent88ca40bcfa11f464828cace14a07a9b59a00d571 (diff)
continue cleaning up original version
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go32
1 files changed, 7 insertions, 25 deletions
diff --git a/unix.go b/unix.go
index b1fcff7..ef2a9ac 100644
--- a/unix.go
+++ b/unix.go
@@ -242,30 +242,6 @@ func Exists(file string) bool {
return true
}
-func VerifyLocalGoRepo(gorepo string) bool {
- // Get current user
- usr, err := user.Current()
- if err != nil {
- log.Error(err, "VerifyLocalGoRepo() are you really POSIX compliant?")
- return false
- }
-
- // Form the path to the home Git directory
- gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git")
- log.Log(INFO, "VerifyLocalGoRepo() checking directory:", gitDir)
- if IsDirectory(gitDir) {
- return true
- }
- goDir := filepath.Join(usr.HomeDir, "go/src/", gorepo)
- gomod := goDir + "/go.mod"
- log.Log(INFO, "VerifyLocalGoRepo() checking for go.mod :", gomod)
- _, err = os.Stat(gomod)
- if os.IsNotExist(err) {
- return false
- }
- return true
-}
-
func readFileToString(filename string) (string, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
@@ -280,7 +256,7 @@ func getGitDateStamp(gitdefault string) (time.Time, string, string) {
const gitLayout = "Mon Jan 2 15:04:05 2006 -0700"
tagTime, err := time.Parse(gitLayout, gitdefault)
if err != nil {
- log.Warn("GOT THIS IN PARSE AAA."+gitdefault+".AAA")
+ log.Warn("GOT THIS IN PARSE AAA." + gitdefault + ".AAA")
log.Warn(err)
return time.Now(), "Feb 1 12:34:56 1978 -0600", ""
}
@@ -321,8 +297,13 @@ func formatDuration(d time.Duration) string {
minutes := int(d.Minutes()) % 60
hours := int(d.Hours()) % 24
days := int(d.Hours()) / 24
+ years := int(d.Hours()) / (24 * 365)
result := ""
+ if years > 0 {
+ result += fmt.Sprintf("%dy ", years)
+ return result
+ }
if days > 0 {
result += fmt.Sprintf("%dd ", days)
return result
@@ -350,6 +331,7 @@ func (rs *RepoStatus) Xterm(cmdline string) {
func (rs *RepoStatus) XtermWait(cmdline string) {
shell.XtermCmdWait(rs.Path(), []string{cmdline})
}
+
/*
func (rs *RepoStatus) XtermNohup(args []string) {
var argsX = []string{"xterm", "-geometry", "120x40"}