Live data from Hacker News

Diving into Go by building a CLI application

eryb.space

11–20 of 124 posts

Re: Diving into Go by building a CLI application

#11

I had a similar idea a couple of months ago. Make a CLI in golang that allows me to easily open all my favorite timewaster sites at the start of the work day. But it ended up in the "Started, but never looked at again" pile. Maybe I'll have another look at it on the weekend.

If you're on mac, Alfred makes it super easy to create workflows like this. I've sped up the time to goofing off drastically !

Re: Diving into Go by building a CLI application

#13

I had a similar idea a couple of months ago. Make a CLI in golang that allows me to easily open all my favorite timewaster sites at the start of the work day. But it ended up in the "Started, but never looked at again" pile. Maybe I'll have another look at it on the weekend.

In case you don’t get around to writing that golang code. https://unix.stackexchange.com/questions/17659/opening-multi...

No need for a while loop. Just have a file with each site name in a new line. Then -

cat sites-list | xargs -n1 firefox --new-tab

Re: Diving into Go by building a CLI application

#15

Is it possible to display images in terminal? Terminal is simultaneously powerful and painful tool. I know a guy that refuses to use anything but CLI and suffers a lot. But most basic apps can be written it in like those BIOS menus from a 2005 dell computer.

Sort of. Here's a library that does it. https://github.com/sindresorhus/terminal-image

Re: Diving into Go by building a CLI application

#17
post #10

Since everyone else is throwing out recommendations I personally think https://github.com/spf13/cobra is the best CLI templating system, especially because of how well it pairs with https://github.com/spf13/viper . Large projects like Hugo and Kubernetes have used Cobra to build their CLI tools, and it's fairly light as well even if you need simpler usage. We use it at my workplace simply for wrapping our microservic…

Great stuff! Does anything like Cobra exist for Java?

Re: Diving into Go by building a CLI application

#18
post #10

Since everyone else is throwing out recommendations I personally think https://github.com/spf13/cobra is the best CLI templating system, especially because of how well it pairs with https://github.com/spf13/viper . Large projects like Hugo and Kubernetes have used Cobra to build their CLI tools, and it's fairly light as well even if you need simpler usage. We use it at my workplace simply for wrapping our microservic…

Great stuff! Does anything like Cobra exist for Java?

Absolutely! I've used picocli[1] and airline[2]. There is always the Apache Commons CLI if you feel like building it all yourself.

1: https://picocli.info/

2: https://github.com/airlift/airline

Bonus: picocli lets you create native images using Graal, so you can really build native cli executable using Java.

Post reply on HN