1
0
Fork 0
mirror of https://github.com/spf13/cobra synced 2025-04-11 17:27:17 +00:00
This commit is contained in:
Bernhard M. Wiedemann 2025-03-11 10:35:20 -07:00 committed by GitHub
commit b90fbf741f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,7 @@ import (
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"time"
@ -123,7 +124,14 @@ func GenReSTCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string, str
buf.WriteString("\n")
}
if !cmd.DisableAutoGenTag {
buf.WriteString("*Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "*\n")
now := time.Now()
if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" {
unixEpoch, err := strconv.ParseInt(epoch, 10, 64)
if err == nil {
now = time.Unix(unixEpoch, 0)
}
}
buf.WriteString("*Auto generated by spf13/cobra on " + now.Format("2-Jan-2006") + "*\n")
}
_, err := buf.WriteTo(w)
return err