-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Migrate to urfave v3 #34510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrate to urfave v3 #34510
Conversation
ensure flags don't carry state through tests
patch smtp idflag persisting
For future: I don't mind you/someone else fixing/editing stuff but a heads up would be nice - especially on a WIP where half of it is hacks to get tests to pass. Either way thanks for some cleanups on this. |
Sorry, I saw it had no progress for long time, and we had some discussions about the strange "config" behavior in discord, so I just tried to fix the problems. Will ask ahead next time. |
No problem, I appreciate your effort regardless. :) |
docs, err := ctx.App.ToMarkdown() | ||
if ctx.Bool("man") { | ||
docs, err = ctx.App.ToMan() | ||
func runDocs(_ context.Context, cmd *cli.Command) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: Double check if the docs are correct as the generation is weird, but it might not have the same issue as with tea due to custom help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much, and there are new cool tests
@@ -0,0 +1,111 @@ | |||
// Copyright 2023 The Gitea Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright 2023 The Gitea Authors. All rights reserved. | |
// Copyright 2025 The Gitea Authors. All rights reserved. |
} | ||
if err != nil { | ||
log.Fatalf("Failed to generate private key: %v", err) | ||
// log.Fatalf("Failed to generate private key: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not delete this line?
} | ||
|
||
var notBefore time.Time | ||
if startDate := c.String("start-date"); startDate != "" { | ||
notBefore, err = time.Parse("Jan 2 15:04:05 2006", startDate) | ||
if err != nil { | ||
log.Fatalf("Failed to parse creation date: %v", err) | ||
// log.Fatalf("Failed to parse creation date: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as previous one.
@@ -129,7 +141,8 @@ func runCert(c *cli.Context) error { | |||
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) | |||
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) | |||
if err != nil { | |||
log.Fatalf("Failed to generate serial number: %v", err) | |||
// log.Fatalf("Failed to generate serial number: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as previous one.
@@ -162,34 +175,41 @@ func runCert(c *cli.Context) error { | |||
|
|||
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) | |||
if err != nil { | |||
log.Fatalf("Failed to create certificate: %v", err) | |||
// log.Fatalf("Failed to create certificate: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as previous one.
for _, a := range args { | ||
// fmt.Println("checking:", a, "it's set:", c.IsSet(a), "and it's:", c.String(a), "but value:", c.Value(a)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace line?
Usage: "Generate self-signed certificate", | ||
Description: `Generate a self-signed X.509 certificate for a TLS server. | ||
// cmdCert represents the available cert sub-command. | ||
func cmdCert() *cli.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use a function instead of a variable here.
migrate cli to urfave v3
add more cli tests