Git Product home page Git Product logo

mite-cli's Introduction

Easy to use CLI tool for creating, listing, starting and stopping time tracking entries in Mite and much other things using the mite-api npm package which is using the official mite api.

MIT License NPM Package NPM Downloads Known Vulnerabilities Maintainability FOSSA Status Language grade: JavaScript Language grade: JavaScript Rate on Openbase

Features

  • Create new Entries with interactive survey-like (optional) CLI interface
  • Delete, lock, unlock single time entries
  • Edit the currently running entries text, service and project for quickly updating the work log
  • Read, filter, group time entries to show reports for different time periods
  • List, sort, filter, update & delete user accounts, customers, projects & services using variable columns and CLI-tables, CSV) or TSV data
  • Highlight JIRA identifiers (ABC-1279) and GitHub numeral (#2121) hashtags in time entry’s notes (customizable)
  • auto-completions for most of the sub-commands, options and option values (optional)
  • Support for standard streams in most of the sub-commands.

Other ideas & planned features can be found in the wiki. Report Requirements, Bugs, Issues of any kind: create a new issue.

Usage: mite [options] [command]

_______ _____ _______ _______     _______        _____
|  |  |   |      |    |______ ___ |       |        |
|  |  | __|__    |    |______     |_____  |_____ __|__

command line tool for time tracking service mite.de
https://github.com/Ephigenia/mite-cli/


Options:
    -V, --version      output the version number
    -h, --help         output usage information

Commands:
    amend|reword       edit note, service, project of a specific time entry or the currently runnning entry
    autocomplete       install/uninstall autocompletion
    config             show or set configuration settings
    customer           create/delete/list/update customer
    customers|clients  list, filter & search customers
    delete|rm          delete a specific time entry
    list|st            list time entries
    lock               lock single time entry
    new|create         create a new time entry
    open               open the given time entry in browser
    project            create/delete/list/update a single project
    projects           list, filter, archive/unarchive & search projects
    resume             resume most recent entry
    service            create/delete/list/update single service
    services           list, filter & search services
    start              start the tracker for the given id, will also stop allready running entry
    stop               stop any running counter
    unlock             unlock single time entry
    users              list, filter & search for users
    help [cmd]         display help for [cmd]

Installation

There are tree different ways to use mite-cli.

Please note that all examples in this README.md assume that you have installed mite-cli globally. If not, just replace the mite call with ~/node_modules/.bin/mite or npx mite-cli.

Global

npm install -g mite-cli

Local

npm insall mite-cli

Then you can call mite-cli binary link created in node_modules/.bin:

~/node_modules/.bin/mite

via NPX

Or use it directly using npx:

npx mite-cli

Configuration

Before you can start, you’ll need to setup the mite account name ("mycompany" in https://mycompany.mite.de) and API key ("Account" -> "My Account").

mite config set account <name>
mite config set apiKey <key>

The configuration is stored in ~/.mite-cli.json or whatever you defined in XDG_CONFIG_HOME. That also means that right now only one account can be used at a time. There already is an issue for different configs.

Configuration Options

  • account The mite account name, the subdomain part

  • apiKey The user specific apiKey

  • currency
    defines the currency used for displaying money values

  • customersColumns
    defines the default columns to be used when running mite customer list list.

  • listColumns
    defines the default columns to be used when running mite list.

  • noteHighlightRegexp defines a single regular expression which can contain a single capturing group which will get highlighted. By default this is set to highlight GitHub hashtag notation (f.e. #218) and Jira story identifiers (f.e. CRYO-1281). When you change this note that the beginning and trailing slashes must be omitted and the regexp is case-sensitive and modifiers cannot be changed.

    It will also highlight duration notes in the content following the (10:00 to 12:00) format.

  • outputFormat
    defines the default output format for the list commands, defaults to table

  • projectsColumns
    defines the default columns to be used when running mite project list list.

  • servicesColumns
    defines the default columns to be used when running mite services list.

  • usersColumns
    defines the default columns to be used when running mite users.

Defaults

Configuration options can always be back to the initial value to their default by leaving out the value, like: mite config set listColumns.

Auto-Completion

Since version 0.9.0 mite-cli supports auto-completions for most of the sub-commands arguments, options and option values which make it much easier to use in on the command line. No need to remember user ids or service names anymore as they are suggested when hitting TAB.

  • Right now auto-completion is only supported and tested on -nix-systems and with the following bash environments: bash, fish and ZSH
  • mite-cli must be installed globally and must be in $PATH

Before auto-completions can be used you need to install them using the autocomplete command:

mite autocomplete install

When you think you had enough you can uninstall it with

mite autocomplete uninstall

Usage

Time Entries

List

By default lists today’s time-entries including id, date, project name, revenue, service and the entries note. You can modify this by changing the listColumns in the config. (can be changed mite config set listColumns id,user,project)

When an entry is currently active and tracked it will be yellow and indicated with a little play icon "▶". Also locked entries are greyed out and indicated with a green checkmark "✔" symbol.

mite list

┌──────────┬────────────┬───────────────┬────────────┬──────────┬─────────┬───────────────────┬──────────────────────────────────────────────────┐
│       ID │ Date       │ User          │    Project │ Duration │ Revenue │ Service           │ Note                                             │
├──────────┼────────────┼───────────────┼────────────┼──────────┼─────────┼───────────────────┼──────────────────────────────────────────────────┤
│ 73628791 │ 2017-09-13 │ Bruce Banner  │ carservice │  ▶ 01:36 │       - │ Programming       │ open in browser                                  │
├──────────┼────────────┼───────────────┼────────────┼──────────┼─────────┼───────────────────┼──────────────────────────────────────────────────┤
│ 73628761 │ 2017-09-13 │ Bruce Banner  │        ABC │    00:07 │    9.33 │ Communication     │ lorem ipsum dolor                                │
├──────────┼────────────┼───────────────┼────────────┼──────────┼─────────┼───────────────────┼──────────────────────────────────────────────────┤
│ 73627950 │ 2017-09-13 │ Bruce Banner  │ sp support │    00:04 │    4.84 │ Programming       │ JIRA-123 Lorem ipsum dolor sit amet, consetetur  │
│          │            │               │            │          │         │                   │ sadipscing.                                      │
├──────────┼────────────────────────────┼────────────┼──────────┼─────────┼───────────────────┼──────────────────────────────────────────────────┤
│ 73627919 │ 2017-09-13 │ Bruce Banner  │        XYZ │    00:10 │   13.33 │ Communication     │ Lorem ipsum dolor sit amet, consetetur           │
│          │          │                 │            │          │         │                   │ sadipscing elitr, sed diam nonumy eirmod         │
│          │          │                 │            │          │         │                   │ tempor invidunt ut labore et dolore              │
├──────────┼──────────┼─────────────────┼────────────┼──────────┼─────────┼───────────────────┴──────────────────────────────────────────────────┤
│          │          │                 │            │    00:21 │   27.50 │                                                                      │
└──────────┴──────────┴─────────────────┴────────────┴──────────┴─────────┴──────────────────────────────────────────────────────────────────────┘

Filter by time

You also can request longer time frames by using the first argument which is basically the at parameter of the time entries API:

mite list this_month

Or Specific dates:

mite list 2017-01-02

Or relative weekdays (show entries from last Friday)

mite list friday

Or relative duration notation (show entries form last 2 weeks)

mite list 2w

Or Custom periods of time

mite list --from 2018-04-01 --to 2018-04-15

Or search for specific entries in all time-entries from the current year

mite list this_year --search JIRA-123

Other Filters

There are various filters to limit the entries shown:

  • --from & --to show entries only between two dates or relative dates
  • --billable show only (not-)billable entries
  • --tracking show only tracking/currently running entries
  • --customer-id show entries from a one or more customer(s)
  • --service-id show entries from a one or more service(s)
  • --project-id show entries from a one or more project(s)
  • --locked show only locked or unlocked entries
  • --user-id show entries from one or more user(s)
  • --min-duration, --max-duration filter by the duration

It can be hard to remember ids, that’s why I recommend using auto-completion which makes it way easier to filter time entries.

Grouping / Reports

For getting a rough overview of the monthly project or services distribution you can use the --group-by argument which will group the time entries. This could also be helpful for creating bills.

mite list last_month --group-by=service

┌────────────────────┬────────┬────────────┐
│ Communication      │  13:03 │   994.98 € │
├────────────────────┼────────┼────────────┤
│ Programming        │ 109:27 │  9387.11 € │
├────────────────────┼────────┼────────────┤
│ Project Management │  15:43 │  1484.48 € │
├────────────────────┼────────┼────────────┤
│                    │ 138:13 │ 11866.57 € │
└────────────────────┴────────┴────────────┘

Or even more groups which also allows splitting between customers:

mite list last_month --group-by customer,service

┌─────────────────┬───────────────────┬────────┬────────────┐
│ Soup Inc.       │ Communication     │   3:48 │   361.00 € │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Soup Inc.       │ Programming       │  88:15 │  1383.75 € │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Soup Inc.       │ ProjectManagement │  15:20 │   456.67 € │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Musterman Corp. │ Communication     │   0:47 │          - │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Musterman Corp. │ Programming       │   7:35 │          - │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Beans Gmbh      │ Communication     │   8:28 │   133.98 € │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Beans Gmbh      │ Programming       │  13:37 │   203.36 € │
├─────────────────┼───────────────────┼────────┼────────────┤
│ Beans Gmbh      │ ProjectManagement │   0:23 │    97.81 € │
├─────────────────┼───────────────────┼────────┼────────────┤
│                 │                   │ 138:13 │  2635.15 € │
└─────────────────┴───────────────────┴────────┴────────────┘

Advanced Examples

When creating a bill for a project create a list of all services worked on in a month on a specific project:

mite list last_month --project-id 2681601 --group-by service

┌────────────────────┬────────┬────────────┐
│ Communication      │  13:03 │   994.98 € │
├────────────────────┼────────┼────────────┤
│ Programming        │ 109:27 │  9387.11 € │
├────────────────────┼────────┼────────────┤
│ Project Management │  15:43 │  1484.48 € │
├────────────────────┼────────┼────────────┤
│                    │ 138:13 │ 11866.57 € │
└────────────────────┴────────┴────────────┘

In order to fill the details of the services you’ll need all the notes from that specific service. Get the notes for one specific service, a project for the last month to put them on a bill or similar:

mite list last_month --project-id 2681601 --service-id 325329 --columns note --plain | sort -u

Disabling Unicode Characters

Some columns like "duration", "hours" add some Unicode characters to f.e. indicate that the time entry is already locked or currently running. This may not be wanted if you’re exporting the entries to a file.

You can disable this behavior by setting the (NO_COLOR)[https://no-color.org/] variable before calling mite:

NO_COLOR=1 mite list --columns date,service,note,duration --plain

Create Time-Entries

Interactive

When no arguments or just the "note" is given mite new asks for more details of the time-entry that should be created. Project, service and duration can be entered in an interactive survey.

mite new

You can also start by providing a precomposed note

mite new "started working on new features"

Non-Interactive

Start creating new time-tracking items right from the command-line. Just pass the things that you’ve done, the project’s name, service name, minutes or the date. The following example will create a 35 minutes entry for the Project "my-project"

mite new "created some new nice code" my-project programming 35

The duration values can be the number of minutes or a duration string. When you add a plus sign at the end "+", f.e. "3:12+" the time entry is created and eminently started.

mite new "researching colors for project" myProject1 programming 0:05+

Shortcuts

The program doesn’t provide any feature for fastly creating time entries on the fly but your OS does! Create one or more bash aliase(s) for your most used time entries.

The following example creates a bash-alias for creating new running time-entry for a specific project:

# ~/.bashrc
alias "m1"="mite new Standup ProjectX Meetings 1+";

You can also pass over some arguments like the note for the entry and an optional amount of time if you use bash functions instead of aliases:

# ~/.bashrc
m() {
    mite new "$1" ProjectX Programming "${2:-1+}";
}

Then you can fastly create new running entries:

m standup

Or add new entries with a fixed time using the second argument:

m "added new feature xy" 3:21

Advanced Usage

Create a time entries note from the last git commit message:

git log -1 --pretty=%B | xargs echo -n | mite new my-project communication 30

Pipe a note’s content (preferably from other outputs) to mite new:

echo "my new note" | mite new projectx programming 60+

Start & Open Entry

In case you don’t know what to track exactly or which tasks you’d be doing while you’re doing them you can create a new entry and open the note in an editor. The note will get saved as soon as you close the editor:

mite new "started" ProjectX Programmierung 1+ | xargs -n1 mite amend --editor

Tracker

Start Tracking

Start tracking of a specific time entry.

mite start <timeEntryId>

Resume Tracking

Re-start tracking for the most recent entry

mite start --last

Stop Tracking

Stops any currently running time entry.

mite stop

Modify Time-Entries

Change Note

When there’s a tracker running you may want to update the note without opening the browser and enter the new details. You can use amend or reword command which will load the time entry and you can enter the new note.

mite amend

You can also add the --editor option so that your favorite editor opens up with the current note. Make sure your $EDITOR is correctly set.

mite amend --editor

Change the note for the most recently created entry, f.e. for adding some notes

mite amend last

You can also alter the notes of other time entries when you specify their id

mite amend 1847132

You can also pass additional information like the note:

mite amend 12345678 "created a programmable list of items"

You can also pipe in the note:

cat myVerLongNote.txt | mite amend 1234567

Change Service or Project

Changing the project or service id of the current or any other time entry works the same:

mite amend 12345678 --service-id 12834 --project-id 12938123

Set Tracked Time

Setting the minutes of a specific time entry can be done with mite amend and passing a duration string in the format HH:MM or specifying the minutes directly:

mite amend 123455678 --duration 30

or

mite amend 123455678 --duration 0:30

which is both the same and sets the minutes to 30.

Adding/Removing Time

It’s also possible to use the same option (--duration) to remove or add some duration. You can still use the HH:MM format or minutes directly:

mite amend 12345678 --duration +98

which will add 98 minutes to the time entry or remove 12 minutes:

mite amend 12345678 --duration -0:12

Move Time Entry to another date

mite amend 12345678 --date 2020-05-03

Un-/Lock Entry

Lock a single time entry

mite lock 1289736

Unlock a single time entry

mite lock 128721

Locking all entries from the last month from a specific customer using mite list and xargs:

mite list last_month --customer-id 128171 --columns id --plain | xargs -n1 mite lock

Delete entry

Delete a single entry

mite delete 18472721

Deleting a set of entries filtered using mite list and xargs:

mite list this_month --project-id 128717 --columns id --plain | xargs -n1 mite delete

Open

Opens the organization’s mite homepage in the systems default browser.

mite open

When a time-entry id is provided opens up the edit form of that entry.

mite open 1234567

Users

List user accounts while client-side search in name, email & note, sort by email and list only time_trackers and admins. Archived users will be grey.

mite user --search frank --role admin,time_tracker --sort email

┌────────────┬──────────────┬─────────────────┬─────────────────────────────┬────────────────────────────────────────────────────┐
│         ID │ User Role    │ Name            │ Email                       │ Note                                               │
├────────────┼──────────────┼─────────────────┼─────────────────────────────┼────────────────────────────────────────────────────┤
│     123456 │ admin        │ Frank Abergnale │ [email protected]              │ Lorem ipsum dolor sit amet, consectetur adipisicin │
│            │              │                 │                             │ g elit, sed do eiusmod tempor incididunt ut labore │
│            │              │                 │                             │ et dolore magna aliqua. Ut enim ad minim veniam, q │
│            │              │                 │                             │ uis nostrud exercitation ullamco laboris nisi ut a │
│            │              │                 │                             │ liquip ex ea commodo consequat. Duis aute irure do │
│            │              │                 │                             │ lor in reprehenderit in voluptate velit esse cillu │
│            │              │                 │                             │ m dolore eu fugiat nulla pariatur. Excepteur sint  │
│            │              │                 │                             │ occaecat cupidatat non proident, sunt in culpa qui │
│            │              │                 │                             │ officia deserunt mollit anim id est laborum.       │
├────────────┼──────────────┼─────────────────┼─────────────────────────────┼────────────────────────────────────────────────────┤
│      12345 │ time_tracker │ Heinz Frankfurt │ [email protected]             │                                                    │
└────────────┴──────────────┴─────────────────┴─────────────────────────────┴────────────────────────────────────────────────────┘

List archived user accounts

mite user --archived

┌────────────┬──────────────┬─────────────────┬─────────────────────────────┬────────────────────────────────────────────────────┐
│         ID │ User Role    │ Name            │ Email                       │ Note                                               │
├────────────┼──────────────┼─────────────────┼─────────────────────────────┼────────────────────────────────────────────────────┤
│       1234 │ time_tracker │ James Howlett   │ [email protected]             │                                                    │
└────────────┴──────────────┴─────────────────┴─────────────────────────────┴────────────────────────────────────────────────────┘

show all-time tracking users from a company (all have a specific email domain)

mite users --role time_tracker --email ephigenia.de

export all users to a CSV file

mite users --columns id,role,name,email,archived,language --json | jq -rM '.[] | @csv' > users.csv

Show a report for all users showing the revenues and times per service for all users matching a query

mite users --search marc --columns id --plain | xargs mite list last_month --group-by service --user-id

Customers

List, filter and search for customers. Archived customers will be shown in grey.

mite customer list list --search web --sort id

┌────────┬─────────────────┬─────────┬─────────────────────────────────────┐
│ ID     │ Name            │ Rate    │ Note                                │
├────────┼─────────────────┼─────────┼─────────────────────────────────────┤
│ 123456 │ WebCompany Ltd. │ 12.34 € │ client’s note                       │
├────────┼─────────────────┼─────────┼─────────────────────────────────────┤
│ 827361 │ Solutions Web   │ 80.00 € │ Multiline lorem ipsum               │
│        │                 │         │ Note content                        │
├────────┼─────────────────┼─────────┼─────────────────────────────────────┤
│ 927361 │ Mite-Cli        │ -       │ open source project                 │
└────────┴─────────────────┴─────────┴─────────────────────────────────────┘

Use different columns

mite customer list --colums name,hourly_rate

Export all archived customers

mite customer list --archived true --json | jq -rM '.[] | @csv' > archived_customers.csv

Create Customer

Use this command to create a new customer.

mite customer new --name "Megasoft" --hourly-rate 90

Update Customer

This command can update a customer’s name, note, hourly rate and archived state.

Archive a single customer

mite project update --archived false 1238127

Archive multiple customers using xargs:

mite customer list --columns id --plain | xargs -n1 mite customer update --archived false

Delete Customer

Delete a single customer

mite customer delete 123456

Delete a whole set of customers

mite customer list --columns id --archived yes --plain | xargs -n1 mite customer delete

Projects

List, filter and search for projects. Example showing only archived projects ordered by customer-id in ascending order

mite project list --archived yes --sort customer-id

┌───────────────┬──────────────────────────┬─────────────┬──────────────┬────────────┬────────────┐
│ Name          │ Customer                 │      Budget │       Budget │ Budget     │       Rate │
│               │                          │             │         Used │ Used       │            │
├───────────────┼──────────────────────────┼─────────────┼──────────────┼────────────┼────────────┤
│ Alpha X       │ WebCompany (1234)        │    480:00 h │     330:14 h │ ███████░░░ │          - │
├───────────────┼──────────────────────────┼─────────────┼──────────────┼────────────┼────────────┤
│ Beta-Test     │ WebCompany (1234)        │           - │            - │            │          - │ 
├───────────────┼──────────────────────────┼─────────────┼──────────────┼────────────┼────────────┤
│ App-Review    │ WebCompany (1234)        │    160:00 h │       0:25 h │ ░░░░░░░░░░ │    75.00 € │
├───────────────┼──────────────────────────┼─────────────┼──────────────┼────────────┼────────────┤
│ Deployment    │ Example ltd. (73625)     │     80:00 h │      38:48 h │ █████░░░░░ │          - │
└───────────────┴──────────────────────────┴─────────────┴──────────────┴────────────┴────────────┘

Export all projects using other columns as CSV:

mite project list --columns id,customer-id,customer_name --json | jq -rM '.[] | @csv' > projects_export.csv

Unarchive all archived projects from a specific customer using xargs:

mite project list --customer-id 123456 --columns id --plain | xargs -n1 mite project update --archived false

Create Project

Use mite project new subcommand to create new projects. There’s currently no support for complicated hourly rates per service. To find out the customer_id use either Auto-Completion or copy the id from the mite project list list.

The following example will create a new Project with an overall budget of 5000 and an hourly rate of 80:

mite project new --customer-id 123456 \
    --name "Side Project B" \
    --hourly-rate 80.00 \
    --budget 5000 \
    --budget-type cents

Update Project

The mite project command can update the details like budget-type, archived state, hourly-rate, name or note of a project.

Archive a single project

mite project update --archived false 1238127

Set the note and name of a project

mite project update --name "js prototype" --note="prototype development" 12344567

Update hourly rate of a project while updating all already associated time entries:

mite project update --hourly-rate 9000 --update-entries 1234567

Archive multiple projects using xargs:

mite project list --columns id --plain | xargs -n1 mite project update --archived false

Delete Project

Delete a project:

mite project delete 123456

Delete all archived projects:

mite project list --columns id --archived yes --plain | xargs -n1 mite project delete

Services

List, filter and search for services. Archived services will be grey.

mite service list

┌────────┬───────────────────┬──────────┬──────────┬──────────────────────────────────────────────────────────────────────────────┐
│ ID     │ Name              │ Rate     │ Billable │ Note                                                                         │
├────────┼───────────────────┼──────────┼──────────┼──────────────────────────────────────────────────────────────────────────────┤
│ 123456 │ Programming       │  20.00 € |      yes │ General Programming                                                          │
├────────┼───────────────────┼──────────┼──────────┼──────────────────────────────────────────────────────────────────────────────┤
│ 123457 │ Consulting        │  30.00 € │      yes │                                                                              │
├────────┼───────────────────┼──────────┼──────────┼──────────────────────────────────────────────────────────────────────────────┤
│ 736251 │ Accounting        │        - │       no │ Accounting, invoices etc.                                                    │
└────────┴───────────────────┴──────────┴──────────┴──────────────────────────────────────────────────────────────────────────────┘

Update Service

This command can update a service’s name, note, hourly rate and archived state.

Change the hourly rate of a service:

mite service update --hourly-rate 8500 123456

Archive a single service:

mite service update --archived false 1238127

Delete Service

Delete a single service

mite service delete 123456

Advanced Topics

Cache

The cache stores data retrieved from the Mite API. You can clear it up using the cache command

mite cache clear

A common scenario is when data in Mite is updated (e.g. a new customer is added), and Mite-CLI does not reflect the changes. This is because the cache system is preventing Mite-CLI from displaying the updated data. To resolve this issue, simply clear the cache and create a new entry to fetch the latest data from Mite.

Columns

Every command that produces a tabular output uses a default set of columns per command. You can specify which columns should be shown using the --columns option or use --columns all to show all available columns.

The default column set can be changed per command using the config options that end with *Columns.

The following example will only show the user and his durations from last week including the sum of the durations:

mite list last_week --billable false --columns user,duration

┌──────────────┬────────────┐
│ User         │   Duration │
├──────────────┼────────────┤
│ Bruce Banner │       0:45 │
├──────────────┼────────────┤
│ Bruce Banner │       0:20 │
├──────────────┼────────────┤
│ Bruce Banner │     ✔ 0:13 │
├──────────────┼────────────┤
│ Bruce Banner │     ✔ 1:34 │
├──────────────┼────────────┤
│ Bruce Banner │     ✔ 0:06 │
├──────────────┼────────────┤
│              │       2:58 │
└──────────────┴────────────┘

Specifying the columns is important when you want to use the ids of items in other commands with xargs.

The following example uses the ids of all time entries to lock them:

mite list last_month --columns id --plain | xargs -n1 mite lock

Plotting Charts

The following command will list all customers from last year and plot their minuets as bar charts to the terminal so that it’s easy to compare the values to each other:

mite list last_year --group-by year,customer --columns customer,minutes --plain | jq -rM '.[] | @tsv' \
    | sed "$ d" \
    | gnuplot -e \
    "
        set style data boxes;
        set key off;
        set terminal dumb \"$COLUMNS\" 40;
        set datafile separator \"\t\";
        plot '<cat' every ::1 using 2: xtic(1)
    ";

There are even more charting possibilities using the open-source gnuplot.

You can also reproduce the charts from the mite admin showing the number of hours worked in the last month:

mite list this_month --group-by day --columns day,minutes --plain | jq -rM '.[] | @tsv' \
    | sed "$ d" \
    | gnuplot -e \
    "
        set style data boxes;
        set key off;
        set terminal dumb 120 40;
        set datafile separator \"\t\";
        plot '<cat' every ::1 using 2: xtic(1)
    ";

Which will show the chart:

450 +-------------------------------------------------------------------------------------------------------------+
    |     +    +     +    +     +    +     +    +     +    +     +    +     +    +     +    +     +    +     +    |
    |                                                                                                             |
    |                             *******                                                                         |
400 |-+                           *     *                                                                       +-|
    |                             *     *                                                                         |
    |                             *     *                                ******                     *******       |
    |                             *     *                                *    *                     *     *       |
350 |-+                           *     *                                *    *                     *     *     +-|
    |                             *     *                                *    *                     *     *       |
    |                             *     *                                *    *                     *     *    ***|
    |                             *     *    *******                     *    *                     *     *    *  |
300 |-+                           *     *    *     *                     *    *                ******     *    *+-|
    |             ******          *     *    *     *                     *    *******          *    *     *    *  |
    |             *    *          *     *    *     *                     *    *     *          *    *     *    *  |
    |             *    *          *     *    *     *                     *    *     *          *    *     *    *  |
250 |-+           *    *          *     *    *     *               *******    *     *          *    *     ******+-|
    |  ******     *    *          *     *    *     ******          *     *    *     *          *    *     *    *  |
    |  *    *     *    *          *     *    *     *    *          *     *    *     ******     *    *     *    *  |
    |  *    *     *    *          *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
200 |-+*    *     *    *     ******     *    *     *    *          *     *    *     *    *     *    *     *    *+-|
    |  *    *     *    *     *    *     *    *     *    *          *     *    *     *    *******    *     *    *  |
    |  *    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
    |  *    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
150 |-+*    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *+-|
    |  *    *******    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
    |  *    *     *    *     *    *     ******     *    *          *     *    *     *    *     *    *     *    *  |
    |  *    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
100 |-+*    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *+-|
    |  *    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
    |  *    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
    |  *    *     *    *******    *     *    *     *    *          *     *    *     *    *     *    *     *    *  |
_50 |-+*    *     *    *     *    *     *    *     *    *          *     *    *     *    *     *    *     *    *+-|
    |  *    *     *    *     *    *     *    *     *    *******    *     *    *     *    *     *    *     *    *  |
    |  *    *     *    *     *    *     *    *     *    *     *    *     *    *     *    *     *    *     *    *  |
    |  *  + *  +  *  + *  +  *  + *  +  *  + *  +  *  + *  +  ******  +  *  + *  +  *  + *  +  *  + *  +  *  + *  |
    +-------------------------------------------------------------------------------------------------------------+
    29   25   24    23   22    19   18    17   16    15   14    12   11    10   09    08   05    04   03    02   01

Alternate Output formats

The purpose of the application is to simplify and streamline the interaction with the mite time-tracking service while making the output readable on the command-line.

The following formats are supported:

  • csv (comma-separated)
  • json, ignores ansi-colors & table headers
  • md (markdown)
  • table (cli-table)
  • text (line-seperated), doesn’t show table headers
  • tsv (tab-separated), perfect for inserting into excel or google docs

There are alternative output formats which may be useful when you automatically process the results such as json, csv, text:

mite list last_week --columns user,id --json | jq -rM '.[] | @csv' 

Date,User,Duration
2018-11-02,Bruce Banner,1:10
2018-11-01,Bruce Banner,2:30
2018-10-31,Bruce Banner,✔ 2:47
2018-10-30,Bruce Banner,✔ 0:43
2018-10-30,Bruce Banner,✔ 0:10
2018-10-30,Bruce Banner,✔ 0:09
2018-10-29,Bruce Banner,✔ 1:35
2018-10-29,Bruce Banner,✔ 1:21
,,10:25

This makes it very easy to further process the data, transform it into a HTML page or PDF.

Exporting CSVs

Creating a time-sheet for your clients can be done like this:

mite list last_month --json --columns date,service,note,duration --plain | jq -rM '.[] | @csv'

Batch-Edit Time Entries

Using Ids from the output for further processing using xargs:

mite list --columns id --plain | xargs -n1 mite lock

Monthly/Daily summary

Show only the notes from yesterday’s entries to put them into a standup message:

mite list yesterday --plain --columns note --plain

Showing all billable entries’ notes of a specific project:

mite list last_month --project-id 456 --columns note --plain --billable yes

Generating PDFs

The most common use case for creating pdfs is when a client asks for a nice looking pdf with the entries from a specific project and timeframe. The mite-cli cannot create pdfs on it’s own but you can use the power of other tools like jq & md-to-pdf:

NO_COLOR mite-cli list last_month --project-id 1234 --columns=date,note,duration --json | jq -rM '.[] | @csv' | md-to-pdf > "./time-entries-$(date +%Y%m%d).pdf"

md-to-pdf can be improved by adding custom stylesheets, templates for headers and footers and can be adjusted to your needs.

Tmux Integration

Keep track of your daily and monthly efforts right in the status bar of tmux using the tmux-mite-cli plugin. Currently in alpha stage.

Other Projects

  • acari mite CLI in rust
  • mite-clock CLI tool for start, stopping time-entries on the fly
  • mite-go mite CLI in go
  • mite-goal web-app displaying targeted monthly time budgets
  • mite-overtime webapp display of calculated overtime values
  • mite-reminder slack application sending notifications for missing time entries
  • mite.cmd mite CLI in ruby
  • Mitey mite CLI in javascript

Contributing

License

FOSSA Status

mite-cli's People

Contributors

daaanny90 avatar dependabot[bot] avatar ephigenia avatar fossabot avatar phiros avatar renovate-bot avatar renovate[bot] avatar semantic-release-bot avatar yolk avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

mite-cli's Issues

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

cache for auto-completions

The auto-completion for projects and services is kind of slow and obstructive when a new entry should be created pretty fast. There should be a cache with a configurable ttl of 180 minutes.

There should be an additional command to refresh those lists in case a service or project was added. There also could be an automatically refresh or purge when npm project create or similar was used.

Store config files less permissive and usable on multiuser systems

When using mite config set [key] [value] mite-cli stores the given values in a config.json file lovated inside node_modules/mite-cli. This has two issues:

  1. The file config.json is world-readable by any user/process on my system and contains sensitive informations. The permissions should be 640 or even better just 600.

  2. The file is located outside of my users home folder. Other users using the same machine will see/overwrite my mite-cli file. Maybe it would be better to use a file in ~/.mite-cli.json instead?

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

refactor: output options

Context

The "output" option doesn’t follow standards described in https://clig.dev/#output

Description

Current Options and their possible successor(s)

  • csv
    • mite list --json | jq '.[] | @csv'
  • json
    • mite list --json
  • markdown
    • mite list --json | jq '.[] | @csv' | npx csv2md (using csv2md to convert the csv input to markdown)
  • table (default)
    • mite list --pretty
  • text
    • mite list --plain outputs tabular data, seperated with 3 spaces
    • with aligning columns mite list --plain | column -t
  • tsv
    • mite list --json | jq '.[] | @csv'

tmux plugin for displaying state

For people using tmux it would be super-nice to have a tmux plugin which displays the currently tracked time (if there’s one) in the status bar. #79 could help here.

Suggestions for status bar interpolation strings

  • mite_id displays current tracked entry id
  • mite_duration displays current tracked entry duration in human readable format
  • mite_status displays current tracking status, f.e. play ("▶") symbol for "entry running" and "■" for stopped or not running entry
  • mite_today_duration displays the today's total duration
  • mite_today_revenue displays the today’s revenue total
  • mite_month_duration displays the monthly duration total
  • mite_month_revenue displays the month revenue total

Useful resources:

debug

Add "debug" package, scope and add more debugging messages.

option for demo-mode

When the env-variable MITE_CLI_DEMO is not empty there should be all money values obfuscated or randomized so that it’s easy to create screenshots or screencasts as demos.

mite new | mite amend doesn’t work

Piping the newly created entry id from f.e. "mite new" to "mite amend" and accepting the id via stdin doesn’t work and results in the following error:

mite new "testnote" Ephigenia Programmierung 1+ | mite amend --editor
EAGAIN: resource temporarily unavailable, read

Can't use mite-cli with email address account

Context

  • MacOS Catalina 10.15.7
  • mite-cli 1.5.0

Description

My account is my email address with, of course, the top level domain. When I try to do something with mite-cli I get Hostname/IP does not match certificate's altnames: Host: ****.de.mite.yo.lk. is not in the cert's altnames: DNS:*.mite.yo.lk

Expected Behavior

I should set my account with mite config set account and use mite-cli also with an email address as account name.

Current Behavior

I get Hostname/IP does not match certificate's altnames: Host: ****.de.mite.yo.lk. is not in the cert's altnames: DNS:*.mite.yo.lk

Steps to Reproduce

Set an email address as username and try to use one command of mite-cli.

Possible Solution

I saw in mite-tracker.js on line 11 that the BASE_URL is set with the account saved in config.

The problem, in my case, is that the top domain level .de is wrong, the domain mite should use is the same like my account but without .de.
Maybe is possible to find the top domain level and remove it from the account configuration?
Maybe removing the top domain level from the account with regex and then setting it as BASE_URL?
Or, another solution could be to add a configuration information with the right domain to use.

Configuration still saved also after uninstall

Context

  • MacOS Catalina 10.15.7
  • mite-cli 1.5.0

Description

The Idea was to try to fix the bug described in the issue #90 .
I uninstalled the mite-cli and cloned the repository. When I run npm start I get the same error described in the issue #90 , but I can't change the configuration because mite-cli is actually uninstalled.

Expected Behavior

  • Uninstall mite-cli
  • Clone the repository
  • run npm start
  • Start debug a fresh new version of mite-cli

Current Behavior

I still have the configuration of my old uninstalled mite-cli

Steps to Reproduce

  1. Install mite-cli with npm install -g mite-cli
  2. Set up account and apiKey
  3. Uninstall mite-cli with npm uninstall -g mite-cli
  4. Clone the repository
  5. Run npm start

At this point, you still use the configuration set up at point 2

Unable to install autocomplete

Context

  • OS: MacOs Catalina 10.15.7
  • Terminal: Bash and zsh
  • mite-cli version: 1.5.0

Description

I'm trying to install autocomplete, with the command mite autocomplete install.

Expected Behavior

I should be able to choose the right shell type and go on with the installation.

Current Behavior

The choice is shown, but I cannot choose the shell type, because the installation script stops before I can do anything.

Dannys-MacBook-Pro:~ danny$ mite autocomplete install
? Which Shell do you use ? (Use arrow keys)
❯ bash 
  zsh 
  fish Usage: mite-autocomplete [options] [command]

Options:
  -V, --version  output the version number
  -h, --help     output usage information

Commands:
  install        Installs auto-completion for most of the mite subcommands,
                 options and arguments. Compatible with bash, fish and zsh. No
                 support for windows systems. Also note that it will only work
                 when mite is installed globally.
  uninstall      removes the auto-completion for mite

Dannys-MacBook-Pro:~ danny$

Steps to Reproduce

Just run mite autocomplete install, from bash or szh is the same.

command for getting curently active tracked entry

There should be a command to see if there’s a currently active tracker. It‘s not clear yet what this command should return.

  • output just the id - would be good for combining with other commands like npm start, npm stop, npm amend
  • output a single row just like in mite list with the ability to set output format, columns etc. (can also be combined with other commands)
  • output a whole new format horizontal oriented format where all the details of the entry are shown (could also be a whole new command mite show <entry-id>

The idea in combination with #77 #78 would be to make it easier to use the CLI tool for simpler time-tracking.

Support for user/password authentication

The mite api also support authentication using user and password: https://mite.yo.lk/api/index.html#authentication

This could be supported by two new config parameters: "username" and "password". Maybe this makes it easier for some to setup the CLI tool. (see #90)

mite config set username <[email protected]>;
mite config set password <password>;
mite list

In case username & password are setup the cli uses these values instead of the apiKey.

Please upvote if you like to have this feature implemented.

refactor: summary row switch

Context

The summary row at the end of the output is not always needed. So there should be a command-line option to enable/disable it like: mite list --summary

add -l / --last option to amend & start

Right now it’s easy to edit or restart the last created entries note using xargs:

mite list today --limit 1 --tracking true  --columns id --format text | xargs -n1 mite amend --editor
mite list today --limit 1 --tracking true  --columns id --format text | xargs -n1 mite start

But it would be even easier if npm start and npm amend accept a -l / --last option which then uses the last created entry.

mite-list 1y

The mite-list command supports showing entries from shot names of periods like "1m" (1month), "1d" (1day) but not years. Especially for grouped reports the notation for years using "y" should be added.

table package update throws errors

Context

Trying to update the "table" package to latest 6.7.0 version.

Description

When the package is updated, there are errors thrown when running mite list:

  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'attribute' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'format' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must match exactly one schema in oneOf',
    params: { passingSchemas: null },
    schemaPath: '#/oneOf'
  }
]
/Users/ephigenia/Development/mite-cli/node_modules/table/dist/validateConfig.js:22
        throw new Error('Invalid config.');
        ^

Error: Invalid config.
    at Object.validateConfig (/Users/ephigenia/Development/mite-cli/node_modules/table/dist/validateConfig.js:22:15)
    at Object.makeTableConfig (/Users/ephigenia/Development/mite-cli/node_modules/table/dist/makeTableConfig.js:50:22)
    at table (/Users/ephigenia/Development/mite-cli/node_modules/table/dist/table.js:17:38)
    at Object.formatData (/Users/ephigenia/Development/mite-cli/source/lib/data-output.js:147:14)
    at getReport (/Users/ephigenia/Development/mite-cli/source/mite-list.js:234:21)
    at /Users/ephigenia/Development/mite-cli/source/mite-list.js:262:20
    at handleResponse (/Users/ephigenia/Development/mite-cli/node_modules/mite-api/lib/mite-api.js:77:14)
    at Request._callback (/Users/ephigenia/Development/mite-cli/node_modules/mite-api/lib/mite-api.js:95:16)
    at Request.self.callback (/Users/ephigenia/Development/mite-cli/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)

Possible Solution

  • find correct use of failing properties

mite amend edit last created entry by default

Mite amend without any specific entry id should also search for the last created entry. It already tries to get the currently actively tracked entry by the current user but exits when this entry is not running.

mite-cli amend --editor

mite-cli lists time entries of all users

mite list always returns all time entries of all users in a multiuser mite account. You should send the parameter user_id set to current with every request to time_entries.json to only return the time entries of the current user. Maybe there could be some way to overwrite this if needed?

resume last entry

In addition to #77 there should be a shortcut for starting the last entry with mite resume

autocompletion:caching

Add caching for making auto-completion faster. Cached data could be stored in "~/.mite-cache" …

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.


  • Check this box to trigger a request for Renovate to run again on this repository

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.