26

A simple task and time manager CLI

 5 years ago
source link: https://github.com/unfog-io/unfog-cli
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

⏱ Unfog.cli

A simple task & time manager, written in Haskell .

7ZNnUzr.png!web

Table of contents

Installation

From binaries

curl -sSL https://raw.githubusercontent.com/unfog-io/unfog-cli/master/bin/install.sh | sh

Note: Linux, OSX and Windows are supported. See the releases section .

From AUR

For Arch Linux users, there is an AUR package available (thanks to Mohsen Mohammadi [ #26 ]):

git clone https://aur.archlinux.org/unfog-cli.git
cd unfog-cli
makepkg -isc

From sources

First you need to install stack :

curl -sSL https://get.haskellstack.org/ | sh

Then build from git:

git clone https://github.com/unfog-io/unfog-cli.git unfog && cd unfog
stack install

Usage

Add

To create a task, you need (no matter the order):

  • A description
  • A list of tags (optional)
  • A due time (optional)

A tag should start by + and should be composed of alpha numeral chars.

A due time should follow the format :DDMMYY:HHMM , where almost everything is optional. Each omitted field is replaced by the current date one. Here some use cases (given now = 2019/12/22 10:00 ):

Given arg Due time :21 2019/12/21 00:00 :18:8 2019/12/18 08:00 ::12 2019/12/22 12:00 :1010 2019/10/10 00:00 :010120 2020/01/01 00:00
unfog add|a desc (+tags) (:due:time)

fyeYjmu.png!web

Info

unfog info|i id

jUVbmu3.png!web

List

unfog list|l

7ZNnUzr.png!web

Edit

Desc and due are replaced, but tags are kept. You can add one with +tag and remove one with -tag .

unfog edit|e ids (desc) (+tags) (-tags) (:due:time)

Set

Replace a task (nothing is kept, even the context).

unfog set|s ids desc (+tags) (:due:time)

Toggle

Starts a task if stopped, or stops a task if started.

unfog toggle|t ids
unfog start|+ ids
unfog stop|- ids

Done

Mark as done a task will remove it from the main list by adding a special tag done :

unfog done|d ids

Note: done tasks can be listed by enabling the.

Undone

Unmark as done a task will put back the task in the main list:

unfog undone|u ids

Delete

unfog delete|D ids

Remove

The remove command acts like a toggle. If the task is already done, then it, otherwise it.

unfog remove|r ids

Context

Filters tasks by the given tags. Once set up:

  • You will see only tasks containing at least one tag of your context
  • When youa task, all tags in your context will be assigned to it
unfog context|c (+tags)

The special context +done allows you to see done tasks:

unfog context +done

6JFFviY.png!web

Note: the + is optional.

Note: giving an empty (or invalid) context will clear it.

Worktime

Shows the total worktime spent on tasks belonging to the given context, grouped by days. An empty context will show the worktime of all your tasks.

You can also filter them with a date range. Min date starts by [ , and max date by ] . The date range should follow the due time format (see).

unfog worktime|w (+tags) ([min:range) (]max:range) (--more)

veAJrmM.png!web

Thewill add (for each day) the tasks with their worktime:

zQ7Zbaa.png!web

Note: the + is optional.

Note: the TOTAL WDAY is the total in worktime days, where a worktime day is 7.5 hours.

Status

Shows the status of the first active task found (desc + active duration).

unfog status

Useful for interface integration. Example with polybar :

[module/unfog]
type = custom/script
exec = unfog status
interval = 10

Upgrade

unfog upgrade

BrYvqeq.png!web

Options

JSON

By adding the --json option, the output will be printed in JSON format:

{
  "ok": 0 | 1,
  "data": String | Task | [Task] | Worktime
}
Task {
  id: Int
  ref: Int
  pos: Int
  desc: String
  tags: [String]
  active: TimeRecord
  due: TimeRecord
  done: 0 | 1
  wtime: TimeRecord
}

Worktime {
  total: TimeRecord,
  wtimes: [{
    date: String (day)
    wtime: TimeRecord,
  }]
}

TimeRecord {
  approx: String (worktime approximation)
  human: String (full worktime)
  micro: Int (worktime in micro seconds)
}

This is useful to create user interafaces. Here the list of current implementations:

More

By adding the --more option, you will get more informations depending on the command:

  • : adds for each day the tasks with their worktime

Contributing

Git commit messages follow the Angular Convention , but contain only a subject.

Use imperative, present tense: “change” not “changed” nor “changes” Don't capitalize first letter No dot (.) at the end

Code should be as clean as possible, variables and functions use the camel case convention. A line should never contain more than 80 characters.

Tests should be added for each new functionality. Be sure to run tests before proposing a pull request.

Credits


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK