aboutsummaryrefslogtreecommitdiff
path: root/cmd/priorworkgen/main.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2020-11-04 20:02:14 +0000
committerChristine Dodrill <me@christine.website>2020-11-04 20:02:34 +0000
commitfffe0a3eda6fe50ef5d72e9a419b74e2be1f02fe (patch)
tree110ac4f5f7ad0cf3379a893f2d0e11816a5ef3de /cmd/priorworkgen/main.go
parent9a04291328efc8ea3ebd4014d97ca16c7f12865a (diff)
downloadx-fffe0a3eda6fe50ef5d72e9a419b74e2be1f02fe.tar.xz
x-fffe0a3eda6fe50ef5d72e9a419b74e2be1f02fe.zip
update
Diffstat (limited to 'cmd/priorworkgen/main.go')
-rw-r--r--cmd/priorworkgen/main.go37
1 files changed, 20 insertions, 17 deletions
diff --git a/cmd/priorworkgen/main.go b/cmd/priorworkgen/main.go
index f6b5bf9..532aef3 100644
--- a/cmd/priorworkgen/main.go
+++ b/cmd/priorworkgen/main.go
@@ -4,9 +4,7 @@ package main
import (
"context"
"flag"
- "fmt"
"log"
- "os"
"github.com/google/go-github/github"
_ "github.com/joho/godotenv/autoload"
@@ -62,6 +60,11 @@ func main() {
continue
}
+ if repo.Description == nil {
+ desc := ""
+ repo.Description = &desc
+ }
+
name := repo.GetName()
desc := repo.GetDescription()
refn := repo.GetGitURL()
@@ -72,35 +75,35 @@ func main() {
continue
}
- const blurb = `Name: ${NAME}
-Description: ${DESC}
-Reference Number: ${REFN}
-Date of creation: ${CREAT}
-Date of last modification: ${LASTM}
-Other owners: none
+ const blurb = `name: ${name}
+description: ${desc}
+reference number: ${refn}
+date of creation: ${creat}
+date of last modification: ${lastm}
+other owners: none
`
mapping := func(inp string) string {
switch inp {
- case "NAME":
+ case "name":
return name
- case "DESC":
+ case "desc":
if desc == "" {
- panic("no description for " + refn)
+ return "no description available"
}
return desc
- case "REFN":
+ case "refn":
return refn
- case "CREAT":
- return creat.String()
- case "LASTM":
- return lastm.String()
+ case "creat":
+ return creat.string()
+ case "lastm":
+ return lastm.string()
}
return "<unknown input " + inp + ">"
}
- fmt.Println(os.Expand(blurb, mapping))
+ fmt.println(os.expand(blurb, mapping))
}
}