File: CmdHelp.cpp

package info (click to toggle)
timew 1.1.1%2Bds.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,348 kB
  • sloc: cpp: 22,428; python: 3,612; sh: 111; makefile: 15
file content (960 lines) | stat: -rw-r--r-- 50,103 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// http://www.opensource.org/licenses/mit-license.php
//
////////////////////////////////////////////////////////////////////////////////

#include <cmake.h>
#include <commands.h>
#include <iostream>

////////////////////////////////////////////////////////////////////////////////
int CmdHelpUsage (const Extensions& extensions)
{
  // TODO This is going to need more formatting.
  // TODO Align the arg types?
  std::cout << '\n'
            << "Usage: timew [--version]\n"
            << "       timew cancel\n"
            << "       timew config [<name> [<value | '']]\n"
            << "       timew continue [@<id>] [<date>|<interval>]\n"
            << "       timew day [<interval>] [<tag> ...]\n"
            << "       timew delete @<id> [@<id> ...]\n"
            << "       timew diagnostics\n"
            << "       timew export [<interval>] [<tag> ...]\n"
            << "       timew extensions\n"
/*
            << "       timew fill @<id> [@<id> ...]\n"
*/
            << "       timew gaps [<interval>] [<tag> ...]\n"
            << "       timew get <DOM> [<DOM> ...]\n"
            << "       timew help [<command> | interval | hints | date | duration]\n"
            << "       timew join @<id> @<id>\n"
            << "       timew lengthen @<id> [@<id> ...] <duration>\n"
            << "       timew month [<interval>] [<tag> ...]\n"
            << "       timew move @<id> <date>\n"
            << "       timew [report] <report> [<interval>] [<tag> ...]\n"
            << "       timew shorten @<id> [@<id> ...] <duration>\n"
            << "       timew show\n"
            << "       timew split @<id> [@<id> ...]\n"
            << "       timew start [<date>] [<tag> ...]\n"
            << "       timew stop [<tag> ...]\n"
            << "       timew summary [<interval>] [<tag> ...]\n"
            << "       timew tag @<id> [@<id> ...] <tag> [<tag> ...]\n"
            << "       timew tags [<interval>] [<tag> ...]\n"
            << "       timew track <interval> [<tag> ...]\n"
            << "       timew untag @<id> [@<id> ...] <tag> [<tag> ...]\n"
            << "       timew week [<interval>] [<tag> ...]\n"
            << '\n';

  if (extensions.all ().size ())
  {
    std::cout << "Extensions (extensions do not provide help):\n";

    for (auto& ext : extensions.all ())
      std::cout << "       " << File (ext).name () << '\n';

    std::cout << '\n';
  }

  std::cout << "Additional help:\n"
            << "       timew help <command>\n"
            << "       timew help interval\n"
            << "       timew help hints\n"
            << "       timew help date\n"
            << "       timew help duration\n"
            << "       timew help dom\n"
            << '\n'
            << "Interval:\n"
            << "       [from] <date>\n"
            << "       [from] <date> to/- <date>\n"
            << "       [from] <date> for <duration>\n"
            << "       <duration> before/after <date>\n"
            << "       <duration> ago\n"
            << "       [for] <duration>\n"
            << '\n'
            << "Tag:\n"
            << "       Word\n"
            << "       'Single Quoted Words'\n"
            << "       \"Double Quoted Words\"\n"
            << "       Escaped\\ Spaces\n"
            << '\n'
            << "Configuration overrides:\n"
            << "       rc.<name>=<value>\n"
            << '\n';

  // TODO List all extensions.

  return 0;
}

////////////////////////////////////////////////////////////////////////////////
// TODO Should the CmdXxx functions themselves be responsible for providing both
//      the command syntax and the help text?
//      A: Only if they are upgraded to objects.
//
// Strict 80-character limit.
// Provide examples where appropriate - enough to cover all uses.
int CmdHelp (
  const CLI& cli,
  const Extensions& extensions)
{
  auto words = cli.getWords ();
  if (words.size ())
  {
    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    if (words[0] == "cancel")
      std::cout << '\n'
                << "Syntax: timew cancel\n"
                << '\n'
                << "If there is an open interval, it is abandoned.\n"
                << '\n'
                << "See also 'start', 'stop', 'delete'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "config")
      std::cout << '\n'
                << "Syntax: timew config [<name> [<value> | '']]\n"
                << '\n'
                << "Allows setting and removing configuration values, as an alternative to directly\n"
                << "editing your ~/.timewarrior/timewarrior.cfg file. For example:\n"
                << '\n'
                << "  $ timew config verbose yes\n"
                << "  $ timew config verbose ''\n"
                << "  $ timew config verbose\n"
                << '\n'
                << "The first command sets 'verbose' to 'yes'. The second sets it to a blank value\n"
                << "which overrides the default value. The third example deletes the 'verbose'\n"
                << "setting.\n"
                << '\n'
                << "When modifying configuration in this way, interactive confirmation will be\n"
                << "sought. To override this confirmation, use the ':yes' hint, which means you\n"
                << "intend to answer 'yes' to the confirmation questions:\n"
                << '\n'
                << "  $ timew config verbose '' :yes\n"
                << '\n'
                << "If no arguments are provided, all configuration settings are shown:\n"
                << '\n'
                << "  $ timew config\n"
                << "  verbose = yes\n"
                << "  ...\n"
                << '\n'
                << "See also 'hints', 'show'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "continue")
      std::cout << '\n'
                << "Syntax: timew continue [<ID>] [<date>|<interval>]\n"
                << '\n'
                << "Resumes tracking of a closed interval. For example:\n"
                << '\n'
                << "  $ timew track 9am - 10am tag1 tag2\n"
                << "  $ timew continue\n"
                << '\n'
                << "This continues the most recent interval. One can refer to another closed\n"
                << "interval by referencing its id:\n"
                << '\n'
                << "  $ timew track 9am - 10am tag1 tag2\n"
                << "  $ timew track 11am - 1pm tag3\n"
                << "  $ timew continue @2\n"
                << '\n'
                << "The 'continue' command creates a new interval, starting now, and using the tags\n"
                << "'tag1' and 'tag2'. (Using the 'summary' command and specifying the ':ids' hint\n"
                << "shows interval IDs.) Independently from an ID, one can specify a new start time\n"
                << "or an interval range:\n"
                << '\n'
                << "  $ timew continue @2 4min ago\n"
                << '\n'
                << "This continues the interval referenced by ID 2 with a new start time (4 minutes\n"
                << "before now)\n"
                << '\n'
                << "  $ timew continue 18pm - 19pm\n"
                << '\n'
                << "This adds a copy of the latest interval with a new interval range.\n"
                << '\n'
                << "'continue' is a convenient way to resume work without re-entering the tags.\n"
                << '\n'
                << "See also 'start', 'stop'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "date")
      std::cout << '\n'
                << "Timewarrior supports the following date formats based on ISO-8601:\n"
                << '\n'
                << "  <extended-date> [T <extended-time>]   Extended date, optional extended time\n"
                << "  <date> [T <time>]                     Date, optional time\n"
                << "  <extended-time>                       Extended time\n"
                << "  <time>                                Time\n"
                << '\n'
                << "  extended-date:\n"
                << "    YYYY-MM-DD                          Year, month, day\n"
                << "    YYYY-MM                             Year, month, 1st\n"
                << "    YYYY-DDD                            Year, Julian day 001-366\n"
                << "    YYYY-WwwD                           Year, week number, day number\n"
                << "    YYYY-Www                            Year, week number, day 1\n"
                << '\n'
                << "  extended-time:\n"
                << "    hh:mm[:ss]Z                         Hours, minutes, optional seconds, UTC\n"
                << "    hh:mm[:ss][+/-hh:mm]                Hours, minutes, optional seconds, TZ\n"
                << '\n'
                << "  date:\n"
                << "    YYYYMMDD                            Year, month, day\n"
                << "    YYYYWww                             Year, week number, day number\n"
                << "    YYYYDDD                             Year, Julian day 001-366\n"
                << '\n'
                << "  time:\n"
                << "    hhmm[ss]Z                           Hour, minutes, optional seconds, UTC\n"
                << "    hhmm[ss][+/-hh[mm]]                 Hour, minutes, optional seconds, TZ\n"
                << '\n'
                << "Examples:\n"
                << "  2016-06-09T08:12:00Z\n"
                << "  2016-06T08:12:00+01:00\n"
                << "  2016-06T08:12Z\n"
                << "  2016-161\n"
                << "  2016-W244\n"
                << "  2016-W24\n"
                << "  20160609T081200Z\n"
                << "  2016W24\n"
                << "  8:12:00Z\n"
                << "  0812-0500\n"
                << '\n'
                << "In addition to the standard date formats, the following are supported:\n"
                << '\n'
                << "  now                                   Current date and time\n"
                << "  today                                 Current date at 0:00:00\n"
                << "  sod, eod                              Current date at 0:00:00 and 24:00:00\n"
                << "  yesterday                             Yesterday at 0:00:00\n"
                << "  tomorrow                              Tomorrow at 0:00:00 (midnight tonight)\n"
                << "  <day-of-week>                         Previous named day at 0:00:00\n"
                << "  <month-of-year>                       Previous 1st of the  month at 0:00:00\n"
                << "  hh:mm[:ss][am|a|pm|p]                 Short time format\n"
                << "  Nst, Nnd, Nrd, Nth                    Previous 1st, 2nd, 3rd ...\n"
                << "  <epoch>                               POSIX time\n"
                << "  later                                 2038-01-18T0:00:00 (Y2K38)\n"
                << "  someday                               2038-01-18T0:00:00 (Y2K38)\n"
                << "  sopd, eopd                            Start/end of previous day\n"
                << "  sod, eod                              Start/end of current day\n"
                << "  sond, eond                            Start/end of next day\n"
                << "  sopw, eopw                            Start/end of previous week\n"
                << "  sow, eow                              Start/end of current week\n"
                << "  sonw, eonw                            Start/end of next week\n"
                << "  sopww, eopww                          Start/end of previous work week (mon - fri)\n"
                << "  soww, eoww                            Start/end of current work week (mon - fri)\n"
                << "  sonww, eonww                          Start/end of next work week (mon - fri)\n"
                << "  sopm, eopm                            Start/end of previous month\n"
                << "  som, eom                              Start/end of current month\n"
                << "  sonm, eonm                            Start/end of next month\n"
                << "  sopq, eopq                            Start/end of previous quarter\n"
                << "  soq, eoq                              Start/end of current quarter\n"
                << "  sonq, eonq                            Start/end of next quarter\n"
                << "  sopy, eopy                            Start/end of previous year\n"
                << "  soy, eoy                              Start/end of current year\n"
                << "  sony, eony                            Start/end of next year\n"
                << "  easter                                Easter Sunday\n"
                << "  eastermonday                          Easter Monday\n"
                << "  ascension                             Ascension\n"
                << "  pentecost                             Pentecost\n"
                << "  goodfriday                            Good Friday\n"
                << "  midsommar                             midnight, 1st Saturday after 20th June\n"
                << "  midsommarafton                        midnight, 1st Friday after 19th June\n"
                << "  juhannus                              midnight, 1st Friday after 19th June\n"
                << '\n'
                << "Examples:\n"
                << "  8am\n"
                << "  24th\n"
                << "  monday\n"
                << "  august\n"
                << '\n'
                << "See also 'duration', 'hints'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "duration")
      std::cout << '\n'
                << "Timewarrior supports the following duration formats based on ISO-8601:\n"
                << '\n'
                << "  'P' [nn 'Y'] [nn 'M'] [nn 'D'] ['T' [nn 'H'] [nn 'M'] [nn 'S']]\n"
                << "  PnnW\n"
                << '\n'
                << "Examples:\n"
                << "  P1Y           1 year\n"
                << "  P1.5M         1.5 months\n"
                << "  PT1S          1 second\n"
                << "  PT4.5H        4.5 hours\n"
                << "  PT4H30M       4.5 hours\n"
                << "  P600D         600 days\n"
                << "  P3W           3 weeks\n"
                << "  P1Y1DT1H1M1S  1 year and 25 hours, 61 seconds (imprecise term)\n"
                << '\n'
                << "  Note that the year and month terms are imprecise, being defined as 365d and\n"
                << "  30d respectively. For precision use the other terms.\n"
                << '\n'
                << "In addition to the standard duration formats, the following are supported:\n"
                << '\n'
                << "  n[.n]<unit>\n"
                << '\n'
                << "Where the <unit> is one of:\n"
                << '\n'
                << "  annual\n"
                << "  biannual\n"
                << "  bimonthly\n"
                << "  biweekly\n"
                << "  biyearly\n"
                << "  daily\n"
                << "  days, day, d\n"
                << "  fortnight\n"
                << "  hours, hour, hrs, hr, h\n"
                << "  minutes, minute, mins, min\n"
                << "  monthly, months, month, mnths, mths, mth, mos, mo, m\n"
                << "  quarterly, quarters, quarter, qrtrs, qtr, q\n"
                << "  semiannual\n"
                << "  sennight\n"
                << "  seconds, second, secs, sec, s\n"
                << "  weekdays\n"
                << "  weekly, weeks, week, wks, wk, w\n"
                << "  yearly, years, year, yrs, yr, y\n"
                << '\n'
                << "Examples:\n"
                << "  1hour         60 minutes\n"
                << "  1.5h          90 minutes\n"
                << "  3mo           3 months\n"
                << "  10d           10 days\n"
                << '\n'
                << "  Note that the year, quarter and month terms are imprecise, being defined as\n"
                << "  365d, 91d and 30d respectively. For precision use the other terms.\n"
                << '\n'
                << "See also 'date', 'hints'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "day")
      std::cout << '\n'
                << "Syntax: timew day [<interval>] [<tag> ...]\n"
                << '\n'
                << "The day command shows a chart depicting a single day (today by default), with\n"
                << "colored blocks drawn on a timeline. The chart summarizes the tracked and\n"
                << "untracked time.\n"
                << '\n'
                << "Accepts date ranges and tags for filtering, or shortcut hints:\n"
                << '\n'
                << "  $ timew day monday - today\n"
                << "  $ timew day :week\n"
                << "  $ timew day :month\n"
                << '\n'
                << "The 'reports.day.range' configuration setting overrides the default date range.\n"
                << "The default date range shown is ':day'.\n"
                << '\n'
                << "The ':blank' hint causes only the excluded time to be shown, with no tracked\n"
                << "time. This can be used to see the exclusions.\n"
                << '\n'
                << "For more details, and precise times, use the 'summary' report.\n"
                << '\n'
                << "See also 'week', 'month', 'summary'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "delete")
      std::cout << '\n'
                << "Syntax: timew delete @<id> [@<id> ...]\n"
                << '\n'
                << "Deletes an interval. Using the 'summary' command, and specifying the ':ids' hint\n"
                << "shows interval IDs. Using the right ID, you can identify an interval to delete.\n"
                << "For example, show the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to delete:\n"
                << '\n'
                << "  $ timew delete @2\n"
                << '\n'
                << "See also 'cancel'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "diagnostics")
      std::cout << '\n'
                << "Syntax: timew diagnostics\n"
                << '\n'
                << "This command shows details about your version of Timewarrior, your platform, how\n"
                << "it was built, compiler features, configuration, file access, extensions and more.\n"
                << '\n'
                << "The purpose of this command is to help diagnose configuration problems and\n"
                << "provide supplemental information when reporting a problem.\n"
                << '\n'
                << "See also 'extensions'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "dom")
      std::cout << '\n'
                << "Supported DOM references are:\n"
                << '\n'
                << "  dom.tag.count             Count of all tags\n"
                << "  dom.tag.1                 Nth tag used\n"
                << '\n'
                << "  dom.active                '1' if there is active tracking, otherwise '0'\n"
                << "  dom.active.tag.count      Count of active tags\n"
                << "  dom.active.tag.1          Active Nth tag\n"
                << "  dom.active.start          Active start timestamp (ISO Extended local date)\n"
                << "  dom.active.duration       Active elapsed (ISO Period)\n"
                << "  dom.active.json           Active interval as JSON\n"
                << '\n'
                << "  dom.tracked.count         Count of tracked intervals\n"
                << "  dom.tracked.1.tag.count   Count of active tags\n"
                << "  dom.tracked.1.tag.1       Tracked Nth, Nth tag\n"
                << "  dom.tracked.1.start       Tracked Nth, start time\n"
                << "  dom.tracked.1.end         Tracked Nth, end time, blank if closed\n"
                << "  dom.tracked.1.duration    Tracked Nth, elapsed\n"
                << "  dom.tracked.1.json        Tracked Nth, interval as JSON\n"
                << '\n'
                << "  dom.rc.<name>             Configuration setting\n"
                << '\n'
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "export")
      std::cout << '\n'
                << "Syntax: timew export [<interval>] [<tag> ...]\n"
                << '\n'
                << "Exports all the tracked time in JSON format. Supports filtering. For example:\n"
                << '\n'
                << "  $ timew export from 2016-01-01 for 3wks tag1\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "extensions")
      std::cout << '\n'
                << "Syntax: timew extensions\n"
                << '\n'
                << "Displays the directory containing the extension programs and a table showing\n"
                << "each extensions and its status.\n"
                << '\n'
                << "See also 'diagnostics'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
/*
    else if (words[0] == "fill")
      std::cout << '\n'
                << "Syntax: timew fill @<id> [@<id> ...]\n"
                << '\n'
                << "The 'fill' command is used to adjust any interval to fill in surrounding gaps.\n"
                << "Using the 'summary' command, and specifying the ':ids' hint shows interval IDs.\n"
                << "Using the right ID, you can identify an interval to fill. For example, show\n"
                << "the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to fill:\n"
                << '\n'
                << "  $ timew fill @2\n"
                << '\n'
                << "Note that you can fill multiple intervals:\n"
                << '\n'
                << "  $ timew fill @2 @10 @23\n"
                << '\n'
                << "See also 'hints'.\n"
                << '\n';
*/

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "gaps")
      std::cout << '\n'
                << "Syntax: timew gaps [<interval>] [<tag> ...]\n"
                << '\n'
                << "Displays a summary of time that is neither tracked nor excluded from tracking.\n"
                << '\n'
                << "The 'reports.gaps.range' configuration setting overrides the default date range.\n"
                << "The default date range shown is ':day'.\n"
                << '\n'
                << "The ':blank' hint causes only the excluded time to be shown, with no tracked\n"
                << "time.\n"
                << '\n'
                << "See also 'summary'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "get")
      std::cout << '\n'
                << "Syntax: timew get <DOM> [<DOM> ...]\n"
                << '\n'
                << "Validates the DOM reference, then obtains the value and displays it. For\n"
                << "example:\n"
                << '\n'
                << "  $ timew get dom.active\n"
                << "  1\n"
                << '\n'
                << "It is an error to reference an interval or tag that does not exist.\n"
                << '\n'
                << "See also 'dom'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "help")
      std::cout << '\n'
                << "Syntax: timew help [<command> | interval | hints | date | duration]\n"
                << "The help command shows detailed descriptions and examples of commands,\n"
                << "interval syntax, supported hints, date and duration formats and DOM references.\n"
                << "For example:\n"
                << '\n'
                << "  $ timew help\n"
                << "  $ timew help start\n"
                << "  $ timew help hints\n"
                << "  $ timew help interval\n"
                << "  $ timew help date\n"
                << "  $ timew help duration\n"
                << "  $ timew help dom\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "hints")
      std::cout << '\n'
                << "Timewarrior supports hints, which are single-word command line features that\n"
                << "start with a colon like this:\n"
                << '\n'
                << "  :week\n"
                << '\n'
                << "Hints serve several purposes. This example is a shortcut for the date range\n"
                << "that defines the current week. Other hints, such as:\n"
                << '\n'
                << "  :quiet\n"
                << '\n'
                << "are ways to control the behavior of Timewarrior, in this case eliminating all\n"
                << "forms of feedback, for purposes of automation. The supported hints are:\n"
                << '\n'
                << "  :quiet         Turns off all feedback. For automation\n"
                << "  :debug         Runs in debug mode, shows many runtime details\n"
                << "  :yes           Overrides confirmation by answering 'yes' to the questions\n"
                << '\n'
                << "  :color         Force color on, even if not connected to a TTY\n"
                << "  :nocolor       Force color off, even if connected to a TTY\n"
                << "  :blank         Leaves tracked time out of a report\n"
                << "  :fill          Expand time to fill surrounding available gap\n"
                << "  :adjust        Automatically correct overlaps\n"
                << "  :ids           Displays interval ID numbers in the summary report\n"
                << '\n'
                << "Range hints provide convenient shortcuts to date ranges:\n"
                << '\n'
                << "  :yesterday     The 24 hours of the previous day\n"
                << "  :day           The 24 hours of the current day\n"
                << "  :week          This week\n"
                << "  :month         This month\n"
                << "  :quarter       This quarter\n"
                << "  :year          This year\n"
                << "  :lastweek      Last week\n"
                << "  :lastmonth     Last month\n"
                << "  :lastquarter   Last quarter\n"
                << "  :lastyear      Last year\n"
                << "  :monday        Previous monday\n"
                << "  :tuesday       Previous tuesday\n"
                << "  :wednesday     Previous wednesday\n"
                << "  :thursday      Previous thursday\n"
                << "  :friday        Previous friday\n"
                << "  :saturday      Previous saturday\n"
                << "  :sunday        Previous sunday\n"
                << '\n'
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "interval")
      std::cout << '\n'
                << "An interval defines a block of time that is tracked. The syntax for specifying\n"
                << "an interval is flexible, and may be one of:\n"
                << '\n'
                << "  [from] <date>\n"
                << "  [from] <date> to/- <date>\n"
                << "  [from] <date> for <duration>\n"
                << "  <duration> before/after <date>\n"
                << "  <duration> ago\n"
                << "  [for] <duration>\n"
                << '\n'
                << "Examples are:\n"
                << '\n'
                << "  from 9:00\n"
                << "  from 9am - 11am\n"
                << "  from 9:00:00 to 11:00\n"
                << "  from 9:00 for 2h\n"
                << "  2h after 9am\n"
                << "  2h before 11:00\n"
                << "  2h ago\n"
                << "  for 2h\n"
                << '\n'
                << "An interval is said to be 'closed' if there is both a start and end, and 'open'\n"
                << "if there is no end date.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "join")
      std::cout << '\n'
                << "Syntax: timew join @<id> @<id>\n"
                << '\n'
                << "Joins two intervals, by using the earlier of the two start times, and the later\n"
                << "of the two end times, and the combined set of tags. Using the 'summary' command,\n"
                << "and specifying the ':ids' hint shows interval IDs. Using the correct IDs, you\n"
                << "can identify an intervals to join. For example, show the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@1' and '@2' as the intervals you wish to join:\n"
                << '\n'
                << "  $ timew join @1 @2\n"
                << '\n'
                << "See also 'split', 'lengthen', 'shorten'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "lengthen")
      std::cout << '\n'
                << "Syntax: timew lengthen @<id> [@<id> ...] <duration>\n"
                << '\n'
                << "The 'lengthen' command is used to defer the end date of a closed interval.\n"
                << "Using the 'summary' command, and specifying the ':ids' hint shows interval IDs.\n"
                << "Using the right ID, you can identify an interval to lengthen. For example, show\n"
                << "the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to lengthen:\n"
                << '\n'
                << "  $ timew lengthen @2 10mins\n"
                << '\n'
                << "Note that you can lengthen multiple intervals:\n"
                << '\n'
                << "  $ timew lengthen @2 @10 @23 1hour\n"
                << '\n'
                << "See also 'summary', 'tag', 'untag', 'shorten'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "month")
      std::cout << '\n'
                << "Syntax: timew month [<interval>] [<tag> ...]\n"
                << '\n'
                << "The month command shows a chart depicting a single month (current month by\n"
                << "default), with colored blocks drawn on a timeline. The chart summarizes the\n"
                << "tracked and untracked time.\n"
                << '\n'
                << "Accepts date ranges and tags for filtering, or shortcut hints:\n"
                << '\n'
                << "  $ timew month 1st - today\n"
                << "  $ timew month :week\n"
                << '\n'
                << "The 'reports.month.range' configuration setting overrides the default date range.\n"
                << "The default date range shown is ':month'.\n"
                << '\n'
                << "The ':blank' hint causes only the excluded time to be shown, with no tracked\n"
                << "time.\n"
                << '\n'
                << "For more details, and precise times, use the 'summary' report.\n"
                << '\n'
                << "See also 'day', 'week', 'summary'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "move")
      std::cout << '\n'
                << "Syntax: timew move @<id> <date>\n"
                << '\n'
                << "The 'move' command is used to reposition an interval at a new start time.\n"
                << "Using the 'summary' command, and specifying the ':ids' hint shows interval IDs.\n"
                << "Using the right ID, you can identify an interval to move. For example, show\n"
                << "the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to move:\n"
                << '\n'
                << "  $ timew move @2 9am\n"
                << '\n'
                << "See also 'summary', 'tag', 'untag', 'lengthen', 'shorten'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "report")
      std::cout << '\n'
                << "Syntax: timew [report] <report> [<interval>] [<tag> ...]\n"
                << '\n'
                << "Runs an extension report, and supports filtering data.\n"
                << "The 'report' command itself is optional, which means that these two commands\n"
                << "are equivalent:\n"
                << '\n'
                << "  $ timew report foo :week\n"
                << "  $ timew        foo :week\n"
                << '\n'
                << "This does however assume there is a 'foo' extension installed.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "shorten")
      std::cout << '\n'
                << "Syntax: timew shorten @<id> [@<id> ...] <duration>\n"
                << '\n'
                << "The 'shorten' command is used to advance the end date of a closed interval.\n"
                << "Using the 'summary' command, and specifying the ':ids' hint shows interval IDs.\n"
                << "Using the right ID, you can identify an interval to shorten. For example, show\n"
                << "the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to shorten:\n"
                << '\n'
                << "  $ timew shorten @2 10mins\n"
                << '\n'
                << "Note that you can shorten multiple intervals:\n"
                << '\n'
                << "  $ timew shorten @2 @10 @23 1hour\n"
                << '\n'
                << "See also 'summary', 'tag', 'untag', 'lengthen'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "show")
      std::cout << '\n'
                << "Syntax: timew show\n"
                << '\n'
                << "Displays the effective configuration in hierarchical form.\n"
                << '\n'
                << "See also 'config'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "split")
      std::cout << '\n'
                << "Syntax: timew split @<id> [@<id> ...]\n"
                << '\n'
                << "Š…plits an interval into two equally sized adjacent intervals, having the same\n"
                << "tags. Using the 'summary' command, and specifying the ':ids' hint shows interval\n"
                << " IDs. Using the right ID, you can identify an interval to split. For example,\n"
                << "show the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to split:\n"
                << '\n'
                << "  $ timew split @2\n"
                << '\n'
                << "See also 'join', 'lengthen', 'shorten'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "start")
      std::cout << '\n'
                << "Syntax: timew start [<date>] [<tag> ...]\n"
                << '\n'
                << "Begins tracking using the current time with any specified set of tags. If a tag\n"
                << "contains multiple words, therefore containing spaces, use quotes to surround the\n"
                << "whole tag. For example, this command specifies two tags ('weekend' and\n"
                << "'Home & Garden'), the second of which requires quotes.\n"
                << '\n'
                << "  $ timew start weekend 'Home & Garden'\n"
                << '\n'
                << "An optional date may be specified to indicate the intended start of the tracked\n"
                << "time:\n"
                << '\n'
                << "  $ time start 8am weekend 'Home & Garden'\n"
                << '\n'
                << "If there is a previous open interval, it will be closed at the given start time.\n"
                << '\n'
                << "Quotes are harmless if used unnecessarily.\n"
                << '\n'
                << "See also 'continue', 'stop', 'track'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "stop")
      std::cout << '\n'
                << "Syntax: timew stop [<tag> ...]\n"
                << '\n'
                << "Stops tracking time.  If tags are specified, then they are no longer tracked.\n"
                << "If no tags are specified, all tracking stops. For example:\n"
                << '\n'
                << "  $ timew start tag1 tag2\n"
                << "  ...\n"
                << "  $ timew stop tag1\n"
                << '\n'
                << "Initially time is tracked for both 'tag1' and 'tag2', then 'tag1' tracking is\n"
                << "stopped, leaving tag2 active. To stop all tracking:\n"
                << '\n'
                << "  $ timew stop\n"
                << '\n'
                << "See also 'cancel', 'continue', 'start', 'track'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "summary")
      std::cout << '\n'
                << "Syntax: timew summary [<interval>] [<tag> ...]\n"
                << '\n'
                << "Displays a report summarizing tracked and untracked time for the current day by\n"
                << "default. Accepts date ranges and tags for filtering, or shortcut hints:\n"
                << '\n'
                << "  $ timew summary monday - today\n"
                << "  $ timew summary :week\n"
                << "  $ timew summary :month\n"
                << '\n'
                << "The ':ids' hint adds an 'ID' column to the summary report output for interval\n"
                << "modification.\n"
                << '\n'
                << "See also 'day', 'week', 'month', 'shorten', 'lengthen', 'tag', 'untag'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "tag")
      std::cout << '\n'
                << "Syntax: timew tag @<id> [@<id> ...] <tag> [<tag> ...]\n"
                << '\n'
                << "The 'tag' command is used to add a tag to an interval. Using the 'summary'\n"
                << "command, and specifying the ':ids' hint shows interval IDs. Using the right ID,\n"
                << "you can identify an interval to tag. For example, show the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to tag:\n"
                << '\n'
                << "  $ timew tag @2 'New Tag'\n"
                << '\n'
                << "Note that you can tag multiple intervals, with multiple tags:\n"
                << '\n'
                << "  $ timew tag @2 @10 @23 'Tag One' tag2 tag3\n"
                << '\n'
                << "See also 'summary', 'shorten', 'lengthen', 'untag'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "tags")
      std::cout << '\n'
                << "Syntax: timew tags [<interval>] [<tag> ...]\n"
                << '\n'
                << "Displays all the tags that have been used by default. When a filter is specified,\n"
                << "shows only the tags that were used during that time.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "track")
      std::cout << '\n'
                << "Syntax: timew track <interval> [<tag> ...]\n"
                << '\n'
                << "The track command is used to add tracked time in the past. Perhaps you forgot\n"
                << "to record time, or are just filling in old entries. For example:\n"
                << '\n'
                << "  $ timew track :yesterday 'Training Course'\n"
                << "  $ timew track 9am - 11am 'Staff Meeting'\n"
                << '\n'
                << "Note that the track command expects a closed interval (start and end time), when\n"
                << "recording. If a closed interval is not provided, the 'track' command behaves the\n"
                << "same as the 'start' command.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "untag")
      std::cout << '\n'
                << "Syntax: timew untag @<id> [@<id> ...] <tag> [<tag> ...]\n"
                << '\n'
                << "The 'untag' command is used to removed a tag from an interval. Using the\n"
                << "'summary' command, and specifying the ':ids' hint shows interval IDs. Using the\n"
                << "right ID, you can identify an interval to untag. For example, show the IDs:\n"
                << '\n'
                << "  $ timew summary :week :ids\n"
                << '\n'
                << "Then having selected '@2' as the interval you wish to tag:\n"
                << '\n'
                << "  $ timew untag @2 'Old Tag'\n"
                << '\n'
                << "Note that you can untag multiple intervals, with multiple tags:\n"
                << '\n'
                << "  $ timew untag @2 @10 @23 'Old Tag' tag2 tag3\n"
                << '\n'
                << "See also 'summary', 'shorten', 'lengthen', 'tag'.\n"
                << '\n';

    // Ruler                 1         2         3         4         5         6         7         8
    //              12345678901234567890123456789012345678901234567890123456789012345678901234567890
    else if (words[0] == "week")
      std::cout << '\n'
                << "Syntax: timew week [<interval>] [<tag> ...]\n"
                << '\n'
                << "The week command shows a chart depicting a single week (current week by\n"
                << "default), with colored blocks drawn on a timeline. The chart summarizes the\n"
                << "tracked and untracked time.\n"
                << '\n'
                << "Accepts date ranges and tags for filtering, or shortcut hints:\n"
                << '\n'
                << "  $ timew week\n"
                << "  $ timew week monday - today\n"
                << '\n'
                << "The 'reports.week.range' configuration setting overrides the default date range.\n"
                << "The default date range shown is ':week'.\n"
                << '\n'
                << "The ':blank' hint causes only the excluded time to be shown, with no tracked\n"
                << "time.\n"
                << '\n'
                << "For more details, and precise times, use the 'summary' report.\n"
                << '\n'
                << "See also 'day', 'month', 'summary'.\n"
                << '\n';

    else
      std::cout << "No help available for '" << words[0] << "'\n";

    return 0;
  }

  return CmdHelpUsage (extensions);
}

////////////////////////////////////////////////////////////////////////////////