Follow

Wrote a little utility in Nim to search and play YouTube videos directly from the command line.
gitlab.com/njoseph/cli-tube

This is partly due to my dissatisfaction with the ytview script from the Bash-Snippets package.

ytview.sh - 210 LoC
clitube.nim - 44 LoC

Size of release binary: 637 KB (amd64)

Used only the standard library, no dependencies.

I might prefer Nim to Bash/Python for small portable utilities in the near future.

@njoseph_1

> I might prefer Nim to Bash/Python for small portable utilities in the near future.

When I started using #NimLang, I thought I'll do that, and then I actually started doing that! And it's so much better than bash or even Python.

The cligen nimble package makes writing CLI tools a breeze.

@njoseph_1

I had a quick look at your project.. if you use the terminal std lib, you do not then need to create procs for bold, reset and all the colors with their ANSI escape codes.

One way is to use styledEcho from the terminal library: scripter.co/notes/nim/#stylede

@dtluna @njoseph_1 this solution uses the video player to stream it rather than downloading the video first. if you want to download it for later, you already know what to do..

@mngrif @njoseph_1 I pass the link to mpv directly without downloading the video if you don't know

@njoseph_1

I don't know nim at all, I'm going to go check it out now though :)

Sign in to participate in the conversation
Toot.ThoughtWorks

This instance is running on ThoughtWorks infrastructure to allow its employees to create an account and interact with the rest of the Fediverse.

DISCLAIMER: The views or opinions expressed by the users of this instance are solely their own and do not necessarily represent the views or opinions of ThoughtWorks, Inc.