Skip to content

leonmavr/zeitkatze

 
 

Repository files navigation

zeitkatze

C/C++ CI AUR version License: MIT

Zeitkatze is time cat -- literally

=(^.^)= =(ˇ.ˇ)= =(o.o)m =(*.*)= =(^.^)= =(ˇ.ˇ)= =(o.o)m =(*.*)= =(^.^)= =(ˇ.ˇ)= =(o.o)m =(*.*)=

Table of contents

  1. About
  2. Installataion
    1. For Arch-based distros
    2. Manual installation
  3. Development
  4. Usage
  5. Future ideas
  6. Issues
  7. Bugs

1. About

What's the simplest stopwatch in a linux console? Well, just type time cat to start, and push ctrl-c to stop. Zeitkatze is the same thing, with just a little extra.

It continuously updates the total elapsed time display, you can hit ctrl-c once to display a split time, and if you quit (hitting ctrl-d, or ctrl-c twice in succession, or q), zeitkatze prints the total time and exits. You can measure a new split time (or "lap time") by pressing ctrl-c once or by hitting Enter.

2. Installation

2.1 For Arch-based distros

If you run an Arch-based distro (Arch, Manjaro, Artix, etc.), you can install it from the AUR, e.g. via the yay package wrapper:

yay -S zeitkatze

2.2 Manual installation

2.2.1 Installation

You can download the repo as a zip file and install it by pasting the following commands in your terminal:

cd `mktemp -d`
wget https://github.com/leonmavr/zeitkatze/archive/refs/heads/master.zip
unzip master.zip
cd zeitkatze-master
sudo make install

It will be written in /usr/bin/zeitkatze.

2.2.2 Uninstallation

To uninstall it manually you can execute the following from any terminal:

sudo rm `which zeitkatze` && rm -rf ~/.config/zeitkatze

Or from the root level of the repository:

sudo make uninstall

3. Development

To execute any of the following steps, it's assumed that you're in the root directory (same directory as the Makefile).

To compile:

make

To clean:

make clean

You can use it by simply running the executable. It accepts certain command line options described in section 4 -- Usage.

./zeitkatze

Don't forget that the naming coding coding conventions follow the C++ Google standard (example) and the spacing and indentation convention the clang format. You can execute the script scripts/clang_format.sh to format all source files.

4. Usage

Short specifier Long specifier Argument type Default Description
-n --no-color None Off Disables colors when formatting the times on the terminal
-p --precision integer 2 How many decimal places to show when measuring time
-o --one-line None Off Whether or not to print the output in one line - in this case only prints lap times
-r --reset-emotes None Off If true, re-writes (and overwrites) the default cat emotes at file ~/.config/zeitkatze/cats.txt
-h --help None Off Print usage instructions and exit

Other features/tips:

  • It also supports configuration via the environment variable ZEITKATZE_COLOR. Note that the option -n or --no-color overrides this variable. If ZEITKATZE_COLOR is set to 0 (e.g. by adding ZEITKATZE_COLOR=0 in your rc), then colors are disabled.
  • You can define custom cat emotes at ~/.config/zeitkatze/cats.txt. This file is created by default and can be overwritten. For a nicer output, make sure that all cats take the same number of characters (you can pad with spaces if necessary).
  • If you mess up your config file that contains the cat emotes (~/.config/zeitkatze/cats.txt), you can reset it by calling the method ResetEmotes() on your Zeitkatze instance.

5. Future ideas

  • Measure seconds with custom precision
  • Read cat emoticons from file
  • Write times to file in a compact format
  • Add a command line specifier that calls ResetMethod() on Zeitkatze
  • Option for one-line output
  • Animated cats with multithreading?
  • Unicode support
  • Fancier output with ncurses
  • Unit test it by sending signals/keystrokes to the app

6. Issues

  • None at the moment

7. Bugs

  • After running zeitkatze in a terminal, it changes its properties. A side-effect of this is that if you try to enter a user password in same terminal, it will not work: sudo: no password was provided sudo: a password is required Fixed as of 691b1de.