imjp94 / gd-plug

Minimal plugin manager for Godot
MIT License
209 stars 15 forks source link

Add a help action #29

Closed xphere closed 6 months ago

xphere commented 7 months ago

I'm trying this tool and it's amazing! It's the piece I missed the most in the Godot ecosystem, so thank you! The problem is that I find myself often going to the docs to remember how to use it.

I took the liberty to add a help action which shows a list with the syntax and exits. This also shows when no action or an unknown one is supplied. Descriptions of actions and options are copied & pasted from the README. I hope it's helpful!

A screenshot: image

imjp94 commented 7 months ago

Hey @xphere, glad that it helps! So true, I always have to open the README to check the commands XD

But we might have to simplify this PR to make it cross platform, as print_rich doesn't works properly on Windows 10 Screenshot 2024-02-14 114814 See https://github.com/godotengine/godot/issues/2308 and https://github.com/godotengine/godot/issues/80031

If you wish to edit this PR, I would suggest printing the instruction with logger like logger.info() for consistency.

xphere commented 7 months ago

If you wish to edit this PR, I would suggest printing the instruction with logger like logger.info() for consistency.

Ouch, you're right! Without the colors it is a lot harder to understand, but it's still helpful. It would be nice if there's a way to keep the colors for other systems that are capable of it, maybe we can detect these capabilities and strip bbcodes for those not supporting. In fact I thought godot was doing thiat under the hood. I'll investigate a bit and fix this.

xphere commented 7 months ago

I've been playing with an old computer with Windows 10, but I can't find an easy way to detect ANSI support. I'm removing bbcodes and using logger.info instead of print_rich for better compatibility.

imjp94 commented 7 months ago

Suddenly have an idea to enhance the output with table-like layout(using rows & columns) Screenshot 2024-02-15 132521

And adding help-config command to show configs documentation Screenshot 2024-02-15 132444

Let me know if you are okay with the changes or is there anything to add. Otherwise, I think we are ready to merge this PR =)

xphere commented 7 months ago

Suddenly have an idea to enhance the output with table-like layout(using rows & columns)

I've tried this before adding colors and descriptions wrapped easily (especially with keep-import-resource-file displacing everything to the right) but I can give it a try again now that ANSI colors are dismissed.

And adding help-config command to show configs documentation

That's a neat idea, will look into it too. 👌🏻

imjp94 commented 7 months ago

Oh no, I mean I already implemented those 2 features in the last 2 commits.

If you are fine with the changes I made, we can then merge this PR

xphere commented 7 months ago

Oh, nice, didn't saw your commits! Great, fine by me! :shipit: 💪🏻

Have you seen last news for Godot 4.3? https://twitter.com/HugoLocurcio/status/1757843848154206653 I'm curious if someone fixed print_rich or not 😅

imjp94 commented 6 months ago

Have you seen last news for Godot 4.3? https://twitter.com/HugoLocurcio/status/1757843848154206653 I'm curious if someone fixed print_rich or not 😅

Nope, it doesn't works on Windows 10...

Screenshot 2024-02-16 120030

imjp94 commented 6 months ago

Thank you!

xphere commented 6 months ago

Nice, I'm glad to contribute! 🎉

FYI, I discovered a workaround if you're using git-bash or a similar terminal in Windows: you can pipe the command to cat or any other text command (head or less -R) and it re-colorizes the output.

image