Skip to content
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

Migrate xcaddy to Cobra #174

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

armadi1809
Copy link
Contributor

This is still in draft mode (early stage) and not ready to be merged yet. Putting it here to get initial feedback (if possible) as I continue to work through this. I am also still finalizing the details about the proposed architecture.

@mohammed90 mohammed90 self-requested a review February 19, 2024 12:10
@mholt
Copy link
Member

mholt commented Apr 11, 2024

Neat, I think this is looking good so far. I don't know if maybe @mohammed90 wants to give some additional feedback or his thoughts when he has time.

@armadi1809
Copy link
Contributor Author

You reminded me of this lol 😅 I still need to work on some last details. I will post here again once that's done.

@millette millette mentioned this pull request May 15, 2024
@armadi1809 armadi1809 force-pushed the migrate-xcaddy-to-cobra branch 4 times, most recently from 9940cd5 to 383f894 Compare June 25, 2024 04:46
@armadi1809 armadi1809 marked this pull request as ready for review June 25, 2024 16:34
@armadi1809
Copy link
Contributor Author

I think this is in a good spot for an initial review and perhaps some followup discussions.

@mholt
Copy link
Member

mholt commented Jul 15, 2024

Sorry I lost track of this @armadi1809. Does this change the command line interface of xcaddy at all, or is it identical?

@armadi1809
Copy link
Contributor Author

@mholt no worries! It should be identical. It just adds in the help flag that is included with Cobra.

Copy link
Member

@mohammed90 mohammed90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling this! As with the others, I'll most likely do the review in rounds 😅 I like where this is going. Here's the first round of review.

cmd/commands.go Outdated Show resolved Hide resolved
cmd/commands.go Outdated Show resolved Hide resolved
cmd/commands.go Outdated Show resolved Hide resolved
@armadi1809 armadi1809 force-pushed the migrate-xcaddy-to-cobra branch 2 times, most recently from 9ba7f4e to 218b084 Compare July 28, 2024 20:43
@armadi1809
Copy link
Contributor Author

Thanks for this first round of reviews Mohammed. All the issues should now be resolved.

@pcfreak30
Copy link

pcfreak30 commented Aug 3, 2024

@armadi1809 Just wanted to say thanks for this effort. ive actually forked xcaddy for my own project to use the same build process (it is inspired by caddy's architecture) and this PR will also enable me to adopt the cli library.

Copy link
Member

@mohammed90 mohammed90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're getting closer, but there's a use-case that's broken now. It's possible to run xcaddy validate, xcaddy list-modules, or any caddy command -- which xcaddy takes and passes to caddy as-is. This is broken now. This is what I get:

/workspaces/xcaddy/caddy-git-fs (main) $ ../cmd/xcaddy/xcaddy list-modules
Error: unknown command "list-modules" for "xcaddy"
Run 'xcaddy --help' for usage.
unknown command "list-modules" for "xcaddy"

We need to figure it out because it's critical part of the Caddy module development.

cmd/cobra.go Outdated
Comment on lines 15 to 16
Use: "xcaddy",
Long: "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add content for the Short and Long fields

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added short and long fields but still want your opinion on what should go/not go in these.

cmd/commands.go Outdated
Comment on lines 25 to 26
Use: "version",
Long: "Getting xcaddy version",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here -- add Short and Long

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as other comment

@armadi1809 armadi1809 force-pushed the migrate-xcaddy-to-cobra branch 2 times, most recently from 7064f00 to 73454d0 Compare August 4, 2024 23:17
@armadi1809
Copy link
Contributor Author

@mohammed90 The issue with the arguments to be passed to caddy should be resolved. I still want your opinion on the commands descriptions (short and long) though as I am not entirely sure about what exactly should go in these. Thanks.

Copy link
Member

@mohammed90 mohammed90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've amended the help lines, but I'm not very happy with my phrasings either. If @mholt and @francislavoie can take a look, that'd be great. Y'all have a good eye for this.

cmd/cobra.go Outdated Show resolved Hide resolved
cmd/commands.go Outdated Show resolved Hide resolved
cmd/commands.go Outdated Show resolved Hide resolved
cmd/commands.go Outdated Show resolved Hide resolved
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh I think @mohammed90 's suggestions are great, and I would have done about the same.

Thanks for this change, it's looking good!

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can give this a shot. What do you think, @mohammed90 ?

Copy link
Member

@mohammed90 mohammed90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @armadi1809! LGTM. Let's go!

@mohammed90 mohammed90 merged commit 7888727 into caddyserver:master Aug 27, 2024
7 of 8 checks passed
@armadi1809
Copy link
Contributor Author

Thanks for taking care of this @mohammed90 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants