doing 1.0.22 → 1.0.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73e09fb9dbc14de53c2464dba86178c402ecdba46d89873d83aea2abe97e1454
4
- data.tar.gz: d8c1d0a5762a7fbef26522f1664414538647a6fd5b4b5f466844b4a1503cad98
3
+ metadata.gz: 6d74d1d69c6dbae627fc25dc8c14a8e8bff95072fdc2f1b1761ab6186c7c0a26
4
+ data.tar.gz: e17b0df1b7c2122c0d8ae33290ccf7e2763cf3e143acf0b60af061b8302c83d2
5
5
  SHA512:
6
- metadata.gz: 968381dd7b6c260a550f6dad755a54f2388baaaaa84ace9a7ea1feafad92b889db04b3084f8236296c4b2bca45613abf2f2d11147b9c0afecf9dd21b869fdaac
7
- data.tar.gz: f585f589879ea6f4c772a71be98c7d31622eee2c3a6a32b42d268890590f0239fb6755eb75d44bf14cf9d559460190edb0980655c535e75f350970fde1ad11ec
6
+ metadata.gz: 802dbf09b3b658640c52ca8e3b74f665fb163199bd0a3648f3f7831121e275a062df3ea47c31921b5b4f5390cbd29c3beeb7fa852624d0c00823a61081222cb9
7
+ data.tar.gz: dea212e53281258c783b0155c3304ada1d26a08db58d27b521d0080c19dec93c40c86f35c086383642d081caf85ac2ecf931a3ad2df927a0c6047cdea6d05b2d
data/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  _If you're one of the rare people like me who find this useful, feel free to [buy me some coffee](http://brettterpstra.com/donate)._
6
6
 
7
- [Changelog](#changelog)
8
7
 
9
8
  ## Contents
10
9
 
@@ -15,6 +14,7 @@ _If you're one of the rare people like me who find this useful, feel free to [bu
15
14
  - [Usage](#usage)
16
15
  - [Extras](#extras)
17
16
  - [Troubleshooting](#troubleshooting)
17
+ - [Changelog](#changelog)
18
18
 
19
19
  <!-- end toc -->
20
20
 
@@ -59,10 +59,15 @@ Notes can be prevented from ever appearing in output with the global option `--n
59
59
  A basic configuration looks like this:
60
60
 
61
61
  ---
62
- doing_file: /Users/username/Dropbox/nvALT2.2/?? What was I doing.md
62
+ doing_file: /Users/username/Dropbox/doing.taskpaper
63
63
  current_section: Currently
64
64
  default_template: '%date: %title%note'
65
65
  default_date_format: '%Y-%m-%d %H:%M'
66
+ marker_tag: flagged
67
+ marker_color: yellow
68
+ default_tags: []
69
+ editor_app: TextEdit
70
+ :include_notes: true
66
71
  views:
67
72
  color:
68
73
  date_format: '%F %_I:%M%P'
@@ -88,16 +93,29 @@ A basic configuration looks like this:
88
93
  date_format: '%_I:%M%P'
89
94
  template: '%date > %title%odnote'
90
95
  wrap_width: 50
91
- :include_notes: true
96
+ autotag:
97
+ whitelist:
98
+ - coding
99
+ - design
100
+ synonyms:
101
+ brainstorming:
102
+ - thinking
103
+ - idea
104
+ html_template:
105
+ haml:
106
+ css:
92
107
 
93
108
 
94
- The config file is stored in `~/.doingrc`, and a skeleton file is created on the first run. Just run `doing` on its own to create the file.
109
+ The config file is stored in `~/.doingrc`, and a skeleton file is created on the first run. Just run `doing` on its own to create the file.
95
110
 
96
111
  ### Per-folder configuration
97
112
 
98
113
  Any options found in a `.doingrc` anywhere in the hierarchy between your current folder and your home folder will be appended to the base configuration, overriding or extending existing options. This allows you to put a `.doingrc` file into the base of a project and add specific configurations (such as default tags) when working in that project on the command line. These can be cascaded, with the closest `.doingrc` to your current directory taking precedence, though I'm not sure why you'd want to deal with that.
99
114
 
100
- This can also be used to define custom HTML output on a per-project basis using the html_template option for custom templates.
115
+ Possible uses:
116
+
117
+ - Define custom HTML output on a per-project basis using the html_template option for custom templates. Customize time tracking reports based on project or client.
118
+ - Define `default_tags` for a project so that every time you `doing now` from within that project directory or its subfolders, it gets tagged with that project automatically.
101
119
 
102
120
  Any part of the configuration can be copied into these local files and modified. You only need to include the parts you want to change or add.
103
121
 
@@ -144,7 +162,7 @@ The config also contains templates for various command outputs. Include placehol
144
162
  - you can prefix `bg` to affect background colors (`%bgyellow`)
145
163
  - prefix `bold` and `boldbg` for strong colors (`%boldgreen`, `%boldbgblue`)
146
164
  - there are some random special combo colors. Use `doing colors` to see the list
147
- - `%interval`: when used with the `-t` switch on the `show` command, it will display the time between a timestamp or `@start(date)` tag and the `@done(date)` tag, if it exists. Otherwise, it will remain empty.
165
+ - `%interval`: when used with the `-t` switch on the `show` command, it will display the time between a timestamp or _@start(date)_ tag and the _@done(date)_ tag, if it exists. Otherwise, it will remain empty.
148
166
 
149
167
  Date formats are based on Ruby [`strftime`](http://www.ruby-doc.org/stdlib-2.1.1/libdoc/date/rdoc/Date.html#method-i-strftime) formatting.
150
168
 
@@ -303,7 +321,7 @@ There are bold variants for both foreground and background colors
303
321
  %boldbgred
304
322
  ... etc.
305
323
 
306
- And a few special colors you'll just have to try out to see:
324
+ And a few special colors you'll just have to try out to see (or just run `doing colors`):
307
325
 
308
326
  %softpurple
309
327
  %hotpants
@@ -322,6 +340,37 @@ To export the default configurations for customization, use `doing templates --t
322
340
 
323
341
  Once you have either or both of the template files, edit `.doingrc` and look for the `html_template:` section. There are two subvalues, `haml:` and `css:`. Add the path to the templates you want to use. A tilde may be substituted for your home directory, e.g. `css: ~/styles/doing.css`.
324
342
 
343
+ ### Autotagging
344
+
345
+ Keywords in your entries can trigger automatic tagging, just to make life easier. There are three tools available: default tags, whitelisting, and synonym tagging.
346
+
347
+ Default tags are tags that are applied to every entry. You probably don't want to add these in the root configuration, but using a local `.doingrc` in a project directory that defines default tags for that project allows anything added from that directory to be tagged automatically. A local `.doingrc` in my Marked development directory might contain:
348
+
349
+ ---
350
+ default_tags: [marked,coding]
351
+
352
+ And anything I enter while in the directory gets tagged with _@marked_ and _@coding_.
353
+
354
+ A whitelist is a list of words that should be converted directly into _@tags_. If my whitelist contains "design" and I type `doing now working on site design`, that's automatically converted to "working on site @design."
355
+
356
+ Synonyms allow you to define keywords that will trigger their parent tag. If I have a tag called _@design_, I can add "typography" as a synonym. Then entering `doing now working on site typography` will become "working on site typography @design."
357
+
358
+ White lists and synonyms are defined like this:
359
+
360
+ autotag:
361
+ synonyms:
362
+ design:
363
+ - typography
364
+ - layout
365
+ brainstorming
366
+ - thinking
367
+ - idea
368
+ whitelist:
369
+ - brainstorming
370
+ - coding
371
+
372
+ Note that you can include a tag with synonyms in the whitelist as well to tag it directly when used.
373
+
325
374
  ## Usage
326
375
 
327
376
  doing [global options] command [command options] [arguments...]
@@ -350,7 +399,7 @@ The `doing now` command can accept `-s section_name` to send the new entry strai
350
399
 
351
400
  If you want to use `--back` with `doing done` but want the end time to be different than the start time, you can either use `--took` in addition, or just use `--took` on its own as it will backdate the start time such that the end time is now and the duration is equal to the value of the `--took` argument.
352
401
 
353
- You can finish the last unfinished task when starting a new one using `doing now` with the `-f` switch. It will look for the last task not marked `@done` and add the `@done` tag with the start time of the new task (either the current time or what you specified with `--back`).
402
+ You can finish the last unfinished task when starting a new one using `doing now` with the `-f` switch. It will look for the last task not marked _@done_ and add the _@done_ tag with the start time of the new task (either the current time or what you specified with `--back`).
354
403
 
355
404
  `doing done` is used to add an entry that you've already completed. Like `now`, you can specify a section with `-s section_name`. You can also skip straight to Archive with `-a`.
356
405
 
@@ -360,7 +409,7 @@ When used with `doing done`, `--back` and `--took` allow time intervals to be ac
360
409
 
361
410
  All of these commands accept a `-e` argument. This opens your command line editor (as defined in the environment variable `$EDITOR`). Add your entry, save the temp file, and close it. The new entry is added. Anything after the first line is included as a note on the entry.
362
411
 
363
- `doing meanwhile` is a special command for creating and finishing tasks that may have other entries come before they're complete. When you create an entry with `doing meanwhile [entry text]`, it will automatically complete the last @meanwhile item (dated `@done` tag) and add the `@meanwhile` tag to the new item. This allows time tracking on a more general basis, and still lets you keep track of the smaller things you do while working on an overarching project. The `meanwhile` command accepts `--back [time]` and will backdate the `@done` tag and start date of the new task at the same time. Running `meanwhile` with no arguments will simply complete the last `@meanwhile` task.
412
+ `doing meanwhile` is a special command for creating and finishing tasks that may have other entries come before they're complete. When you create an entry with `doing meanwhile [entry text]`, it will automatically complete the last _@meanwhile_ item (dated _@done_ tag) and add the _@meanwhile_ tag to the new item. This allows time tracking on a more general basis, and still lets you keep track of the smaller things you do while working on an overarching project. The `meanwhile` command accepts `--back [time]` and will backdate the _@done_ tag and start date of the new task at the same time. Running `meanwhile` with no arguments will simply complete the last _@meanwhile_ task.
364
413
 
365
414
  See `doing help meanwhile` for more options.
366
415
 
@@ -372,9 +421,9 @@ See `doing help meanwhile` for more options.
372
421
 
373
422
  ##### Finishing
374
423
 
375
- `doing finish` by itself is the same as `doing done` by itself. It adds `@done(timestamp)` to the last entry. It also accepts a numeric argument to complete X number of tasks back in history. Add `-a` to also archive the affected entries.
424
+ `doing finish` by itself is the same as `doing done` by itself. It adds _@done(timestamp)_ to the last entry. It also accepts a numeric argument to complete X number of tasks back in history. Add `-a` to also archive the affected entries.
376
425
 
377
- `doing finish` also provides an `--auto` flag, which you can use to set the end time of any entry to 1 minute before the start time of the next. Running a command such as `doing finish --auto 10` will go through the last 10 entries and sequentially update any without a `@done` tag with one set to the time just before the next entry in the list.
426
+ `doing finish` also provides an `--auto` flag, which you can use to set the end time of any entry to 1 minute before the start time of the next. Running a command such as `doing finish --auto 10` will go through the last 10 entries and sequentially update any without a _@done_ tag with one set to the time just before the next entry in the list.
378
427
 
379
428
  As mentioned above, `finish` also accepts `--back "2 hours"` (sets the finish date from time now minus interval) or `--took 30m` (sets the finish date to time started plus interval) so you can accurately add times to completed tasks, even if you don't do it in the moment.
380
429
 
@@ -385,7 +434,7 @@ As mentioned above, `finish` also accepts `--back "2 hours"` (sets the finish da
385
434
 
386
435
  doing tag -c 3 client cancelled
387
436
 
388
- ... will mark the last three entries as `@client @cancelled`. Add `-r` as a switch to remove the listed tags instead.
437
+ ... will mark the last three entries as _@client @cancelled_. Add `-r` as a switch to remove the listed tags instead.
389
438
 
390
439
  You can optionally define keywords for common tasks and projects in your `.doingrc` file. When these keywords appear in an item title, they'll automatically be converted into @tags. The `whitelist` tags are exact (but case insensitive) matches.
391
440
 
@@ -420,20 +469,20 @@ You can also add notes at the time of entry by using the `-n` or `--note` flag w
420
469
 
421
470
  #### Displaying entries:
422
471
 
423
- show - List all entries
424
- recent - List recent entries
425
- today - List entries from today
426
- yesterday - List entries from yesterday
427
- last - Show the last entry
428
- grep, search - Show entries matching text or pattern
472
+ show - List all entries
473
+ recent - List recent entries
474
+ today - List entries from today
475
+ yesterday - List entries from yesterday
476
+ last - Show the last entry
477
+ grep - Show entries matching text or pattern
429
478
 
430
479
  `doing show` on its own will list all entries in the "Currently" section. Add a section name as an argument to display that section instead. Use "all" to display all entries from all sections.
431
480
 
432
- You can filter the `show` command by tags. Simply list them after the section name (or `all`). The boolean defaults to `ANY`, meaning any entry that contains any of the listed tags will be shown. You can use `-b ALL` or `-b NONE` to change the filtering behavior: `doing show all done cancelled -b NONE` will show all tasks from all sections that do not have either `@done` or `@cancelled` tags.
481
+ You can filter the `show` command by tags. Simply list them after the section name (or `all`). The boolean defaults to `ANY`, meaning any entry that contains any of the listed tags will be shown. You can use `-b ALL` or `-b NONE` to change the filtering behavior: `doing show all done cancelled -b NONE` will show all tasks from all sections that do not have either _@done_ or _@cancelled_ tags.
433
482
 
434
483
  Use `-c X` to limit the displayed results. Combine it with `-a newest` or `-a oldest` to choose which chronological end it trims from. You can also set the sort order of the output with `-s asc` or `-s desc`.
435
484
 
436
- The `show` command can also show the time spent on a task if it has a `@done(date)` tag with the `-t` option. This requires that you include a `%interval` token in template -> default in the config. You can also include `@start(date)` tags, which override the timestamp when calculating the intervals.
485
+ The `show` command can also show the time spent on a task if it has a _@done(date)_ tag with the `-t` option. This requires that you include a `%interval` token in template -> default in the config. You can also include _@start(date)_ tags, which override the timestamp when calculating the intervals.
437
486
 
438
487
  If you have a use for it, you can use `-o csv` on the show or view commands to output the results as a comma-separated CSV to STDOUT. Redirect to a file to save it: `doing show all done -o csv > ~/Desktop/done.csv`. You can do the same with `-o json`.
439
488
 
@@ -481,7 +530,7 @@ You can also use tags to archive. You define the section first, and anything fol
481
530
 
482
531
  By default, tag archiving uses an `AND` boolean, meaning all the tags listed must exist on the entry for it to be moved. You can change this behavior with `-b OR` or `-b NONE` (`ALL` and `ANY` also work).
483
532
 
484
- Example: Archive all Currently items for `@client` that are marked `@done`
533
+ Example: Archive all Currently items for _@client_ that are marked _@done_
485
534
 
486
535
  doing archive @client @done
487
536
 
@@ -506,9 +555,7 @@ Pressing Spacebar and typing allows you to add a new entry to currently. You an
506
555
 
507
556
  Point of interest, the LaunchBar Action makes use of the `-o json` flag for outputting JSON to the action's script for parsing.
508
557
 
509
- <!--{% download 117 %}-->
510
-
511
- Download the Action at [brettterpstra.com](https://brettterpstra.com/projects/doing/)
558
+ See <https://brettterpstra.com/projects/doing/> for the download.
512
559
 
513
560
  Evan Lovely has [created an Alfred workflow as well](http://www.evanlovely.com/blog/technology/alfred-for-terpstras-doing/).
514
561
 
@@ -540,9 +587,8 @@ Ruby is rife with encoding inconsistencies across platforms and versions. Feel f
540
587
 
541
588
  ### Support
542
589
 
543
- I'm not making any money on `doing`, and I don't plan to spend a lot of time fixing errors on an array of operating systems and platforms I don't even have access to. You'll probably have to solve some things on your own.
544
590
 
545
- That said, you can get support from other users (and occasionally me) on GitHub. If you run into a replicatable bug in your environment, please [post an issue](https://github.com/ttscoff/doing/issues) and include your platform, OS version, and the result of `ruby -v`, along with a copy/paste of the error message. To get a more verbose error message, try running `GLI_DEBUG=true doing [...]` for a full trace.
591
+ As a free project, `doing` isn't heavily supported, but you can get support from myself and other users on GitHub. If you run into a replicatable bug in your environment, please [post an issue](https://github.com/ttscoff/doing/issues) and include your platform, OS version, and the result of `ruby -v`, along with a copy/paste of the error message. To get a more verbose error message, try running `GLI_DEBUG=true doing [...]` for a full trace.
546
592
 
547
593
  Please try not to email me directly about GitHub projects.
548
594
 
@@ -550,8 +596,17 @@ Please try not to email me directly about GitHub projects.
550
596
 
551
597
  Feel free to [poke around](http://github.com/ttscoff/doing/), I'll try to add more comments in the future (and retroactively).
552
598
 
599
+ {% donate doing now sending coffee money to Brett. %}
600
+
553
601
  ## Changelog
554
602
 
603
+ #### 1.0.23
604
+
605
+ - Apply default_tags after autotagging to avoid tags triggering tags
606
+ - Set `doing recent` to default to All sections instead of Currently
607
+ - Fix error in time reporting
608
+ - improved y/n prompt for TTY
609
+
555
610
  #### 1.0.22
556
611
 
557
612
  - Fix handling of "local" config files, allowing per-project configurations
@@ -673,7 +728,7 @@ Catching up on the changelog. Kind of. A lot has happened, mostly fixes.
673
728
  * Look, HTML output! (`--output html`)
674
729
  * Also, `--output csv`
675
730
  * let doing `archive` function on all sections
676
- * option to exclude date from `@done`,
731
+ * option to exclude date from _@done_,
677
732
  * output newlines in sections and views
678
733
  * Flagging (`doing mark`)
679
734
  * fix for view/section guess error
@@ -692,9 +747,9 @@ Catching up on the changelog. Kind of. A lot has happened, mostly fixes.
692
747
  - `tags_color` in view config to highlight tags at the end of the lines. Can be set to any of the `%colors`.
693
748
  - Basic time tracking.
694
749
  - `-t` on `show` and `view` will turn on time calculations
695
- - Intervals between timestamps and dated `@done` tags are calculated for each line, if the tag exists.
750
+ - Intervals between timestamps and dated _@done_ tags are calculated for each line, if the tag exists.
696
751
  - You must include a `%interval` token in the appropriate template for it to show
697
- - `@start(date)` tags can optionally be used to override the timestamp in the calculation
752
+ - _@start(date)_ tags can optionally be used to override the timestamp in the calculation
698
753
  - Any other tags in the line have that line's total added to them
699
754
  - Totals for tags can be displayed at the end of output with `--totals`
700
755
 
@@ -723,6 +778,8 @@ Catching up on the changelog. Kind of. A lot has happened, mostly fixes.
723
778
  - fuzzy section guessing when specified section isn't found
724
779
  - fuzzy view guessing for `doing view` command
725
780
 
781
+ ----
782
+
726
783
  #### 0.1.9
727
784
 
728
785
  - colors in templated output
@@ -749,3 +806,4 @@ Catching up on the changelog. Kind of. A lot has happened, mostly fixes.
749
806
  - save a tmp file and open it in an editor
750
807
  - allows multi-line entries, anything after first line is considered a note
751
808
  - assumed when no input is provided (`doing now`)
809
+
data/bin/doing CHANGED
@@ -516,17 +516,19 @@ command :tag do |c|
516
516
  count = options[:c].to_i
517
517
 
518
518
  if count == 0
519
+ section_q = section == 'All' ? "" : " in section #{section}"
520
+
519
521
  if options[:a]
520
- print "Are you sure you want to autotag all records? (y/N) "
522
+ question = "Are you sure you want to autotag all records#{section_q}"
521
523
  elsif options[:r]
522
- print "Are you sure you want to remove #{tags.join(" and ")} from all records? (y/N) "
524
+ question = "Are you sure you want to remove #{tags.join(" and ")} from all records#{section_q}"
523
525
  else
524
- print "Are you sure you want to add #{tags.join(" and ")} to all records? (y/N) "
526
+ question = "Are you sure you want to add #{tags.join(" and ")} to all records#{section_q}"
525
527
  end
526
528
 
527
- res = STDIN.gets
529
+ res = wwid.yn(question,false)
528
530
 
529
- unless res.strip =~ /^y(es)?$/i
531
+ unless res
530
532
  raise "Cancelled"
531
533
  end
532
534
  end
@@ -692,8 +694,8 @@ default_value 10
692
694
  arg_name 'count'
693
695
  command :recent do |c|
694
696
  c.desc 'Section'
695
- c.default_value wwid.current_section
696
- c.flag [:s,:section], :default_value => wwid.current_section
697
+ c.default_value "All"
698
+ c.flag [:s,:section], :default_value => "All"
697
699
 
698
700
  c.desc 'Show time intervals on @done tasks'
699
701
  c.default_value true
@@ -813,7 +815,6 @@ command :yesterday do |c|
813
815
  c.switch [:totals], :default_value => false, :negatable => true
814
816
 
815
817
  c.action do |global_options, options,args|
816
- section = args.length > 0 ? args.join(" ") : wwid.current_section
817
818
  puts wwid.yesterday(options[:s],options[:t],options[:o],{:totals => options[:totals]}).chomp
818
819
 
819
820
  end
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '1.0.22'
2
+ VERSION = '1.0.23'
3
3
  end
@@ -52,6 +52,7 @@ class WWID
52
52
  @content = {}
53
53
  @doingrc_needs_update = false
54
54
  @default_config_file = '.doingrc'
55
+ @interval_cache = {}
55
56
  end
56
57
 
57
58
  ##
@@ -97,7 +98,7 @@ class WWID
97
98
  }
98
99
  @config['templates']['recent'] ||= {
99
100
  'date_format' => '%_I:%M%P',
100
- 'template' => '%shortdate: %title',
101
+ 'template' => '%shortdate: %title (%section)',
101
102
  'wrap_width' => 88
102
103
  }
103
104
  @config['views'] ||= {
@@ -426,6 +427,7 @@ class WWID
426
427
  ##
427
428
  def add_section(title)
428
429
  @content[title.cap_first] = {'original' => "#{title}:", 'items' => []}
430
+ @results.push(%Q{Added section "#{title.cap_first}"})
429
431
  end
430
432
 
431
433
  ##
@@ -451,9 +453,9 @@ class WWID
451
453
  if alt
452
454
  raise "Did you mean `doing view #{alt}`?"
453
455
  else
454
- print "Create a new section called #{frag.cap_first} (y/N)?"
455
- input = STDIN.gets
456
- if input =~ /^y/i
456
+ res = yn("Section #{frag} not found, create it",false)
457
+
458
+ if res
457
459
  add_section(frag.cap_first)
458
460
  write(@doing_file)
459
461
  return frag.cap_first
@@ -464,6 +466,57 @@ class WWID
464
466
  section ? section.cap_first : guessed
465
467
  end
466
468
 
469
+ ##
470
+ ## @brief Ask a yes or no question in the terminal
471
+ ##
472
+ ## @param question (String) The question to ask
473
+ ## @param default (Bool) default response if no input
474
+ ##
475
+ ## @return (Bool) yes or no
476
+ ##
477
+ def yn(question, default_response=false)
478
+ if default_response
479
+ default = 'y'
480
+ else
481
+ default = 'n'
482
+ end
483
+ # if this isn't an interactive shell, answer default
484
+ unless $stdout.isatty
485
+ if default.downcase == 'y'
486
+ return true
487
+ else
488
+ return false
489
+ end
490
+ end
491
+ # clear the buffer
492
+ if ARGV.length
493
+ ARGV.length.times do
494
+ ARGV.shift
495
+ end
496
+ end
497
+ system 'stty cbreak'
498
+ if default
499
+ if default =~ /y/i
500
+ options = "#{colors['white']}[#{colors['boldgreen']}Y#{colors['white']}/#{colors['boldwhite']}n#{colors['white']}]#{colors['default']}"
501
+ else
502
+ options = "#{colors['white']}[#{colors['boldwhite']}y#{colors['white']}/#{colors['boldgreen']}N#{colors['white']}]#{colors['default']}"
503
+ end
504
+ else
505
+ options = "#{colors['white']}[#{colors['boldwhite']}y#{colors['white']}/#{colors['boldwhite']}n#{colors['white']}]#{colors['default']}"
506
+ end
507
+ $stdout.syswrite "#{colors['boldwhite']}#{question.sub(/\?$/,'')} #{options}#{colors['boldwhite']}?#{colors['default']} "
508
+ res = $stdin.sysread 1
509
+ puts
510
+ system 'stty cooked'
511
+
512
+ res.chomp!
513
+ res.downcase!
514
+
515
+ res = default.downcase if res == ""
516
+
517
+ return res =~ /y/i
518
+ end
519
+
467
520
  ##
468
521
  ## @brief Attempt to match a string with an existing view
469
522
  ##
@@ -507,7 +560,7 @@ class WWID
507
560
  opt[:back] ||= Time.now
508
561
  opt[:timed] ||= false
509
562
 
510
- title = [title.strip.cap_first] + @config['default_tags'].map{|t| '@' + t.sub(/^ *@/,'').chomp}
563
+ title = [title.strip.cap_first]
511
564
  title = autotag(title.join(' '))
512
565
  unless @config['default_tags'].empty?
513
566
  title += @config['default_tags'].map{|t|
@@ -516,7 +569,7 @@ class WWID
516
569
  if title =~ /@#{dt}/
517
570
  ""
518
571
  else
519
- '@' + dt
572
+ ' @' + dt
520
573
  end
521
574
  end
522
575
  }.delete_if {|t| t == "" }.join(" ")
@@ -1595,6 +1648,11 @@ EOS
1595
1648
  done = nil
1596
1649
  start = nil
1597
1650
 
1651
+ if @interval_cache.keys.include? item['title']
1652
+ seconds = @interval_cache[item['title']]
1653
+ return seconds > 0 ? "%02d:%02d:%02d" % fmt_time(seconds) : false
1654
+ end
1655
+
1598
1656
  if item['title'] =~ /@done\((\d{4}-\d\d-\d\d \d\d:\d\d.*?)\)/
1599
1657
  done = Time.parse($1)
1600
1658
  else
@@ -1618,6 +1676,8 @@ EOS
1618
1676
  end
1619
1677
  }
1620
1678
 
1679
+ @interval_cache[item['title']] = seconds
1680
+
1621
1681
  return seconds unless formatted
1622
1682
 
1623
1683
  seconds > 0 ? "%02d:%02d:%02d" % fmt_time(seconds) : false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.22
4
+ version: 1.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-08 00:00:00.000000000 Z
11
+ date: 2020-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake