boxes is an awesome tool for coders who has ECSLCS syndrome (Even Comment Style Like Crazy S**t). I have a tendency to section codes into groups, then dissect into small pieces, and then unnecessarily break down to lines, whenever I read a code. I’d put up a comment block to mark a section, then a smaller one for sub-sections, then one-liner comment for a line of code.
When you can’t even maintain your own coding style, you do not even dare to think your comment styles all look the same. If one’s code is a mess, his or her comments most likely make the whole file hard to read. I usually can begin with a nice start, but after a few edits or a month, my code would look like being fed into paper shredder twice in different entries of angle.
You can imagine when I saw boxes, it’s like a believer witnessing a wonder. I asked myself why haven’t anyone told me about this tool before. Anyway, I have set up my own configuration for a few languages, such as Python, C, CSS, JavaScript, shell, etc. Also set up new keybindings in Vim with my almost-zero-Vim-scripting skill.
To give you a quick idea, how you use it, see the following output:
$ echo 'heading 1' | boxes -d h1-poun ############# # heading 1 # ############# $ echo 'heading 2' | boxes -d h2-pound # heading 2 ############ $ echo 'normal comment' | boxes -d cmt-pound # normal comment
boxes can not only comment, but also uncomment. Simply supply with -r, the comment text will be reverted back, whatever it adds it removes:
$ $ cat | boxes -d h1-pound -r <<EOF > ########## > # foobar # > ########## > EOF foobar
It ships with a lot of default styles, including some crazy ones, really really crazy styles, even I can call that. Anyway, it’s a program with long history for almost 14 years (1999/03/18). Probably older than your kids or even you?
I honestly hope this would improve the readability of my code, keep my code would look consistent, at least for my comments. My coding style is still a mess like chaos theory. One problem at a time, right? Someday, I would code like in google-styleguide or airbnb. To be perfect straight, I don’t even have any strength to compose of a style guideline which I would like to follow. Deciding 2-space or 4-space is hard enough, luckily, in Python, I don’t have to decide where to put the closing brackets for control flow statements.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.