about summary refs log tree commit diff
path: root/pkg/flake/lock
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-02-04 09:15:54 -0800
committerFranck Cuny <franck@fcuny.net>2024-02-19 08:05:58 -0800
commit874ba7e406a24446be11f528692d1eab56d13767 (patch)
treed3cc9bc458d094ddc78e3c6ef5c37b03b450579e /pkg/flake/lock
parentchore: update flake (diff)
downloadworld-874ba7e406a24446be11f528692d1eab56d13767.tar.gz
display flake information in a more readable format
Diffstat (limited to 'pkg/flake/lock')
-rw-r--r--pkg/flake/lock/main.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/flake/lock/main.go b/pkg/flake/lock/main.go
index 0fa21f4..7edf61f 100644
--- a/pkg/flake/lock/main.go
+++ b/pkg/flake/lock/main.go
@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"fmt"
 	"os"
+	"time"
 )
 
 type FlakeLock struct {
@@ -91,3 +92,18 @@ func New(flakeLockPath string) (*FlakeLock, error) {
 
 	return &flakeLock, nil
 }
+
+func (l repoLocked) LastModifiedRFC3339() string {
+	date := time.Unix(l.LastModified, 0)
+	unitTimeInRFC3339 := date.Format(time.RFC3339)
+	return unitTimeInRFC3339
+}
+
+func (l repoLocked) Repository() string {
+	switch l.Type {
+	case "github":
+		return fmt.Sprintf("https://github.com/%s/%s", l.Owner, l.Repo)
+	default:
+		return fmt.Sprintf("%s/%s", l.Repo, l.Owner)
+	}
+}