Code Monkey home page Code Monkey logo

tick's Introduction

Tick CLI for tracking your time

Angry clock eats person

I use tick to track all my time using tmux sessions. But tick can be used without tmux, node or any other dependency. The tick CLI is written in Rust.

Info Description
Project Build Status Project build status for Tick CLI
Installation Installing Tick CLI.
Motivation Why use Tick CLI?
Commands Using Tick CLI.
Inspiration Everything is a remix, including Tick CLI.
Contributing Contribute to Tick CLI.
License License for Tick CLI.

Installation

To install Tick, you can either compile it from source or download the binary from the releases page for the release you want and the platform you need.

Supported platforms

Tick has been used daily by me on different platforms such as macOS, Ubuntu, and Arch. While it hasn't been tested on other platforms such as Windows, patches are welcome to add tests for this.

Dependencies

Tick leverages SQlite 3+ as a database. Make sure you have sqlite3 installed on your machine. This ships with macOS and can usually be installed with a package manager on your platform of choice.

Compiling Tick from source

The steps are pretty straight-forward as long as you are within the realm of Tier 1 support for the Rust compiler.

# Clone the repository.
>_ git clone https://github.com/rogeruiz/tick.git

>_ cd tick

# Setup your Tock configuration file
>_ mkdir -p ~/.config/tick
>_ echo "database_path: ~/.config/tick/main.db" > "${_}/config.yaml"

# Build the release.
>_ cargo build --release

# Install in your path.
>_ cp ./target/release/tick /usr/local/bin/tick

Motivation

I track my time a lot while using the terminal using a wrapper around tmux. The wrapper I have is a shell script called tux. While the wrapper works great, it depends on clocker and node to handle time tracking.

The main motivation around writing this was to remove the node and clocker dependencies from tux along with adding customizable exporting mechanisms. Tracking your time can be hard enough, so Tick tries making it a lot easier.

Commands

Run tick --help to see all the available commands you can use. Below is an example workflow of how you would use Tick.

>_ tick [ -v ] start --name my-timer [ --message "I can do the thing!" ]
>_ tick [ -v ] status
>_ tick [ -v ] stop --name my-timer [ --message "I did the thing!" ]
>_ tick [ -v ] stop [ --message "I did the thing!" ] # without a name argument stops the latest running timer
>_ tick [ -v ] list
>_ tick [ -v ] remove --id $( tick list | tail -1 | awk '{ print $1 }' ) # delete the latest timer by Timer ID

Inspiration

This project would not be possible without being inspired by other's work.

tick's People

Contributors

rogeruiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rahearn

tick's Issues

As a user of tick, I'd like to accurately track my time

Detailed Description

When calling tick start and tick end a timer should be started and saved. Calling tick list should display a simple breakdown of the timer.

Context

A time tracker should be able to track time.

Possible Implementation

  • Creating a database if one doesn't exist
  • Generate a unique ID per timer
  • tick start starts a timer; saves START_TIME to an entry in the database
  • tick stop stops a timer saves END_TIME the previous entry in the database
  • tick list all entries
    • pipes into less?

Tick should be able to aggregate time from a given delta

Detailed Description

Tick should be able to aggregate time from a given delta, defaulting to 8 days, and have that output categorized by name with a summary of all the messages matching each category. It's important to get this right visually first, and then worry about how to best present the data later. I'm thinking there would be three outputs:

  • Summary chart (default)
  • CSV
  • JSON

Context

This would help me be able to fill out my timesheet at work without having to add the numbers myself.

Possible Implementation

The summary chart would look something like this. I'll probably want to use ncurses-rs and design a better UI than what I can whip up in Vim. 😁

 ---------------------------------------------------------------
| Summary for the last {d} days                total hours: 40h |
 ---------------------------------------------------------------
| timer: {n}                                                    |
| durations: {d1}, {d2}, {d3}, {d4}, {d5}, {d6}, {d7}, {d8},    |
|            {d9}, {d0}                                         |
| total time: {h} hours and {m} minutes                         |
| messages: {m1}, {m2}, {m3}, {m4}, {m5}, {m6}, {m7}, {m8},     |
|           {m9}, {m0}                                          |
 ---------------------------------------------------------------
| timer: {n}                                                    |
| durations: {d1}, {d2}, {d3}, {d4}, {d5}, {d6}, {d7}, {d8},    |
|            {d9}, {d0}                                         |
| total time: {h} hours and {m} minutes                         |
| messages: {m1}, {m2}, {m3}, {m4}, {m5}, {m6}, {m7}, {m8},     |
|           {m9}, {m0}                                          |
 ---------------------------------------------------------------
| timer: {n}                                                    |
| durations: {d1}, {d2}, {d3}, {d4}, {d5}, {d6}, {d7}, {d8},    |
|            {d9}, {d0}                                         |
| total time: {h} hours and {m} minutes                         |
| messages: {m1}, {m2}, {m3}, {m4}, {m5}, {m6}, {m7}, {m8},     |
|           {m9}, {m0}                                          |
 ---------------------------------------------------------------

Adding documentation for pre-requisites

Detailed Description

Provide more information regarding how to use the project and what are the requisites for using this.

Context

I am fairly new to rust. But newer to postgresql. So I need some direction regarding how to setup the database. Some searching showed me how to install postgresql, but am still looking for following answers:

  • Is the DB created by itself or do I need to create it?
  • Where would I find the DB?
  • Database URL: It should start with postgres://. This probably means I need to run postgresql separately.

Possible Implementation

It would be helpful if there were some directions regarding setting up and using the database of project.

Your Environment

Installed postgresql via: brew install prostgersql

Add editing of timers incase end time needs updating.

Detailed Description

$ tick edit --id $my_id
error: Found argument 'edit' which wasn't expected, or isn't valid in this context

USAGE:
    tick [FLAGS] [OPTIONS] [SUBCOMMAND]

For more information try --help

Context

Sometimes I leave timers running overnight, and I'd like to be able to update when I actually stopped working in case I forgot to stop it.

Add tests

Detailed Description

Because of the dependency on Diesel, the build step will need to leverage Syntex to properly build and test the final binary.

Context

Tests are currently broken so it's a good idea to just write a basic test and fix the compilation steps.

Possible Implementation

Follow the guide at this point to leverage Syntex.

Your Environment

  • Travis-CI

Bootstrap initial run and fail gracefully

Detailed Description

When installing tick for the first time, it fails in two ways with a panic. Either the $DATABASE_URL isn't set up properly. Or, the timers table doesn't exist in the database for it to write to. This should be created if the database URL isn't set.

Context

  • There should be a default.
  • The default location for the database is $HOME/.tick/db/main.db allowing for file-based customization in the future.

Possible Implementation

  • n/a

Your Environment

  • Rust version: 1.18.0
  • Operating System and version (e.g. macOS, Linux, Windows): macOS

Database locks cause a Rust panic

Detailed Description

Removing a timer gives you a database lock error shortly after stopping a timer with tick stop.

~%# tick remove --id 989
thread 'main' panicked at 'Unable to remove timer matching id 989: DatabaseError(__Unknown, "database is locked")', src/libcore/result.rs:859
note: Run with `RUST_BACKTRACE=1` for a backtrace.

This could also possibly be related with tick status running every second because of outatime, but still needs more investigation. If this is the issue, having a good error or retry UX would solve this pretty well.

Context

Rust panics should have more meaningful error messages, or perhaps even attempt to try multiple times.

Your Environment

  • Rust version: 1.18.0
  • Operating System and version (e.g. Mac OS X, Linux, Windows): macOS

Docs should list env as a prereq

When following the installation instructions, without software which reads .env, the reader cannot move forward. We should list this as a prereq.

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.