Terminal Titanium: Prompty

Once you start spending most of your time in the terminal, it is likely you will start customising it.
Choosing your shell, setting your colour scheme and aliases is all part if making your terminal home.
It is mostly about making your development environment productive rather than just making things look pretty.

One area is the prompt. Once you learn that you can customise it, there is a tendency to clutter it… just because.
I prefer to keep those critical details there that I need to know when I’m about to execute commands. (Thinks like battery life,
node version, weather(?), etc can sit in the tmux status bar instead.)

So here is my prompt:

prompt

In short, the time of the last command execution, where am I (pwd), the git branch and if there are uncommitted changes
and finally the titanium sdk version of the project I’m working with.

How To

To get the titanium version install tiversion:

$ [sudo] npm install -g tiversion

If you execute tiversion anywhere in a titanium project tree it will simply return the titanium sdk version used by the project.

With that installed you can add the titanium sdk version to your prompt.
For example, here is my zsh theme that I use with oh-my-zsh.

Bonus

The tiversion modules also support the tiversion set command that lets you set the titanium sdk version from a list
of those installed.

prompt

David Bankier leads YY Digital, a company that builds integrated mobile, tablet and server side applications for enterprise. He has used Titanium for mobile dev since 2010 and uses a mix of Node and Scala on the backend. TCE, Titan, OSS dev and he likes to CodeFast


Comments