You WILL glamourize your CLI

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I got asked this question recently where someone was wondering what tools they could use in the charm ecosystem to glamorize an existing CLI there's a few different ways that you can do this we have a lot of different libraries that fulfill a lot of different gaps so let me get into it today one of the easiest changes that you can make is using the lip gloss Library lip gloss is a library responsible for layouts and St stying so if you want to have a bunch of different elements showing up side by side or vertically you can do that with lip gloss you can also add different colors both foreground and background colors and a bunch of other styles so if you have any outputs that are happening in your CLI program you can stylize some of those outputs with lip gloss just text styling for terminal applications very similar to what CSS is to HTML another option is using log it's just a wrapper for Go's official logger but it provides you with some nice styling out of the box so you can use that for any errors or debugging or any kind of info that you might need printed it'll make it look all nicely formatted like right out of the box so that one would be a good option if you're looking to improve maybe some of your error messages or readability in general with your command line application if you want to be real extra you can go with a tuy so a tuy stands for text UI and we've got a few different ways you you can do that the smallest lift for this would probably be H or bubbles so H is a library and or Standalone application kind of depends how you want to work with it you can you can see the read me to see examples on how it gets used there H is for generating forms so it gives you access to multi- select single select choices you can also get a single line text input or a multi-line text input all of those components are easily ible with ha and they come pre-styled and all of that stuff so it's really really straightforward to use so you might have a subcommand or a flag that triggers a form to pop up and you could use H for that bubbles as you may or may not know is our library for interactive UI components so these are typically built as like little building blocks think of them like little Legos for bubble tea or the pearls in bubble tea if you want to stick with the the lingo there okay bubble te is a 2E framework meaning that there is an interface that you can Implement and that is then a model and then you're able to dictate when you have this Tui open what every single key press is going to do and what actions get triggered that is pretty much what bubble tea does bubbles help support bubble tea but you can actually use bubbles on their own so things like a list or a table or multi-line text input or a single line text input like even huh is a wrapper over the bubbles components and gum if you use if you've seen that which is like adding interactivity to bash scripts that is another layer over bubbles you can actually use a bubble component on its own and just use whatever built-in functionality that bubble supports if you don't want to add the additional layer of complexity that comes with creating your own custom bubble team model and how you do that is essentially just using your program. run and when you're creating the program you're initializing that with the bubble the bubbles component as the model that you're passing to the program instead of where you would normally put a custom model I'll try and explain this with like visuals or something in case it's not immediately obvious what I'm trying to say those are your three options you can use H if you want something kind of form related with one of your sub commands or Flags to trigger that tuy you could also use a bubbles component so if you just want to show data in a list that they can then scroll through or interact with in some way then you can do that note that if you want to have a table that you they don't necessarily need to interact with we do support that in lip gloss and bubble te is for if you want a chei that has a bit more custom functionality that is beyond the scope of what is covered in a bubble you can still use the bubbles within bubble tea and just you pass pass the messages along to the bubbles but using bubble te will allow you to get a lot more custom functionality in there beyond what is offered in ha and Bubbles if you're including markdown at any point in your clis like maybe printing a markdown file or reading it or anything like that you could use glamour to render the markdown so if you've seen glow that is for reading markdown files in your terminal that one's an actual app so it's got additional functionality with it but glamour is the actual mark down rendering Library that's used with glow so when you're looking and it's like all nicely styled and everything that's actually glamour so what you can do is use glamour to render whatever markdown outputs you might want to have in your application whatever whatever that might look like for you finally there is no good project without a good read me okay docs are important and you can and will produce gifts in your readmes and an easy way to do that is with VHS you can use VHS to programmatically generate gifts I love it because it means I can work smarter not harder okay makes it way easier for me to even create content for stuff like this you might see some different uh demos and whatnot in this video and that I probably produced with VHS one of my favorite ways to use VHS is by using VHS record so the first step is that I'll use VHS record that opens up a new little shell session and from there I can start to emulate the behavior that I want to record record so this might be opening up some kind of terminal application navigating a couple pages and then closing it out once I'm done recording I can just hit contrl D kills the process and then all of my keystrokes will get extracted into a tape file and that tape file is every single action that happened during that recording within that file you can also specify what kind of output name you want the height and width the font size everything so it's really nice is that you don't even really need to record things or re-record things which we all know is the painful part what you can do here is if you had any typos or you decide that you need that demo for vertical not horizontal or whatever we know Tik Tok killed all of the good formats for us developers okay vertical video is the bane of my existence but I can now just adjust my tape file to the vertical resolution and then send that to VHS and it will export that into whatever file format I've decided whether that is an mp4 a mauve a gif and you can embed that in your readmes or whatever videos you might have demonstrating your products we love that I hope this helps to answer your question about ways that you can integrate different charm libraries into an existing CLI application let me know what you think in the comments we'll see you in the next video you can click here for a cool VHS video because the just was given some love or whatever else I decide to put here but you got to click it otherwise you're bannned
Info
Channel: Charm CLI
Views: 22,510
Rating: undefined out of 5
Keywords:
Id: IMd05f0Msyg
Channel Id: undefined
Length: 7min 35sec (455 seconds)
Published: Thu Mar 28 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.