From e668db7e15e844ae9950ac7aeb980893cc16e6a4 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Thu, 27 Oct 2022 18:52:17 +0000 Subject: [PATCH] properly seed rand. accept comments. fix u.Name --- cmd/contrib/main.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/contrib/main.go b/cmd/contrib/main.go index 018d7d7..7f5050b 100644 --- a/cmd/contrib/main.go +++ b/cmd/contrib/main.go @@ -8,6 +8,7 @@ import ( "os/user" "path" "path/filepath" + "time" "git.tilde.town/tildetown/town/email" tuser "git.tilde.town/tildetown/town/user" @@ -38,6 +39,7 @@ type contrib struct { Category string ShortDesc string LongDesc string + Comments string } func runContrib(opts *contribOpts) error { @@ -69,10 +71,13 @@ func validExec(execPath string) error { } func submit(opts *contribOpts) error { + rand.Seed(time.Now().UTC().UnixNano()) + var cmdName string var category string var shortDesc string var longDesc string + var comments string u, err := user.Current() if err != nil { @@ -128,6 +133,12 @@ func submit(opts *contribOpts) error { return nil } + if err := survey.AskOne(&survey.Multiline{ + Message: "any comments for the admins? this won't be public, it's just to give admins any additional context about this command.", + }, &comments); err != nil { + return nil + } + // TODO be able to set a maintainer other than caller. this might only be if an admin. // TODO would be fun if it was a Select using a user list -- extract that from stats cmd @@ -138,8 +149,9 @@ func submit(opts *contribOpts) error { LongDesc: longDesc, ExecPath: opts.ExecPath, // for later validation against file owner - Maintainer: u.Name, + Maintainer: u.Username, MaintainerUID: u.Uid, + Comments: comments, } bs, err := yaml.Marshal(c)