Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display time elapsed for each task #89

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

romdr
Copy link

@romdr romdr commented May 10, 2019

Display time elapsed for each task, instead of the total time (that is already displayed at the beginning of the line)

In the case of a task ground, the time displayed is the time elapsed by the whole group.

Example:

#alfred.yml
test.group:
  summary: sleep 1
  tasks: test.2 test.3

test.3:
  summary: sleep 3
  command: sleep 3

test.2:
  summary: sleep 2
  command: sleep 2

test.1:
  summary: sleep 1
  command: sleep 1

test:
  summary: sleep
  tasks: test.group test.1 test.2 test.3
$ alfred.exe test
[      0s] (10 May 19 16:37 PDT) [/tmp] test started [] sleep
[      0s] (10 May 19 16:37 PDT) [/tmp] test tasks test.group, test.1, test.2, test.3
[      0s] (10 May 19 16:37 PDT) [/tmp] test.group started [] sleep 1
[      0s] (10 May 19 16:37 PDT) [/tmp] test.group tasks test.2, test.3
[      0s] (10 May 19 16:37 PDT) [/tmp] test.2 started [] sleep 2
[      2s] (10 May 19 16:37 PDT) [/tmp] test.2 ✔ ok [] elapsed time '2s'
[      2s] (10 May 19 16:37 PDT) [/tmp] test.3 started [] sleep 3
[      5s] (10 May 19 16:37 PDT) [/tmp] test.3 ✔ ok [] elapsed time '3s'
[      5s] (10 May 19 16:37 PDT) [/tmp] test.group ✔ ok [] elapsed time '5s'
[      5s] (10 May 19 16:37 PDT) [/tmp] test.1 started [] sleep 1
[      6s] (10 May 19 16:37 PDT) [/tmp] test.1 ✔ ok [] elapsed time '1s'
[      6s] (10 May 19 16:37 PDT) [/tmp] test.2 started [] sleep 2
[      8s] (10 May 19 16:37 PDT) [/tmp] test.2 ✔ ok [] elapsed time '2s'
[      8s] (10 May 19 16:37 PDT) [/tmp] test.3 started [] sleep 3
[     11s] (10 May 19 16:37 PDT) [/tmp] test.3 ✔ ok [] elapsed time '3s'
[     11s] (10 May 19 16:37 PDT) [/tmp] test ✔ ok [] elapsed time '11s'

romdr added 4 commits May 9, 2019 15:59
This removes the full date and current directory from each log line, and the context argument (when there is none of them), by default.
These can still be printed with -extended-formatting.

Also rena,ed "elapsed time" to "in" for each co,mmand's elapsed time.
The absolute import (including the github,com/kcmerrill part doesn't work when the project is forked to a different github account. Import from the local directory instead. (I don't know this was done this way)

Now after forking/cloning the repo, it can build with just:
$ go get
$ go build
Display time elapsed for each task, instead of the total time (that is already displayed at the beginning of the line)

In the case of a task ground, the time displayed is the time elapsed by the whole group.

Example:

#alfred.yml
test.group:
  summary: sleep 1
  tasks: test.2 test.3

test.3:
  summary: sleep 3
  command: sleep 3

test.2:
  summary: sleep 2
  command: sleep 2

test.1:
  summary: sleep 1
  command: sleep 1

test:
  summary: sleep
  tasks: test.group test.1 test.2 test.3

$ alfred.exe test
[      0s] (10 May 19 16:37 PDT) [/tmp] test started [] sleep
[      0s] (10 May 19 16:37 PDT) [/tmp] test tasks test.group, test.1, test.2, test.3
[      0s] (10 May 19 16:37 PDT) [/tmp] test.group started [] sleep 1
[      0s] (10 May 19 16:37 PDT) [/tmp] test.group tasks test.2, test.3
[      0s] (10 May 19 16:37 PDT) [/tmp] test.2 started [] sleep 2
[      2s] (10 May 19 16:37 PDT) [/tmp] test.2 ✔ ok [] elapsed time '2s'
[      2s] (10 May 19 16:37 PDT) [/tmp] test.3 started [] sleep 3
[      5s] (10 May 19 16:37 PDT) [/tmp] test.3 ✔ ok [] elapsed time '3s'
[      5s] (10 May 19 16:37 PDT) [/tmp] test.group ✔ ok [] elapsed time '5s'
[      5s] (10 May 19 16:37 PDT) [/tmp] test.1 started [] sleep 1
[      6s] (10 May 19 16:37 PDT) [/tmp] test.1 ✔ ok [] elapsed time '1s'
[      6s] (10 May 19 16:37 PDT) [/tmp] test.2 started [] sleep 2
[      8s] (10 May 19 16:37 PDT) [/tmp] test.2 ✔ ok [] elapsed time '2s'
[      8s] (10 May 19 16:37 PDT) [/tmp] test.3 started [] sleep 3
[     11s] (10 May 19 16:37 PDT) [/tmp] test.3 ✔ ok [] elapsed time '3s'
[     11s] (10 May 19 16:37 PDT) [/tmp] test ✔ ok [] elapsed time '11s'
@romdr
Copy link
Author

romdr commented May 11, 2019

I didn't mean to merge the other changes (that break the CI build). I created a PR up to specifically the CL that introduced the elapsed time change. I probably need to make a new PR or fix that branch.

This reverts commit 82023de, reversing
changes made to 5d9033b.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant