Moro
Command line tool for tracking work hours, as simple as it can get.
Demo
Screen recorded video tutorial
moro is really simple but you can watch this screen recording to see all the features Moro has: link in 15 minutes.
install
npm install -g moro
You need node version 4.8.0 or higher (we haven't tested lower versions)
update
npm update -g moro
How it works?
Short version:
When you start your work day, you run $: moro. And when you are leaving, you run moro again. And it tells you how many hours you have worked.
Long version:
The formula to calculate work hours is simple: (time the work ends) - (time the work starts) - (breaks) = work time, e.g. 17 - 9 - 1 = 7. However, it gets tricky when you don't remember when you came to work this morning. Or yesterday...
Moro saves the three parameters, start, en, break, for each day and at the end of the day tells you how many hours you have worked. All data is saved on your computer and doesn't leave it.
- when you come to work you say moro:
$: moro
your start of the day is set at 9:00
...
- When you are about to leave work you say moro once more, and you find out how long you have worked!
$ moro
Your end of the day registered as 17:15
Today looks like this:
┌────────────────┬────────────────────────┐
│ Today │ 7 Hours and 30 Minutes │
├────────────────┼────────────────────────┤
│ Start │ 09:15 │
├────────────────┼────────────────────────┤
│ End │ 17:15 │
├────────────────┼────────────────────────┤
│ Break duration │ 30 minutes │
├────────────────┼────────────────────────┤
│ Date │ 2017-03-08 │
└────────────────┴────────────────────────┘
moro subtracts 30 minutes for the lunch time by default.
That's it! You know you have worked 7 hours and 30 minutes!
What if you forgot to say moro when you start or finish your day?
If you forget to say moro in the morning, or when you're leaving, don't worry. You can do that later on the same day, but not tomorrow for example.
To specify the start and end of your workday afterward moro has two commands: hi and bye
hi is for setting the start of the day, check the format of time HH:mm
$ moro hi 10:45
bye is to set the end of your work day
$ moro bye 15:56
You can also use break to set the total minutes of break. The default is 30 minutes. So if you just have 30 minutes break on the day, don't touch this one.
# Imagine you notice you had 45 minutes of break instead of 30, do this to set it
$ moro break 45
to see all your registered hours:
$ moro report --all
Adding a note
You can add one or more notes to your workday.
$ moro note foo
They'll appear in reports. You can for example use them to devide your time between different tasks.
Clear data
To flush your data
$ moro clear --yes
Configuration
To change the Date format for a report use a pattern
# this will change the output to 'Fr, 2017-03-17'
moro.js config --format 'dd, YYYY-MM-DD'
For more possible formats see the Moment.js documentation
Setting work day duration and break time default
In Finland a full work day is 7.5 hours, which is the default in moro. To change it use this:
# for example to make it 6.5 hours
moro config --day 6.5
Also the default break time can be changed from 30 minutes
# to make default break 45 minutes
moro config --break 45
Backup the data
Moro uses a single database file to keep your data. Default location is in your home directory, and the file name is .moro-data.db. You can backup that file however you like.
Easy way to back up is to move the moro database file into your DropBox folder and then use the following command to tell moro to use that database file:
moro config --database-path /home/GraceHopper/Dropbox/moro-data.db
# This works on my linux machine :)
Why not do it by a one liner?
Well I hear you! My colleague, Henri, gave me this:
echo 'You have worked:' $(echo 'scale=2;(' $(date -d 'now' +%s) - $(date -d "$(journalctl -t systemd-logind -b | grep 'Lid opened' | tail -n1 | awk '{print $1, $2, $3}')" +%s) ')' / 3600 | bc) 'hours'
Contributing
Yes please! Open an issue, or make a pull request!
Code of conduct
Code is important but people are more important. If you like to contribute to moro please read and follow our code of conduct found in this file: CODE_OF_CONDUCT.md
To run tests
yarn run test
Automated run script
There's a shell script that runs all the features and you can see the results in terminal, to make sure things work.
./tests/automated-script.sh
what does moro mean?
Moro means hello in Finnish.
Supporters
I thank Futurice (link) my employer for sponsoring this project trough its Spice program
Contributors
Thanks goes to these wonderful people (emoji key):
Omid Hezaveh |
Mario |
Karl Fleischmann |
Niloofar Motamed |
Wolf-Rost |
Henri Koski |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!