Joined September 2011
·
Posted to
Show directory and git branch in iTerm tabs
over 1 year
ago
If you want to show the currently running command when you're not at the prompt, you can set the iterm title in a DEBUG trap.
All in all, my solution is:
function iterm_title { echo -ne "\033]0;$@\007"; }
trap 'iterm_title $BASH_COMMAND' DEBUG
export PROMPT_COMMAND='iterm_title ${PWD##*/}$(__git_ps1 :%s)'
Achievements
187 Karma
8,387 Total ProTip Views

Forked
Have a project valued enough to be forked by someone else

Walrus
The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos

Raven
Have at least one original repo where some form of shell script is the dominant language

Ashcat
Make Ruby on Rails better for everyone by getting a commit accepted

Mongoose 3
Have at least three original repos where Ruby is the dominant language

Charity
Fork and commit to someone's open source project in need

Mongoose
Have at least one original repo where Ruby is the dominant language
It's useful to know that you can customize a Struct with a block as well. This code has the same effect as your example where you inherit from Struct, and it doesn't create an extra, unnamed class to inherit from.
Just thought I'd point it out for completeness…