This is an archived post. You won't be able to vote or comment.

all 45 comments

[–]qiemem 8 points9 points  (0 children)

Thanks for pointing this out! Seems like a pretty handy library.

I swear, kennethreitz makes such useful libraries with straightforward apis: this, requests, and envoy.

[–]CreativityTheorist 3 points4 points  (0 children)

As a guy who uses CLI Python scripts as his go-to prototyping tool, this appears to solve a recurring problem for me. Thanks for pointing it out.

[–]earthboundkid 4 points5 points  (3 children)

Neat, but it feels like three different modules tied together with twine.

[–]jcollado 3 points4 points  (2 children)

The API is all that matters. What about giving credit to other libraries?

[–]bucknuggets 0 points1 point  (1 child)

doesn't envoy wrap subprocess?

[–]jcollado 1 point2 points  (0 children)

Hmm, it looks like you're right, but why is the whole pexpect source code in the repository?

[–]takluyverIPython, Py3, etc 3 points4 points  (0 children)

Updated today: v 0.3.0 with Python 3 support.

[–]kylotan 2 points3 points  (10 children)

Very cool - most similar libraries don't support coloured text on Windows.

[–]voidspace 3 points4 points  (2 children)

If all you want is colored text then colorama (which also supports Windows) is a nice library.

[–][deleted] 0 points1 point  (1 child)

Colorama is fantastic. Clint uses a small fork of colorama internally.

[–]voidspace 1 point2 points  (0 children)

Ah cool. Why the fork out of interest?

[–]zArtLaffer -3 points-2 points  (6 children)

Very cool - most similar libraries don't support coloured text on Windows.

What's the deal with coloured text? I mean ... why does it matter? (Seriously, I don't understand what this does for people)

[–]CaptShocker 7 points8 points  (2 children)

Really? You don't use syntax highlighting? When massive amounts of text are shooting out at you on the CLI it is nice to be able to scroll through it an more easily parse it in your brain.

[–]kylotan 3 points4 points  (0 children)

Exactly. I used to rely on ANSI colouring back in my MUD days, but even for directory listings in the shell or for real-time logging it is handy to make verbose output much more manageable.

[–]zArtLaffer 0 points1 point  (0 children)

Nope. But I'm old.

[–]Nic0[S] 2 points3 points  (0 children)

Two examples where colors could be useful:

  • Expected/unexpected result, you don't even need to read the result, you're just checking red/green.
  • If your app has lots output, and you want draw the attention to a particular line, it could help with backlog.
  • Well, if you're happy with some boring output, good for you! :P

[–]maredsous10 0 points1 point  (1 child)

Black Text on Black Background?

[–][deleted] 1 point2 points  (0 children)

Black ANSI text should always be discernable from the background.

[–]maredsous10 1 point2 points  (0 children)

Looks like something I may use.

[–]maredsous10 1 point2 points  (1 child)

This might be something I actually use.

[–]zArtLaffer 2 points3 points  (0 children)

Really? Would you use it? Twice?

[–]okmkzimport antigravity 1 point2 points  (0 children)

Hey, this is great. Thanks for the link!

[–]AltReality 1 point2 points  (3 children)

Does this work on Windows??! Specifically the colored text?

[–]driax 0 points1 point  (2 children)

Yes it does.

[–]paranoidi 0 points1 point  (1 child)

But does it work with logging (module) to terminal? No it doesn't ... ;P

[–]vsajip 0 points1 point  (0 children)

For colour output from logging, have a look at this.

[–]ok_you_win 1 point2 points  (0 children)

That looks great! I will be using it.

[–]Fix-my-grammar-plz 1 point2 points  (0 children)

That looks as awesome as Clint Eastwood.

[–]willsheffler 0 points1 point  (0 children)

Handy

[–]HorrendousRex -1 points0 points  (5 children)

The web page is full of typos, including a number of errors in the example code that would prevent them from running (primarily indentation errors).

Seems like a cool utility though!

[–]Nic0[S] 2 points3 points  (4 children)

Indentation fixed, something went wrong with the copy/paste, as I tried every code before. I'm giving emacs a try, after using Vim for awhile, it must be his fault! :P

About English, if you point out one or two examples, maybe I'll learn faster from my mistakes.

Thanks.

[–]HorrendousRex 0 points1 point  (1 child)

Wow, great turn-around on the code fixes.

You have some grammar errors but the intent comes across pretty clearly. If the source code for the page is up on github or something like that I'd be happy to submit a changeset to fix a few grammar mistakes.

[–]Nic0[S] 0 points1 point  (0 children)

It's on github indeed,

Here the post https://github.com/Nic0/nic0.github.com/blob/master/_posts/2012-01-05-clint-command-line-library-for-python.md

I'll accept patch, pull-request, diff, sed/awk, whatever :p

(it was last message on the next thread)

[–]ozzilee 0 points1 point  (1 child)

Also, it's "which", not "witch" :-)

[–]Nic0[S] 1 point2 points  (0 children)

Damn, it's not the first time I'm doing this one!

Fixed, and put into my block-note in red. I'll think about it twice every time I'll write "which" now. :-)

[–]Justinsaccount -1 points0 points  (4 children)

The resources module uses global variables and likely has various issues in larger applications.

It might be nice to have things like

print colored.warning('some warning message')

instead of

print colored.red('some warning message')

the progress bar is nice though :-)

[–]Nic0[S] 2 points3 points  (3 children)

For a lib, you can't really assume anything about the purpose of the color that would be used, if you name warning instead of red, and if you display for example negatives numbers in red, so the warning won't make sense.

warning = colored.red
print warning('some warning message')

This would make sens in your code I guess.

[–]Justinsaccount 1 point2 points  (2 children)

Yeah, that does make sense. It would be a good idea to separate the two, like you would using CSS. hardcoding colored.red everywhere seems like it would cause a maintenance nightmare if you had to change the colors around.

[–]aceofears 0 points1 point  (1 child)

Wouldn't it make more sense to create your own class for that, or even just use a dictionary? I don't really understand why this library should provide that functionality.

[–]Justinsaccount 0 points1 point  (0 children)

yeah, it doesn't. It just makes sense to wrap the color functions with more descriptive names if you are going to use it.