Posts Tagged ‘terminal’

Slimtimer Command Line API

I don’t know how many of you are working as freelancers or do need any kind of time recording to prove their working hours or only to record how many hours they spend on their master thesis :) . For me slimtimer does very well and I am really happy with this tool. It comes directly with a small browser bookmark bar script, that opens some kind of timer and shows the current worked time on a specific task.

I think, this is fine as long as you spend most of your time in a browser, but as soon as you dig deeper on a terminal or in textmate this behavior is not really suitable – as executing a rake task you want to start and stop recording time, don’t you?

Ok, it took me a day but I created some small little command line interface for slimtimer and it works well – the only thing you need is a slimtimer account and an API key that you get without any questions directly from the slimtimer website.

The next step is installing the slimtimer command line interface on your local workstation with executing:

sudo gem install slimtimercli

As soon as the gem is installed, you need to setup slimtimercli for the first usage using the setup command

slimtimer setup

This will ask for your e-mail as username and your password and API key for authentication. Now you need to fetch your tasks and check on which you are going to start working

slimtimer tasks

Ok, now the hairy moment starts, prepare your engines, clean your keyboard and be ready to work with

slimtimer start my_shiny_task

Hours later, totally exhausted, you might stop working and of course stop the timer, how? Easy as opening a bottle of water

slimtimer end

That’s cool hey? So that’s pretty much it, more documentation can be found using

slimtimer help

Bugs, features, money or anything else can be reported here :)

Sake script for git helper

According to my last post about scripting git I thought about how to automate these nasty command line scripts in a way that I can use them anywhere without too much hassle.

Few days ago, I read the first time about sake scripts(shame on me) and I thought why not try – and not really surprisingly it works.

Since I want to share my genius work with you I published the script using a small pastie and you can install them in no time to your local sake script repository.

# For security reasons look at the script
sake -e http://pastie.caboo.se/173143.txt
# install the script
sake -i http://pastie.caboo.se/173143.txt

Git helper

When you try to document you changes in a typical CHANGELOG file, you don’t want to write all the changes since the last release or last few commit there by hand. This should be done easily by some kind of command that will export all your changes to the CHANGELOG file.

There are two easy ways to do this, that will basically do the same. the only difference between them is that one extracts the commit messages directly with the help of git log, while the other lists all changes of the current branch.

Now let’s have a first at the awful complicated solution to get the commit log for your current branch

git show-branch | awk -F"merb_localize.*]( )*" " {print \$2}" > CHANGELOG

To get this working for your project you have to replace merb_localize with your own branch name.

The second solution is a little more sophisticated and better to handle, it is based on git log instead of git show-branch

git log --pretty="format:%s (committer: %cn | auther: %an)"  ... > CHANGELOG

What happens is that it will go through all commit messages and format the commit message using the defined format with the --pretty. The result will look like:

* my message (commiter: Martin | author: Martin)

There are plenty of format options to modify the output written to the CHANGELOG file. You can find the options in the man page for git log.