Code Monkey home page Code Monkey logo

ti's Introduction

Development moved to https://github.com/tbekolay/ti

ti — A silly simple time tracker

ti is a small command line time tracking application. Simple basic usage looks like this

$ ti on my-project
$ ti fin

You can also give it human-readable times.

$ ti on my-project 30mins ago

ti sports many other cool features. Read along to discover.

Wat?

ti is a simple command line time tracker. It has been completely re-written in python (from being a bash script) and has (almost) complete test coverage. It is inspired by timed, which is a nice project and you should check out if you don't like ti. It also takes inspiration from the simplicity of t.

If a time tracker tool makes me think for more than 3-5 seconds, I lose my line of thought and forget what I was doing. This is why I created ti. With ti, you'll be as fast as you can type, which you should be good with anyway.

The most important part about ti is that it provides just a few commands to manage your time tracking and gets out of your way. All data is saved in a JSON file (~/.ti-sheet, can be changed by setting $SHEET_FILE) for easy access to whatever you need to do. Some ideas,

  • Read your json file to generate beautiful html reports.
  • Build monthly statistics based on tags or the tasks themselves.
  • Read the currently working project and make it show up in your terminal prompt. May be even with how long you've been on it. (!!!)

Its your data.

Oh and by the way, the source is a fairly small python script, so if you know python, you may want to skim over it to get a better feel of how it works.

Note: If you have used the previous bash version of ti, which was horribly tied up to only work on linux, you might notice the lack of plugins in this python version. I am not really missing them, so I might not add them. If anyone has any interesting use cases for it, I'm willing to consider.

Usage

Here's the minimal usage style:

$ ti on my-project
Start working on my-project.

$ ti status
You have been working on my-project for less than a minute.

$ ti fin
So you stopped working on my-project.

on and fin can take a time (format described further down) at which to apply the action.

$ ti on another-project 2 hours ago
Start working on another-project.

$ ti s
You have been working on another-project for about 2 hours.

$ ti fin 30 minutes ago
So you stopped working on another-project.

Also illustrating in the previous example is short aliases of all commands, their first letter. Like, s for status, o for on, f for fin, etc.

Put brief notes on what you've been doing.

$ ti note waiting for Napoleon to take over the world
$ ti n another simple note for demo purposes

Tag your activities for fun and profit.

$ ti tag imp

Get a log of all activities with the log (or l) command.

$ ti log

Command reference

Run ti -h (or --help or help or just h) to get a short command summary of commands.

on

  • Short: o
  • Syntax: ti (o|on) <name> [<time>...]

Start tracking time for the project/activity given by <name>. For example,

ti on conquest

tells ti to start tracking for the activitiy conquest now. You can optionally specify a relative time in the past like so,

ti on conquest 10mins ago

The format of the time is detailed further below.

fin

  • Short: f
  • Syntax: ti (f|fin) [<time>...]

End tracking for the current activity now. Just like with on command above, you can give an optional time to the past. Example

ti fin 10mins ago

tells ti that you finished working on the current activity at, well, 10 minutes ago.

status

  • Short: s
  • Syntax: ti (s|status)

Gives short human readable message on the current status. i.e., whether anything is being tracked currently or not. Example,

$ ti on conqering-the-world
Start working on conqering-the-world.
$ ti status
You have been working on `conqering-the-world` for less than a minute.

tag

  • Short: t
  • Syntax: ti (t|tag) <tag>...

This command adds the given tags to the current activity. Tags are not currently used within the ti time tracker, but they will be saved in the json data file. You may use them for whatever purposes you like.

For example, if you have a script to generate a html report from your ti data, you could tag some activities with a tag like red or important so that, that activity will appear in red in the final html report.

Use it like,

ti tag red for-joe

adds the tags red and for-joe to the current activitiy. You can specify any number of tags.

Tags are currently for your purpose. Use them as you see fit.

note

  • Short: n
  • Syntax: ti (n|note) <note-text>...

This command adds a note on the current activity. Again, like tags, this has no significance with the time tracking aspect of ti. This is for your own recording purposes and for the scripts your write to process your ti data.

Use it like,

ti note Discuss this with the other team.

adds the note Discuss this with the other team. to the current activity.

log

  • Short: l
  • Syntax: ti (l|log) [today]

Gives a table like representation of all activities and total time spent on each of them.

Time format

Currently only the following are recognized. If there is something that is not handled, but should be, please open an issue about it or a pull request (function in question is parse_time)

  • n seconds ago can be written as:

    • nseconds ago
    • nsecond ago
    • nsecs ago
    • nsec ago
    • ns ago
    • a in place of n in all above cases, to mean 1 second.
    • Eg., 10s ago, a sec ago 25 seconds ago, 25seconds ago.
  • n minutes ago can be written as:

    • nminutes ago
    • nminute ago
    • nmins ago
    • nmin ago
    • a in place of n in all above cases, to mean 1 minute.
    • Eg., 5mins ago, a minute ago, 10 minutes ago.
  • n hours ago can be written as:

    • nhours ago
    • nhour ago
    • nhrs ago
    • nhr ago
    • a or an in place of n in all above cases, to mean 1 hour.
    • Eg., an hour ago, an hr ago, 2hrs ago.

Where n is an arbitrary number and any number of spaces between n and the time unit are allowed.

Status

The project is beta. If you find any bug or have any feedback, please do open an issue on Github issues.

Gimme!

You can download ti from the source on github.

  • Put it somewhere in your $PATH and make sure it has executable permissions.
  • Install pyyaml using the command pip install --user pyyaml.
  • Install colorama using the command pip install --user colorama.

After that, ti should be working fine.

Also, visit the project page on github for any further details.

Who?

Created and fed by Shrikant Sharat (@sharat87). To get in touch, ping me on twitter or email.

License

MIT License.

ti's People

Contributors

abesto avatar bturrubiates avatar matthulse avatar roidelapluie avatar sharat87 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ti's Issues

Package on PIP?

It's kinda convenient to have it available on PIP. Is there a version in consideration?

Create "undo" command

I think it would be useful to be able to quickly undo the last change made to the log in case there was a mistake in typing the command.

Czech charset in note

I want to ask, whether it is a simple to fix support for characters like "ěščřžýáíé" in notes.

I got

Traceback (most recent call last):
  File "/home/frostyx/.bin/ti", line 273, in <module>
    main()
  File "/home/frostyx/.bin/ti", line 265, in main
    fn, args = parse_args()
  File "/home/frostyx/.bin/ti", line 256, in parse_args
    args = {'content': ' '.join(tail)}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 0: ordinal not in range(128)

by

ti note "ěščřžýáíé"

python3 AttributeError: 'str' object has no attribute 'decode'

Running ti inside GIT Bash with python 3.5.2 raises the above mentioned error. Apparently the str object has no decode function since it is already considered decoded

`brac010@ISS16661 MINGW64 /h/timekeeping
$ python --version
Python 3.5.2

brac010@ISS16661 MINGW64 /h/timekeeping
$ ti -h
Traceback (most recent call last):
File "H:/timekeeping/ti", line 434, in
main()
File "H:/timekeeping/ti", line 425, in main
fn, args = parse_args()
File "H:/timekeeping/ti", line 352, in parse_args
argv = [arg.decode('utf-8') for arg in argv]
File "H:/timekeeping/ti", line 352, in
argv = [arg.decode('utf-8') for arg in argv]
AttributeError: 'str' object has no attribute 'decode'

brac010@ISS16661 MINGW64 /h/timekeeping
$
`

All commands return "ambiguous action name"

I've copied the "ti" and "dtime" files into my ~/bin/ directory, and ~/bin/ is in my $PATH variable. Here are a few sample outputs from running the script. I'm running it from my ~/ directory, if that makes any difference:

$ ti
Ambiguous action name:
  edit
  fin
  note
  on
  status
  tag

$ ti on project
Ambiguous action name:
  on

$ ti status
Ambiguous action name:
  status

This is my version of bash: GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)

I'm running Mac OS X 10.8.1.

Reports

Sorry to be so slow, but how exactly can I read my json file to generate beautiful html reports?
I am on Ubuntu 14.04

ti on project time ago

Hi, I got

Traceback (most recent call last):
  File "/home/frostyx/.bin/ti", line 259, in <module>
    main()
  File "/home/frostyx/.bin/ti", line 251, in main
    action = parse_args()
  File "/home/frostyx/.bin/ti", line 219, in parse_args
    'time': to_datetime(' '.join(tail[1:])),
  File "/home/frostyx/.bin/ti", line 150, in to_datetime
    return parse_time(timestr).isoformat() + 'Z'
  File "/home/frostyx/.bin/ti", line 164, in parse_time
    raise ValueError("Don't understand the time '" + timestr + "'")
ValueError: Don't understand the time '10 hours ago'

by

ti on my-project 10 hours ago

That should work according README.markdown. Can you help me with that, please?

Dump working times

I can't figure out how to dump the summary - total time working on some project.
Is it somewhat possible?

Timezones

I think it would be beneficial to be able to edit the time zone easier.
perhaps with a variable at the top of the file? At the moment I'm in the US and it's using UTC automatically

auto completion

It would be really nice to have auto completion for selecting which task to start, ex:

 ti o m

would list all task starting with "m"...

Export to ledger

Hi,
I'm wondering how feasible it would be to export to ledger time format. Ledger is a CLI accounting tool that could then take care of filtering and aggregating issues. It has many ports; the original and hledger (Haskell) claim to have this time log functionality.
See: http://hledger.org/manual.html#timelog The format is as follows (C&P from there):

i 2015/03/30 09:00:00 some:account name  optional description after two spaces
o 2015/03/30 09:20:00
i 2015/03/31 22:21:45 another account
o 2015/04/01 02:00:34

I have taken a look at the json file ti creates and on first glance it seems like the conversion would be straightforward to implement. Now I read a bit more here, for instance about interrupts and I'm not so sure anymore. Are interruptions handled before we even write to the json store? Or only when log aggregates? In other words can I produce such a file by parsing straight through the json file or will there be some traps waiting for me?

Ok, I'm looking at how interrupts are actually logged now. I'd have to remove the color coding and parse to the original account so they're not mixed. It appears that ti log has the same issue however. I get the following unexpected/non-aggregated output:

interrupt: work:thesis         ∙∙  19 seconds
work:thesis                              ∙∙  6 seconds

Best regards,
Matthias

Taking over ti development

Hi @sharat87! Thanks for ti, it's a nice utility that scratches an important itch.

You mentioned in #25 that you don't have much time for this project. In my fork, I've done the work necessary to make ti pip-installable (see #26). Would it be okay for me to publish my fork on PyPI, making ti pip-installable? If so, would you also consider adding something to the README to note that you are no longer maintaining the project, and point to my fork? I'd be happy to deal with all of the PRs made on this repo on my fork.

Support absolute times

It would be nice if we could use absolute times:

$ ti on work 08:00
$ ti fin work 12:00

ti time

ti on projecta 30min ago
ti fin 40min ago

log shows 23hrs 50 min 28 sec as time for projecta

ti log crashes with pipe

Hi,

Any idea why 'ti log' would crash anytime you try to pipe the output to another command? I'm running Python2.7 on Mac OSX Yosemite.

Output:

% ti log | grep PCO
Traceback (most recent call last):
File "/usr/local/bin/ti", line 434, in
main()
File "/usr/local/bin/ti", line 426, in main
fn(**args)
File "/usr/local/bin/ti", line 235, in action_log
end=' ← working\n' if current == name else '\n')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)

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.