Coder Social home page Coder Social logo

overtime's Introduction

Overtime

A simple program to register overtime work hours.

Dependencies

  • Postgres (tested on 14.9)
  • Bash >= 4.2

Installation

  1. Clone this repo.
  2. Change directory to the repo and make the program executable with
chmod +x overtime
  1. (Optional) add to path to access it anywhere
export PATH=$PATH:`pwd`
  1. Run the initial installation. This step will create a postgres database named overtime (you may specify another name with the -c flag, in which case this has to be provided in all commands) with one table called overtime. This is where all logged hours will be stored.
overtime install
  1. You're good to go. A good starting point is probably
overtime -h

Examples

Add two and a half hour overtime for today with a custom message:

overtime add -m "Worked a lot today" 2 30
# or, if you used a custom db name (this goes for all examples below as well):
overtime -c my_custom_db_name add -m "Worked a lot today" 2 30

Add one hour on another day:

overtime add -d "2022-02-02" 1

Add 30 minutes of negative hours. There are three ways to achieve this. Either use the flex subcommand, the add subcommand with the -n flag or the add subcommand with negative numbers:

overtime flex 0 30
# or:
overtime add -n 0 30
# or:
overtime add 0 -30

See the log

overtime log
 id |         created_at         |    date    | hours | minutes |      message
----+----------------------------+------------+-------+---------+--------------------
 28 | 2022-04-06 00:16:56.309263 | 2022-04-06 |     0 |     -30 |
 27 | 2022-04-06 00:16:48.850319 | 2022-02-02 |     1 |       0 |
 26 | 2022-04-06 00:16:42.484353 | 2022-04-06 |     2 |      30 | Worked a lot today

Check your current balance

overtime balance
 hours_balance | minutes_balance
---------------+-----------------
             3 |               0

Undo the last entry

overtime undo
overtime log
 id |         created_at         |    date    | hours | minutes |      message
----+----------------------------+------------+-------+---------+--------------------
 27 | 2022-04-06 00:16:48.850319 | 2022-02-02 |     1 |       0 |
 26 | 2022-04-06 00:16:42.484353 | 2022-04-06 |     2 |      30 | Worked a lot today

You can of course also work with the data directly from postgres:

psql -d overtime  # substitute "overtime" with whatever custom db name you may have chosen during installation

overtime=# \d
              List of relations
 Schema |      Name       |   Type   | Owner
--------+-----------------+----------+-------
 public | overtime        | table    | per
 public | overtime_id_seq | sequence | per

overtime=# select * from overtime;
 id |         created_at         |    date    | hours | minutes |      message
----+----------------------------+------------+-------+---------+--------------------
 26 | 2022-04-06 00:16:42.484353 | 2022-04-06 |     2 |      30 | Worked a lot today
 27 | 2022-04-06 00:16:48.850319 | 2022-02-02 |     1 |       0 |

TODOs

  • The program has only been tested on macOS Monterey. Date functions used by overtime differ on Linux, so it won't necessarily work out-of-the-box.

overtime's People

Contributors

percarlsen avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.