dsu 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -2
- data/Gemfile.lock +1 -1
- data/README.md +121 -73
- data/lib/dsu/base_cli.rb +2 -2
- data/lib/dsu/cli.rb +18 -19
- data/lib/dsu/subcommands/base_subcommand.rb +0 -2
- data/lib/dsu/subcommands/delete.rb +8 -8
- data/lib/dsu/subcommands/list.rb +9 -9
- data/lib/dsu/support/command_help_colorizeable.rb +7 -0
- data/lib/dsu/support/command_options/dsu_times.rb +8 -8
- data/lib/dsu/support/command_options/time_mnemonic.rb +108 -0
- data/lib/dsu/support/command_options/{time_mneumonics.rb → time_mnemonics.rb} +1 -1
- data/lib/dsu/version.rb +1 -1
- data/lib/locales/en/commands.yml +61 -15
- data/lib/locales/en/subcommands.yml +20 -20
- metadata +14 -24
- data/lib/dsu/support/command_options/time_mneumonic.rb +0 -108
- data/lib/dsu/support/subcommand_help_colorizeable.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f56239cec153192ff0f815e124e8001ab7676c418f334ff328512c6cfc11eeb4
|
4
|
+
data.tar.gz: d0072d4760663b70d32fa5695c6dbae27db960b95017a0a49598ef53a0bba588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e60d02338b12cd52c7f2a0b4f8f5f633879c6c3e7614b8fd1563d03348e778e9cb6f83a674e0be9bf53b5cac878e058d045834ce7c0f615e12129830fc2ca5b
|
7
|
+
data.tar.gz: d6807da2999520c94dbe54b5439b52a386701a20e0696e700028dac4de106ab14661ef8b5f133f7265da3994cf438bd089d2d9504314932d423464a2dfaae331
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## [2.1.2] 2023-12-17
|
2
|
+
|
3
|
+
Changes
|
4
|
+
|
5
|
+
- WIP, continued I18n integration. See [2.1.0] for more information.
|
6
|
+
- Removed shortcut mappings for all commands (see `dsu help`) to remove dash ("-") preceeding command shortcuts. For example, `dsu -a` (i.e. shortcut for `dsu add`) is now `dsu a`, `dsu -c` (i.e. shortcut for `dsu config`) is now `dsu c`, etc. This was done to avoid confusion as this format is typically used for options, not shortcut commands. The only exception is `dsu version` which will accept shortcuts `dsu v` and `dsu -v`, as `-v` is generally used to display version information.
|
7
|
+
- Various code refactors.
|
8
|
+
- Massive updates to README.md.
|
9
|
+
|
10
|
+
Bug fixes
|
11
|
+
|
12
|
+
- Fix bug that did not apply the current theme to `dsu help add` help.
|
13
|
+
|
1
14
|
## [2.1.1] 2023-12-17
|
2
15
|
|
3
16
|
Bug fixes
|
@@ -17,6 +30,7 @@ Bug fixes
|
|
17
30
|
|
18
31
|
Miscellaneous
|
19
32
|
|
33
|
+
- WIP, begin I18n support/integration.
|
20
34
|
- Update ruby gems.
|
21
35
|
- Updated README.md to reflect new `dsu delete` command.
|
22
36
|
- Fix rubocop violations.
|
@@ -112,11 +126,11 @@ See previous alpha releases for changes.
|
|
112
126
|
|
113
127
|
Changes
|
114
128
|
|
115
|
-
- For convenience, the `dsu list date` command now takes a
|
129
|
+
- For convenience, the `dsu list date` command now takes a MNEMONIC in addition to a DATE. See `dsu list help date` for more information.
|
116
130
|
|
117
131
|
Bug fixes
|
118
132
|
|
119
|
-
- Fix a bug that did not display `dsu list dates SUBCOMMAND` date list properly when the `--from` option was a date
|
133
|
+
- Fix a bug that did not display `dsu list dates SUBCOMMAND` date list properly when the `--from` option was a date mnemonic and the `--to` optoin was a relative time mnemonic (e.g. `dsu list dates -f today -t +1`). In this case, DSU dates `Time.now` and `Time.now.tomorrow` should be displayed; instead, the bug would consider the `--to` option as relative to `Time.now`, so only 1 DSU date (`Time.now` would be returned).
|
120
134
|
|
121
135
|
## [1.1.0.alpha.1] 2023-05-23
|
122
136
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# `dsu
|
1
|
+
# `dsu`- Streamline Your Daily Stand-Up Meeting Participation!
|
2
2
|
|
3
3
|
[![GitHub version](http://badge.fury.io/gh/gangelo%2Fdsu.svg)](https://badge.fury.io/gh/gangelo%2Fdsu)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/dsu.svg)](https://badge.fury.io/rb/dsu)
|
@@ -8,10 +8,25 @@
|
|
8
8
|
|
9
9
|
<img align="center" src="https://i.imgur.com/ff79twF.gif" alt="dsu" />
|
10
10
|
|
11
|
-
##
|
12
|
-
`dsu` is a
|
11
|
+
## Simplify Your Agile Routine
|
12
|
+
`dsu` is a sleek and powerful gem that transforms the way you participate in Agile Daily Stand-Ups (DSU). It's designed for developers who love simplicity and efficiency. With `dsu`, you get a user-friendly command-line interface to quickly manage your daily stand-up activities.
|
13
13
|
|
14
|
-
|
14
|
+
## Why dsu?
|
15
|
+
- **Organize Your Tasks:** Easily add, view, update, or delete your DSU entries.
|
16
|
+
- **Be Prepared:** Instantly list out your activities for "Yesterday" and plans for "Today" during stand-ups.
|
17
|
+
- **Smart Handling of Dates:** `dsu` intelligently includes your weekend and previous Friday activities when necessesary, so you're always ready to share comprehensive updates.
|
18
|
+
- **CLI Lovers Rejoice:** If you're a fan of simple command-line tools, `dsu` is a perfect fit.
|
19
|
+
|
20
|
+
### Getting Started Is Easy
|
21
|
+
Just run `gem install dsu` from your terminal, and you're on your way to more organized and efficient stand-ups. Check out the help section with `$ dsu help` for quick guidance.
|
22
|
+
|
23
|
+
## Engage with `dsu`
|
24
|
+
Found `dsu` helpful? Star it on GitHub and spread the word! Your feedback and contributions are welcome to make `dsu` even better.
|
25
|
+
|
26
|
+
## Quick Install
|
27
|
+
```shell
|
28
|
+
gem install dsu
|
29
|
+
```
|
15
30
|
|
16
31
|
## Help
|
17
32
|
|
@@ -21,69 +36,87 @@ After installation (`gem install dsu`), the first thing you may want to do is ru
|
|
21
36
|
```shell
|
22
37
|
#=>
|
23
38
|
Commands:
|
24
|
-
dsu add
|
25
|
-
dsu config
|
26
|
-
dsu delete
|
27
|
-
dsu edit
|
28
|
-
dsu help [COMMAND]
|
29
|
-
dsu info
|
30
|
-
dsu list
|
31
|
-
dsu theme
|
32
|
-
dsu version|-v
|
39
|
+
dsu add|a [OPTIONS] DESCRIPTION # Adds a DSU entry...
|
40
|
+
dsu config|c SUBCOMMAND # Manage configuration...
|
41
|
+
dsu delete|d SUBCOMMAND # Delete DSU entries...
|
42
|
+
dsu edit|e SUBCOMMAND # Edit DSU entries...
|
43
|
+
dsu help [COMMAND] # Describe available...
|
44
|
+
dsu info|i # Displays information...
|
45
|
+
dsu list|l SUBCOMMAND # Displays DSU entries...
|
46
|
+
dsu theme|t SUBCOMMAND # Manage DSU themes...
|
47
|
+
dsu version|-v|v # Displays this gem version
|
33
48
|
|
34
49
|
Options:
|
35
50
|
[--debug], [--no-debug]
|
36
51
|
```
|
37
52
|
|
38
|
-
|
53
|
+
# Using `dsu`
|
54
|
+
The folowing section outlines how to use the `dsu` gem.
|
39
55
|
|
40
56
|
## Adding DSU Entries
|
57
|
+
The next thing you may want to do is `add` some DSU activities (entries) for a particular day:
|
58
|
+
|
41
59
|
`dsu add [OPTIONS] DESCRIPTION`
|
60
|
+
`dsu a [OPTIONS] DESCRIPTION`
|
42
61
|
|
43
|
-
Adding DSU entry using this command will _add_ the DSU entry for the given day
|
62
|
+
Adding DSU entry using this command will _add_ the DSU entry for the given day or date, and then _display_ the DSU entries for that day or date.
|
63
|
+
|
64
|
+
**NOTE:** You cannot add duplicate entries for the same day; that is, entry DESCRIPTIONS need to be unique within an entry group for the given day.
|
44
65
|
|
45
66
|
### Today
|
46
|
-
If you need to add a DSU entry
|
67
|
+
If you need to add a DSU entry for the current day (today), you can use the `-n`|`--today` option. Today (`-n`) is the default; therefore, the `-n` flag is optional if you want to add a DSU entry for the _current day_ (today). For example, the below commands will both accomplish the same thing:
|
47
68
|
|
48
|
-
`$ dsu add -n
|
69
|
+
`$ dsu add [-n|--today] "Pair with John on ticket IN-12345"`
|
70
|
+
`$ dsu a "Pair with John on ticket IN-12345"`
|
49
71
|
|
50
72
|
### Yesterday
|
51
|
-
If for some reason you need to add a DSU entry for yesterday, you can use the `-y`| `--yesterday` option:
|
73
|
+
If for some reason you need to add a DSU entry for yesterday, you can use the `-y`| `--yesterday` option. Both of the below commands accomplish the same thing:
|
52
74
|
|
53
|
-
`$ dsu add
|
75
|
+
`$ dsu add --yesterday "Pick up ticket IN-12345"`
|
76
|
+
`$ dsu a -y "Pick up ticket IN-12345"`
|
54
77
|
|
55
78
|
### Tomorrow
|
56
79
|
If you need to add a DSU entry for tomorrow, you can use the `-t`|`--tomorrow` option:
|
57
80
|
|
58
|
-
`$ dsu add
|
81
|
+
`$ dsu add --tomorrow "Pick up ticket IN-12345"`
|
82
|
+
`$ dsu a -t "Pick up ticket IN-12345"`
|
59
83
|
|
60
84
|
### Miscellaneous Date
|
61
85
|
|
62
|
-
Both of the below examples will accomplish the same thing, assuming the current year is 2023; the current year is assumed
|
86
|
+
Both of the below examples will accomplish the same thing, assuming the current year is 2023; the current year is assumed when omitted:
|
87
|
+
|
88
|
+
**NOTE:** When **omitting year**, dates must be entered in `MM/DD` format.
|
89
|
+
**NOTE:** When **including year**, dates must be entered in `YYYY/MM/DD` format.
|
63
90
|
|
64
|
-
`$ dsu add
|
65
|
-
`$ dsu
|
91
|
+
`$ dsu add --date 2023/12/31 "Attend New Years Coffee Meet & Greet"`
|
92
|
+
`$ dsu a -d 12/31 "Attend New Years Coffee Meet & Greet"`
|
66
93
|
|
67
94
|
See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
|
68
95
|
|
69
96
|
## Displaying DSU Entries
|
70
|
-
You can display DSU entries for a particular day or date
|
97
|
+
You can display DSU entries for a particular day or date using any of the following commands. When displaying DSU entries for a particular day or date, `dsu` will display the DSU entries for the given day or date, as well as the DSU entries for the _previous_ day, relative to the given day or date. If the given day or date falls on a weekend or Monday, `dsu` will display any entries for the preceeding weekend _and_ Friday; this is so that you can share any activities that occurred over the weekend (if anything) as well as any activities for the previous Friday:
|
71
98
|
|
72
|
-
- `$ dsu list today
|
99
|
+
- `$ dsu list today`
|
100
|
+
- `$ dsu l n` # Equivalent to the above, only using shortcuts
|
73
101
|
- `$ dsu list tomorrow|t`
|
102
|
+
- `$ dsu l t` # Equivalent to the above, only using shortcuts
|
74
103
|
- `$ dsu list yesterday|y`
|
104
|
+
- `$ dsu l y` # Equivalent to the above, only using shortcuts
|
75
105
|
- `$ dsu list date|d DATE|MNEMONIC`
|
106
|
+
- `$ dsu l d DATE|MNEMONIC` # Equivalent to the above, only using shortcuts
|
76
107
|
- `$ dsu list dates|dd OPTIONS`
|
108
|
+
- `$ dsu l dd OPTIONS` # Equivalent to the above, only using shortcuts
|
77
109
|
|
78
110
|
See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
|
79
111
|
See the [Mnemonics](#mnemonics) section for more information on acceptable MNEMONIC rules and formats used by `dsu`.
|
80
112
|
|
81
|
-
IMPORTANT
|
113
|
+
**IMPORTANT:** In some cases the behavior _relative date mnemonics_ (RDMs, see the [Mnemonics](#mnemonics) section for more information about RDMs) have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
|
82
114
|
|
83
115
|
### Examples
|
84
116
|
The following displays the entries for "Today", where `Time.now == '2023-05-06 08:54:57.6861 -0400'`
|
85
117
|
|
86
118
|
`$ dsu list today`
|
119
|
+
`$ dsu l t`
|
87
120
|
```shell
|
88
121
|
#=>
|
89
122
|
Saturday, (Today) 2023-05-06
|
@@ -94,47 +127,54 @@ Friday, (Yesterday) 2023-05-05
|
|
94
127
|
2. Attend new hire meet & greet
|
95
128
|
```
|
96
129
|
|
97
|
-
`$ dsu list date 5/
|
98
|
-
`$ dsu list
|
130
|
+
`$ dsu list date 5/7/2023`
|
131
|
+
`$ dsu list d 2023/7/5`
|
132
|
+
`$ dsu l d 7/5` # When omitting YYYY, MM/DD is assumed
|
99
133
|
|
100
134
|
```shell
|
101
135
|
#=>
|
102
|
-
|
136
|
+
Wednesday, (Today) 2023-07-05
|
103
137
|
1. Blocked for locally failing test IN-12345
|
104
138
|
|
105
|
-
|
139
|
+
Tuesday, (Yesterday) 2023-07-04
|
106
140
|
1. Pick up ticket IN-12345
|
107
141
|
2. Attend new hire meet & greet
|
108
142
|
```
|
143
|
+
**NOTE:** If `DATE` (`date`|`d`) falls on a weekend or Monday, `dsu` will display any entries for the preceeding weekend _and_ Friday.
|
109
144
|
|
110
145
|
#### Listing Date Ranges
|
111
146
|
For more information, see the [Mnemonics](#mnemonics) section for more information on acceptable MNEMONIC rules and formats used by `dsu`.
|
112
147
|
|
113
|
-
Output omitted for brevity...
|
114
|
-
|
115
|
-
Display the DSU entries for the last 3 days.
|
116
|
-
|
117
|
-
`dsu list dates --from yesterday --to -2`
|
118
|
-
|
119
|
-
Display the DSU entries for 1/1 to 1/4.
|
148
|
+
**NOTE:** Output omitted for brevity...
|
120
149
|
|
121
|
-
|
150
|
+
##### Display the DSU entries for the last 3 days
|
151
|
+
`$ dsu list dates --from yesterday --to -2`
|
152
|
+
`$ dsu l dd -f y -t -2`
|
122
153
|
|
123
|
-
Display the DSU entries for 1/
|
154
|
+
##### Display the DSU entries for 1/1 to 1/4 for the current year
|
155
|
+
`$ dsu list dates --from 1/1 --to +3`
|
156
|
+
`$ dsu l dd -f 1/1 -t +3`
|
124
157
|
|
125
|
-
|
158
|
+
##### Display the DSU entries for 1/2 to 1/5
|
159
|
+
`$ dsu list dates --from 1/5 --to -3`
|
160
|
+
`$ dsu l dd -f 1/5 -t -3`
|
126
161
|
|
127
|
-
Display the DSU entries for the last week
|
162
|
+
##### Display the DSU entries for the last week
|
163
|
+
`$ dsu list dates --from today --to -6`
|
164
|
+
`$ dsu l dd -f n -t -6`
|
128
165
|
|
129
|
-
|
166
|
+
##### Display the DSU entries back 1 week from yesterday's date
|
167
|
+
`$ dsu list dates --from -7 --to +6`
|
168
|
+
`$ dsu l dd -f -7 -t +6`
|
130
169
|
|
131
|
-
|
170
|
+
**NOTE:** **The above example is silly,** but it illustrates the fact that you can use relative mnemonics for both `--from` and `--to` options. While you *can* use relative mnemonics for both the `--from` and `--to` options, there is usually a more intuitive way.
|
132
171
|
|
133
|
-
|
172
|
+
For example:
|
134
173
|
|
135
|
-
|
174
|
+
This can be accomplished MUCH easier by using the `yesterday` mnemonic. This will display the DSU entries back 1 week from yesterday's date.
|
136
175
|
|
137
|
-
|
176
|
+
`$ dsu list dates --from yesterday --to -6`
|
177
|
+
`$ dsu l dd -f y -t -6`
|
138
178
|
|
139
179
|
## Editing DSU Entries
|
140
180
|
|
@@ -142,14 +182,18 @@ You can edit DSU entry groups by date. `dsu` will allow you to edit a DSU entry
|
|
142
182
|
|
143
183
|
If no entries exist for the DSU date, the editor will open and allow you to add entries for that date. If you have the `:carry_over_entries_to_today` configuration option setting set to `true`, entries from the last DSU date will be copied into the editor for your convenience.
|
144
184
|
|
145
|
-
|
185
|
+
**NOTE:** duplicate entries are not allowed; that is, the entry DESCRIPTION must be unique within an entry group. Non-unique entries will not be added to the entry group. The same holds true for entries whose DESCRIPTION that do not pass validation (between 2 and 256 characters (inclusive) in length).
|
146
186
|
|
147
|
-
NOTE
|
187
|
+
**NOTE:** See the "[Customizing the `dsu` Configuration File](#customizing-the-dsu-configuration-file)" section to configure `dsu` to use the editor of your choice and other configuration options to make editing more convenient.
|
148
188
|
|
149
|
-
- `$ dsu edit today
|
150
|
-
- `$ dsu
|
151
|
-
- `$ dsu edit
|
152
|
-
- `$ dsu
|
189
|
+
- `$ dsu edit today`
|
190
|
+
- `$ dsu e n` # Equivalent to the above, only using shortcuts
|
191
|
+
- `$ dsu edit tomorrow`
|
192
|
+
- `$ dsu e t` # Equivalent to the above, only using shortcuts
|
193
|
+
- `$ dsu edit yesterday`
|
194
|
+
- `$ dsu e y` # Equivalent to the above, only using shortcuts
|
195
|
+
- `$ dsu edit date DATE`
|
196
|
+
- `$ dsu e d DATE` # Equivalent to the above, only using shortcuts
|
153
197
|
|
154
198
|
### Examples
|
155
199
|
|
@@ -233,39 +277,49 @@ from: Interative planning meeting 11:00AM.
|
|
233
277
|
Interative planning meeting 11:00AM.
|
234
278
|
```
|
235
279
|
## Deleting DSU Entry Groups
|
236
|
-
You can delete DSU groups
|
280
|
+
You can delete DSU entry groups; this will delete *all* the entries for the particular day or date range. When deleting DSU entries for a particular day (`date`, `today`, `tomorrow`, `yesterday`), or date range (`dates`), `dsu` will delete the entry group(s) and *all* the associated entries for that day or date range:
|
237
281
|
|
238
|
-
- `$ dsu delete today
|
239
|
-
- `$ dsu
|
240
|
-
- `$ dsu delete
|
241
|
-
- `$ dsu
|
242
|
-
- `$ dsu delete
|
282
|
+
- `$ dsu delete today`
|
283
|
+
- `$ dsu d n` # Equivalent to the above, only using shortcuts
|
284
|
+
- `$ dsu delete tomorrow`
|
285
|
+
- `$ dsu d t` # Equivalent to the above, only using shortcuts
|
286
|
+
- `$ dsu delete yesterday`
|
287
|
+
- `$ dsu d y` # Equivalent to the above, only using shortcuts
|
288
|
+
- `$ dsu delete date DATE|MNEMONIC`
|
289
|
+
- `$ dsu d d DATE|MNEMONIC` # Equivalent to the above, only using shortcuts
|
290
|
+
- `$ dsu delete dates OPTIONS`
|
291
|
+
- `$ dsu d dd OPTIONS` # Equivalent to the above, only using shortcuts
|
243
292
|
|
244
|
-
NOTE
|
293
|
+
**NOTE:** Before any of the above `dsu` commands are executed, `dsu` will prompt you to confirm the delete; you can continue ('y') or cancel ('N').
|
245
294
|
|
246
295
|
See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
|
247
296
|
See the [Mnemonics](#mnemonics) section for more information on acceptable MNEMONIC rules and formats used by `dsu`.
|
248
297
|
|
249
|
-
IMPORTANT
|
298
|
+
**IMPORTANT:** In some cases the behavior that _relative date mnemonics_ (RDMs, see the [Mnemonics](#mnemonics) section for more information about RDMs) have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu delete help date` and `dsu delete help dates`.
|
250
299
|
|
251
300
|
### Examples
|
252
|
-
The following deletes the entry group and all entries for today's date
|
301
|
+
The following example deletes the entry group and *all* entries for today's date.
|
253
302
|
|
254
303
|
`$ dsu delete today`
|
304
|
+
`$ dsu d n`
|
255
305
|
```shell
|
256
306
|
#=>
|
257
307
|
Are you sure you want to delete all the entries for 2023-12-17 (1 entry groups)? [y/N]> y
|
258
308
|
Deleted 1 entry group(s).
|
259
309
|
```
|
310
|
+
The following example deletes the entry group and *all* entries for yesterday's date.
|
260
311
|
|
261
312
|
`$ dsu delete yesterday`
|
313
|
+
`$ dsu d y`
|
262
314
|
```shell
|
263
315
|
#=>
|
264
316
|
Are you sure you want to delete all the entries for 2023-12-16 (1 entry groups)? [y/N]> y
|
265
317
|
Deleted 1 entry group(s).
|
266
318
|
```
|
319
|
+
The following example deletes the entry group and *all* entries for tomorrow's date.
|
267
320
|
|
268
321
|
`$ dsu delete tomorrow`
|
322
|
+
`$ dsu d t`
|
269
323
|
```shell
|
270
324
|
#=>
|
271
325
|
Are you sure you want to delete all the entries for 2023-12-18 (1 entry groups)? [y/N]> y
|
@@ -275,6 +329,7 @@ Deleted 1 entry group(s).
|
|
275
329
|
The following deletes the entry group and all entries for 12/17 of the current year.
|
276
330
|
|
277
331
|
`$ dsu delete date 12/17`
|
332
|
+
`$ dsu d d 12/17`
|
278
333
|
```shell
|
279
334
|
#=>
|
280
335
|
Are you sure you want to delete all the entries for 2023-12-17 (0 entry groups)? [y/N]> y
|
@@ -284,14 +339,16 @@ Deleted 1 entry group(s)
|
|
284
339
|
The following deletes the entry group and all entries for the past week, starting from today (12/17/2023).
|
285
340
|
|
286
341
|
`$ dsu delete dates --from today --to -6`
|
342
|
+
`$ dsu d dd -f n -t -6`
|
287
343
|
```shell
|
288
344
|
#=>
|
289
345
|
Are you sure you want to delete all the entries for 2023-12-11 thru 2023-12-17 (7 entry groups)? [y/N]> y
|
290
346
|
Deleted 7 entry group(s).
|
291
347
|
```
|
292
348
|
## Customizing the `dsu` Configuration File
|
349
|
+
To customize the `dsu` configuration file, you may follow the instructions outlined here. It is only recommended that you customize the `dsu` configuration file *only* if you are working with an official release (`n.n.n.n`).
|
293
350
|
|
294
|
-
It is **not** recommended that you get too attached to the `dsu` configuration options when this gem is in pre-release (e.g. `n.n.n.alpha.n`, `n.n.n.beta.n`, etc.). This is because changes to the configuration file options
|
351
|
+
**NOTE:** It is **not** recommended that you get too attached to the `dsu` configuration options when this gem is in **pre-release** (e.g. `n.n.n.alpha.n`, `n.n.n.beta.n`, etc.). This is because changes to the configuration file options, of course, could change. With an official release (`n.n.n.n`), edit all you want!
|
295
352
|
|
296
353
|
### Customizing the `dsu` Configuration File
|
297
354
|
|
@@ -360,18 +417,9 @@ A *mnemonic* may be any of the following: `n|today|t|tomorrow|y|yesterday|+n|-n`
|
|
360
417
|
|
361
418
|
Where `n`, `t`, `y` are aliases for `today`, `tomorrow`, and `yesterday`, respectively.
|
362
419
|
|
363
|
-
Where `+n`, `-n` are relative date mnemonics (
|
364
|
-
|
365
|
-
NOTE: In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
|
366
|
-
|
367
|
-
|
368
|
-
## Installation
|
369
|
-
|
370
|
-
$ gem install dsu
|
371
|
-
|
372
|
-
## Usage
|
420
|
+
Where `+n`, `-n` are relative date mnemonics (RDMs). Generally speaking, RDMs are relative to the current date. For example, a RDM of `+1` would be equal to `Time.now + 1.day` (or tomorrow), and a RDM of `-1` would be equal to `Time.now - 1.day` (or yesterday).
|
373
421
|
|
374
|
-
|
422
|
+
NOTE: In some cases the behavior RDMs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
|
375
423
|
|
376
424
|
## Development
|
377
425
|
|
data/lib/dsu/base_cli.rb
CHANGED
data/lib/dsu/cli.rb
CHANGED
@@ -12,31 +12,30 @@ require_relative 'subcommands/theme'
|
|
12
12
|
module Dsu
|
13
13
|
# The `dsu` command.
|
14
14
|
class CLI < BaseCLI
|
15
|
-
|
16
|
-
map
|
17
|
-
map
|
18
|
-
map
|
19
|
-
map
|
20
|
-
map
|
21
|
-
map
|
22
|
-
map
|
23
|
-
map
|
15
|
+
map I18n.t('commands.add.key_mappings') => :add
|
16
|
+
map I18n.t('commands.config.key_mappings') => :config
|
17
|
+
map I18n.t('commands.delete.key_mappings') => :delete
|
18
|
+
map I18n.t('commands.edit.key_mappings') => :edit
|
19
|
+
map I18n.t('commands.help.key_mappings') => :help
|
20
|
+
map I18n.t('commands.info.key_mappings') => :info
|
21
|
+
map I18n.t('commands.list.key_mappings') => :list
|
22
|
+
map I18n.t('commands.theme.key_mappings') => :theme
|
23
|
+
map I18n.t('commands.version.key_mappings') => :version
|
24
24
|
|
25
25
|
desc I18n.t('commands.add.desc'), I18n.t('commands.add.usage')
|
26
26
|
long_desc I18n.t('commands.add.long_desc', date_option_description: date_option_description)
|
27
|
-
|
28
|
-
option
|
29
|
-
option :
|
30
|
-
option :
|
31
|
-
option :today, type: :boolean, aliases: '-n', default: true
|
27
|
+
option I18n.t('options.date.name'), aliases: I18n.t('options.date.aliases'), type: :string
|
28
|
+
option I18n.t('options.tomorrow.name'), aliases: I18n.t('options.tomorrow.aliases'), type: :boolean
|
29
|
+
option I18n.t('options.yesterday.name'), aliases: I18n.t('options.yesterday.aliases'), type: :boolean
|
30
|
+
option I18n.t('options.today.name'), aliases: I18n.t('options.today.aliases'), type: :boolean, default: true
|
32
31
|
def add(description)
|
33
|
-
time = if options[
|
34
|
-
Time.parse(options[
|
35
|
-
elsif options[
|
32
|
+
time = if options[I18n.t('options.date.name')].present?
|
33
|
+
Time.parse(options[I18n.t('options.date.name')])
|
34
|
+
elsif options[I18n.t('options.tomorrow.name')].present?
|
36
35
|
Time.now.tomorrow
|
37
|
-
elsif options[
|
36
|
+
elsif options[I18n.t('options.yesterday.name')].present?
|
38
37
|
Time.now.yesterday
|
39
|
-
elsif options[
|
38
|
+
elsif options[I18n.t('options.today.name')].present?
|
40
39
|
Time.now
|
41
40
|
end
|
42
41
|
entry = Models::Entry.new(description: description)
|
@@ -2,13 +2,11 @@
|
|
2
2
|
|
3
3
|
require_relative '../base_cli'
|
4
4
|
require_relative '../support/ask'
|
5
|
-
require_relative '../support/subcommand_help_colorizeable'
|
6
5
|
|
7
6
|
module Dsu
|
8
7
|
module Subcommands
|
9
8
|
class BaseSubcommand < Dsu::BaseCLI
|
10
9
|
include Support::Ask
|
11
|
-
include Support::SubcommandHelpColorizable
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative '../services/entry_group/counter_service'
|
4
4
|
require_relative '../services/entry_group/deleter_service'
|
5
5
|
require_relative '../support/command_options/dsu_times'
|
6
|
-
require_relative '../support/command_options/
|
6
|
+
require_relative '../support/command_options/time_mnemonic'
|
7
7
|
require_relative '../support/time_formatable'
|
8
8
|
require_relative '../views/entry_group/shared/no_entries_to_display'
|
9
9
|
require_relative '../views/shared/error'
|
@@ -12,7 +12,7 @@ require_relative 'base_subcommand'
|
|
12
12
|
module Dsu
|
13
13
|
module Subcommands
|
14
14
|
class Delete < BaseSubcommand
|
15
|
-
include Support::CommandOptions::
|
15
|
+
include Support::CommandOptions::TimeMnemonic
|
16
16
|
include Support::TimeFormatable
|
17
17
|
|
18
18
|
map %w[d] => :date
|
@@ -45,13 +45,13 @@ module Dsu
|
|
45
45
|
desc I18n.t('subcommands.delete.date.desc'), I18n.t('subcommands.delete.date.usage')
|
46
46
|
long_desc I18n.t('subcommands.delete.date.long_desc',
|
47
47
|
date_option_description: date_option_description,
|
48
|
-
|
48
|
+
mnemonic_option_description: mnemonic_option_description)
|
49
49
|
option :prompts, type: :hash, default: {}, hide: true, aliases: '-p'
|
50
|
-
def date(
|
51
|
-
time = if
|
52
|
-
|
50
|
+
def date(date_or_mnemonic)
|
51
|
+
time = if time_mnemonic?(date_or_mnemonic)
|
52
|
+
time_from_mnemonic(command_option: date_or_mnemonic)
|
53
53
|
else
|
54
|
-
Time.parse(
|
54
|
+
Time.parse(date_or_mnemonic)
|
55
55
|
end
|
56
56
|
delete_entry_groups_if times: [time], options: options
|
57
57
|
rescue ArgumentError => e
|
@@ -61,7 +61,7 @@ module Dsu
|
|
61
61
|
desc I18n.t('subcommands.delete.dates.desc'), I18n.t('subcommands.delete.dates.usage')
|
62
62
|
long_desc I18n.t('subcommands.delete.dates.long_desc',
|
63
63
|
date_option_description: date_option_description,
|
64
|
-
|
64
|
+
mnemonic_option_description: mnemonic_option_description)
|
65
65
|
option :from, type: :string, required: true, aliases: '-f', banner: 'DATE|MNEMONIC'
|
66
66
|
option :to, type: :string, required: true, aliases: '-t', banner: 'DATE|MNEMONIC'
|
67
67
|
option :prompts, type: :hash, default: {}, hide: true, aliases: '-p'
|
data/lib/dsu/subcommands/list.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative '../services/entry_group/counter_service'
|
4
4
|
require_relative '../support/command_options/dsu_times'
|
5
|
-
require_relative '../support/command_options/
|
5
|
+
require_relative '../support/command_options/time_mnemonic'
|
6
6
|
require_relative '../support/time_formatable'
|
7
7
|
require_relative '../views/entry_group/shared/no_entries_to_display'
|
8
8
|
require_relative '../views/shared/error'
|
@@ -11,7 +11,7 @@ require_relative 'base_subcommand'
|
|
11
11
|
module Dsu
|
12
12
|
module Subcommands
|
13
13
|
class List < BaseSubcommand
|
14
|
-
include Support::CommandOptions::
|
14
|
+
include Support::CommandOptions::TimeMnemonic
|
15
15
|
include Support::TimeFormatable
|
16
16
|
|
17
17
|
map %w[d] => :date
|
@@ -47,12 +47,12 @@ module Dsu
|
|
47
47
|
desc I18n.t('subcommands.list.date.desc'), I18n.t('subcommands.list.date.usage')
|
48
48
|
long_desc I18n.t('subcommands.list.date.long_desc',
|
49
49
|
date_option_description: date_option_description,
|
50
|
-
|
51
|
-
def date(
|
52
|
-
time = if
|
53
|
-
|
50
|
+
mnemonic_option_description: mnemonic_option_description)
|
51
|
+
def date(date_or_mnemonic)
|
52
|
+
time = if time_mnemonic?(date_or_mnemonic)
|
53
|
+
time_from_mnemonic(command_option: date_or_mnemonic)
|
54
54
|
else
|
55
|
-
Time.parse(
|
55
|
+
Time.parse(date_or_mnemonic)
|
56
56
|
end
|
57
57
|
times = sorted_dsu_times_for(times: [time, time.yesterday])
|
58
58
|
view_list_for(times: times, options: options)
|
@@ -63,10 +63,10 @@ module Dsu
|
|
63
63
|
desc I18n.t('subcommands.list.dates.desc'), I18n.t('subcommands.list.dates.usage')
|
64
64
|
long_desc I18n.t('subcommands.list.dates.long_desc',
|
65
65
|
date_option_description: date_option_description,
|
66
|
-
|
66
|
+
mnemonic_option_description: mnemonic_option_description)
|
67
67
|
option :from, type: :string, required: true, aliases: '-f', banner: 'DATE|MNEMONIC'
|
68
68
|
option :to, type: :string, required: true, aliases: '-t', banner: 'DATE|MNEMONIC'
|
69
|
-
option :include_all, default: false, type: :boolean, aliases: '-a', desc: I18n.t('
|
69
|
+
option :include_all, default: false, type: :boolean, aliases: '-a', desc: I18n.t('options.include_all')
|
70
70
|
def dates
|
71
71
|
options = configuration.to_h.merge(self.options).with_indifferent_access
|
72
72
|
times, errors = Support::CommandOptions::DsuTimes.dsu_times_for(from_option: options[:from], to_option: options[:to]) # rubocop:disable Layout/LineLength
|
@@ -12,11 +12,18 @@ module Dsu
|
|
12
12
|
end
|
13
13
|
|
14
14
|
module ClassMethods
|
15
|
+
# Handles general help colorization.
|
15
16
|
def help(shell, subcommand = false) # rubocop:disable Style/OptionalBooleanParameter
|
16
17
|
help_text = Services::StdoutRedirectorService.call { super }
|
17
18
|
puts apply_theme(help_text, theme_color: color_theme.help)
|
18
19
|
end
|
19
20
|
|
21
|
+
# Handles sub-command help colorization.
|
22
|
+
def command_help(shell, subcommand = false) # rubocop:disable Style/OptionalBooleanParameter
|
23
|
+
help_text = Services::StdoutRedirectorService.call { super }
|
24
|
+
puts apply_theme(help_text, theme_color: color_theme.help)
|
25
|
+
end
|
26
|
+
|
20
27
|
def color_theme
|
21
28
|
@color_theme ||= Models::ColorTheme.current_or_default
|
22
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'time'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'time_mnemonic'
|
5
5
|
|
6
6
|
module Dsu
|
7
7
|
module Support
|
@@ -11,7 +11,7 @@ module Dsu
|
|
11
11
|
|
12
12
|
# Returns an array of Time objects. The first element is the "from" time.
|
13
13
|
# The second element is the "to" time. Both arguments are expected to be
|
14
|
-
# command options that are time strings, time or relative time
|
14
|
+
# command options that are time strings, time or relative time mnemonics.
|
15
15
|
def dsu_times_for(from_option:, to_option:)
|
16
16
|
from_time = dsu_from_time_for(from_option: from_option)
|
17
17
|
to_time = dsu_to_time_for(to_option: to_option, from_time: from_time)
|
@@ -28,17 +28,17 @@ module Dsu
|
|
28
28
|
def dsu_from_time_for(from_option:)
|
29
29
|
return if from_option.nil?
|
30
30
|
|
31
|
-
from_time = if
|
32
|
-
|
31
|
+
from_time = if TimeMnemonic.time_mnemonic?(from_option)
|
32
|
+
TimeMnemonic.time_from_mnemonic(command_option: from_option)
|
33
33
|
end
|
34
34
|
from_time || Time.time_from_date_string(command_option: from_option)
|
35
35
|
end
|
36
36
|
|
37
37
|
def dsu_to_time_for(to_option:, from_time:)
|
38
|
-
to_time = if
|
39
|
-
|
40
|
-
elsif
|
41
|
-
|
38
|
+
to_time = if TimeMnemonic.relative_time_mnemonic?(to_option)
|
39
|
+
TimeMnemonic.time_from_mnemonic(command_option: to_option, relative_time: from_time)
|
40
|
+
elsif TimeMnemonic.time_mnemonic?(to_option)
|
41
|
+
TimeMnemonic.time_from_mnemonic(command_option: to_option)
|
42
42
|
end
|
43
43
|
to_time || Time.time_from_date_string(command_option: to_option)
|
44
44
|
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'time_mnemonics'
|
4
|
+
|
5
|
+
module Dsu
|
6
|
+
module Support
|
7
|
+
module CommandOptions
|
8
|
+
# The purpose of this module is to take a command option that is a string and return a Time object.
|
9
|
+
# The command option is expected to be a time mneumoic.
|
10
|
+
module TimeMnemonic
|
11
|
+
include TimeMnemonics
|
12
|
+
|
13
|
+
module_function
|
14
|
+
|
15
|
+
def time_from_mnemonic(command_option:, relative_time: nil)
|
16
|
+
time_from_mnemonic!(command_option: command_option, relative_time: relative_time)
|
17
|
+
rescue ArgumentError
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
# command_option: is expected to me a time mnemonic. If relative_time is NOT nil, all
|
22
|
+
# time mnemonics are relative to relative_time. Otherwise, they are relative to Time.now.
|
23
|
+
# relative_time: is a Time object that is required IF command_option is expected to be
|
24
|
+
# a relative time mnemonic. Otherwise, it is optional.
|
25
|
+
def time_from_mnemonic!(command_option:, relative_time: nil)
|
26
|
+
validate_argument!(command_option: command_option, command_option_name: :command_option)
|
27
|
+
unless relative_time.nil? || relative_time.is_a?(::Time)
|
28
|
+
raise ArgumentError, "relative_time is not a Time object: \"#{relative_time}\""
|
29
|
+
end
|
30
|
+
|
31
|
+
relative_time ||= ::Time.now
|
32
|
+
|
33
|
+
time_for_mnemonic(mnemonic: command_option, relative_time: relative_time)
|
34
|
+
end
|
35
|
+
|
36
|
+
# This method returns true if mnemonic is a valid mnemonic OR
|
37
|
+
# a relative time mnemonic.
|
38
|
+
def time_mnemonic?(mnemonic)
|
39
|
+
mnemonic?(mnemonic) || relative_time_mnemonic?(mnemonic)
|
40
|
+
end
|
41
|
+
|
42
|
+
# This method returns true if mnemonic is a valid relative
|
43
|
+
# time mnemonic.
|
44
|
+
def relative_time_mnemonic?(mnemonic)
|
45
|
+
return false unless mnemonic.is_a?(String)
|
46
|
+
|
47
|
+
mnemonic.match?(RELATIVE_REGEX)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Add private_class_methods here.
|
51
|
+
|
52
|
+
# Returns a Time object from a mnemonic.
|
53
|
+
def time_for_mnemonic(mnemonic:, relative_time:)
|
54
|
+
time = relative_time
|
55
|
+
if today_mnemonic?(mnemonic)
|
56
|
+
time
|
57
|
+
elsif tomorrow_mnemonic?(mnemonic)
|
58
|
+
time.tomorrow
|
59
|
+
elsif yesterday_mnemonic?(mnemonic)
|
60
|
+
time.yesterday
|
61
|
+
elsif relative_time_mnemonic?(mnemonic)
|
62
|
+
relative_time_for(days_from_now: mnemonic, time: time)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def relative_time_for(days_from_now:, time:)
|
67
|
+
days_from_now.to_i.days.from_now(time)
|
68
|
+
end
|
69
|
+
|
70
|
+
# This method returns true if mnemonic is a valid time mnemonic.
|
71
|
+
# This method will return false if mnemonic is an invalid mnemonic
|
72
|
+
# OR if mnemonic is a relative time mnemonic.
|
73
|
+
def mnemonic?(mnemonic)
|
74
|
+
today_mnemonic?(mnemonic) ||
|
75
|
+
tomorrow_mnemonic?(mnemonic) ||
|
76
|
+
yesterday_mnemonic?(mnemonic)
|
77
|
+
end
|
78
|
+
|
79
|
+
def today_mnemonic?(mnemonic)
|
80
|
+
TODAY.include?(mnemonic)
|
81
|
+
end
|
82
|
+
|
83
|
+
def tomorrow_mnemonic?(mnemonic)
|
84
|
+
TOMORROW.include?(mnemonic)
|
85
|
+
end
|
86
|
+
|
87
|
+
def yesterday_mnemonic?(mnemonic)
|
88
|
+
YESERDAY.include?(mnemonic)
|
89
|
+
end
|
90
|
+
|
91
|
+
def validate_argument!(command_option:, command_option_name:)
|
92
|
+
raise ArgumentError, "#{command_option_name} cannot be nil." if command_option.nil?
|
93
|
+
raise ArgumentError, "#{command_option_name} cannot be blank." if command_option.blank?
|
94
|
+
unless command_option.is_a?(String)
|
95
|
+
raise ArgumentError, "#{command_option_name} must be a String: \"#{command_option}\""
|
96
|
+
end
|
97
|
+
unless time_mnemonic?(command_option)
|
98
|
+
raise ArgumentError, "#{command_option_name} is an invalid mnemonic: \"#{command_option}\"."
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
private_class_method :time_for_mnemonic, :relative_time_for,
|
103
|
+
:mnemonic?, :today_mnemonic?, :tomorrow_mnemonic?,
|
104
|
+
:yesterday_mnemonic?, :validate_argument!
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/lib/dsu/version.rb
CHANGED
data/lib/locales/en/commands.yml
CHANGED
@@ -1,15 +1,38 @@
|
|
1
1
|
# lib/dsu/cli.rb
|
2
|
+
#
|
3
|
+
# NOTE:
|
4
|
+
#
|
5
|
+
# Commands should have the following layout:
|
6
|
+
#
|
7
|
+
# en:
|
8
|
+
# commands:
|
9
|
+
# my_command:
|
10
|
+
# key_mappings: thor key mappings
|
11
|
+
# desc: thor command description
|
12
|
+
# usage: thor command usage
|
13
|
+
# long_desc: thor long description
|
14
|
+
#
|
15
|
+
# Place key_mappings: at the top of the command entries:
|
16
|
+
#
|
17
|
+
# en:
|
18
|
+
# commands:
|
19
|
+
# my_command:
|
20
|
+
# key_mappings: m # Single mapping
|
21
|
+
# key_mappings: # Array of mappings
|
22
|
+
# - 'm'
|
23
|
+
# - '-m'
|
2
24
|
en:
|
3
25
|
commands:
|
4
26
|
add:
|
5
|
-
|
27
|
+
key_mappings: a
|
28
|
+
desc: add|a [OPTIONS] DESCRIPTION
|
6
29
|
usage: Adds a DSU entry having DESCRIPTION to the date associated with the given OPTION
|
7
30
|
long_desc: |
|
8
31
|
Will add a DSU entry having DESCRIPTION to the date associated with the given OPTION.
|
9
32
|
|
10
33
|
$ dsu add [-d DATE|-n|-t|-y] DESCRIPTION
|
11
34
|
|
12
|
-
$ dsu
|
35
|
+
$ dsu a [-d DATE|-n|-t|-y] DESCRIPTION
|
13
36
|
|
14
37
|
OPTIONS:
|
15
38
|
|
@@ -27,16 +50,20 @@ en:
|
|
27
50
|
|
28
51
|
Must be be between 2 and 256 characters (inclusive) in length.
|
29
52
|
config:
|
30
|
-
|
53
|
+
key_mappings: c
|
54
|
+
desc: config|c SUBCOMMAND
|
31
55
|
usage: Manage configuration file for this gem
|
32
56
|
delete:
|
33
|
-
|
57
|
+
key_mappings: c
|
58
|
+
desc: delete|d SUBCOMMAND
|
34
59
|
usage: Delete DSU entries for the given SUBCOMMAND
|
35
60
|
edit:
|
36
|
-
desc: edit
|
61
|
+
desc: edit|e SUBCOMMAND
|
37
62
|
usage: Edit DSU entries for the given SUBCOMMAND
|
63
|
+
key_mappings: e
|
38
64
|
info:
|
39
|
-
|
65
|
+
key_mappings: i
|
66
|
+
desc: info|i
|
40
67
|
usage: Displays information about this DSU release
|
41
68
|
info: |
|
42
69
|
Dsu Info
|
@@ -56,15 +83,34 @@ en:
|
|
56
83
|
Migration version folder: %{migration_version_folder}
|
57
84
|
Migration file folder: %{migration_file_folder}
|
58
85
|
list:
|
59
|
-
|
86
|
+
key_mappings: l
|
87
|
+
desc: list|l SUBCOMMAND
|
60
88
|
usage: Displays DSU entries for the given SUBCOMMAND
|
61
89
|
theme:
|
62
|
-
|
90
|
+
key_mappings: t
|
91
|
+
desc: theme|t SUBCOMMAND
|
63
92
|
usage: Manage DSU themes
|
64
93
|
version:
|
65
|
-
|
94
|
+
key_mappings:
|
95
|
+
- v
|
96
|
+
- '-v'
|
97
|
+
desc: version|v|-v
|
66
98
|
usage: Displays the DSU version for this gem
|
99
|
+
# Should these options go under their respective commands
|
100
|
+
# (e.g. commands.options.date.name, commands.options.today.aliases, etc.)?
|
67
101
|
options:
|
102
|
+
date:
|
103
|
+
aliases: -d
|
104
|
+
name: 'date'
|
105
|
+
today:
|
106
|
+
aliases: -n
|
107
|
+
name: 'today'
|
108
|
+
tomorrow:
|
109
|
+
aliases: -t
|
110
|
+
name: 'tomorrow'
|
111
|
+
yesterday:
|
112
|
+
aliases: -y
|
113
|
+
name: 'yesterday'
|
68
114
|
include_all: Include dates that have no DSU entries
|
69
115
|
date_option_description: |
|
70
116
|
DATE
|
@@ -74,17 +120,17 @@ en:
|
|
74
120
|
as well as omit the year if the date you want to display is the
|
75
121
|
current year (e.g. <month>/<day>, or 1/31). For example: `require 'time';
|
76
122
|
Time.parse('01/02/2023'); Time.parse('1/2') # etc.`
|
77
|
-
|
78
|
-
|
123
|
+
mnemonic_option_description: |
|
124
|
+
MNEMONIC
|
79
125
|
|
80
126
|
This may be any of the following: n|today|t|tomorrow|y|yesterday|+n|-n.
|
81
127
|
|
82
128
|
Where n, t, y are aliases for today, tomorrow, and yesterday, respectively.
|
83
129
|
|
84
|
-
Where +n, -n are relative date
|
85
|
-
|
86
|
-
equal to `Time.now + 1.day` (tomorrow), and a
|
130
|
+
Where +n, -n are relative date mnemonics (RDMs). Generally speaking,
|
131
|
+
RDMs are relative to the current date. For example, a RDM of +1 would be
|
132
|
+
equal to `Time.now + 1.day` (tomorrow), and a RDM of -1 would be equal to
|
87
133
|
`Time.now - 1.day` (yesterday).
|
88
134
|
|
89
|
-
In some cases the behavior
|
135
|
+
In some cases the behavior RDMs have on some commands are context dependent;
|
90
136
|
in such cases the behavior will be noted.
|
@@ -71,14 +71,14 @@ en:
|
|
71
71
|
Default: "default"
|
72
72
|
delete:
|
73
73
|
date:
|
74
|
-
desc: date|d DATE|
|
75
|
-
usage: Deletes the DSU entries for the given DATE or
|
74
|
+
desc: date|d DATE|MNEMONIC
|
75
|
+
usage: Deletes the DSU entries for the given DATE or MNEMONIC
|
76
76
|
long_desc: |
|
77
|
-
Deletes the DSU entries for the given DATE or
|
77
|
+
Deletes the DSU entries for the given DATE or MNEMONIC.
|
78
78
|
|
79
79
|
%{date_option_description}
|
80
80
|
|
81
|
-
%{
|
81
|
+
%{mnemonic_option_description}
|
82
82
|
dates:
|
83
83
|
desc: dates|dd OPTIONS
|
84
84
|
usage: Deletes the DSU entries for the OPTIONS provided
|
@@ -91,13 +91,13 @@ en:
|
|
91
91
|
|
92
92
|
OPTIONS:
|
93
93
|
|
94
|
-
-f|--from DATE|MNEMONIC: The DATE or
|
94
|
+
-f|--from DATE|MNEMONIC: The DATE or MNEMONIC that represents the start of the range of DSU dates to delete. If a relative mnemonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the current date (e.g. `<MNEMONIC>.to_i.days.from_now(Time.now)`).
|
95
95
|
|
96
|
-
-t|--to DATE|MNEMONIC: The DATE or
|
96
|
+
-t|--to DATE|MNEMONIC: The DATE or MNEMONIC that represents the end of the range of DSU dates to delete. If a relative mnemonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the date that resulting from the `--from` option date calculation.
|
97
97
|
|
98
98
|
%{date_option_description}
|
99
99
|
|
100
|
-
%{
|
100
|
+
%{mnemonic_option_description}
|
101
101
|
|
102
102
|
EXAMPLES:
|
103
103
|
|
@@ -116,15 +116,15 @@ en:
|
|
116
116
|
$ dsu delete dates --from today --to -7
|
117
117
|
|
118
118
|
This (assuming "today" is 5/23) will delete the DSU entries for the last week 5/16 to 5/22.
|
119
|
-
This example simply illustrates the fact that you can use relative
|
119
|
+
This example simply illustrates the fact that you can use relative mnemonics for
|
120
120
|
both `--from` and `--to` options; this doesn't mean you should do so...
|
121
121
|
|
122
|
-
While you can use relative
|
122
|
+
While you can use relative mnemonics for both `--from` and `--to` options,
|
123
123
|
there is always a more intuitive way. The below example basically deletes one week of DSU entries back 1 week from yesterday's date:
|
124
124
|
|
125
125
|
$ dsu delete dates --from -7 --to +6
|
126
126
|
|
127
|
-
The above can be accomplished MUCH easier by simply using the `yesterday`
|
127
|
+
The above can be accomplished MUCH easier by simply using the `yesterday` mnemonic...
|
128
128
|
|
129
129
|
This (assuming "today" is 5/23) will delete the DSU entries back 1 week from yesterday's date 5/16 to 5/22:
|
130
130
|
|
@@ -186,14 +186,14 @@ en:
|
|
186
186
|
Edits the DSU entries for yesterday.
|
187
187
|
list:
|
188
188
|
date:
|
189
|
-
desc: date|d DATE|
|
190
|
-
usage: Displays the DSU entries for the given DATE or
|
189
|
+
desc: date|d DATE|MNEMONIC
|
190
|
+
usage: Displays the DSU entries for the given DATE or MNEMONIC
|
191
191
|
long_desc: |
|
192
|
-
Displays the DSU entries for the given DATE or
|
192
|
+
Displays the DSU entries for the given DATE or MNEMONIC.
|
193
193
|
|
194
194
|
%{date_option_description}
|
195
195
|
|
196
|
-
%{
|
196
|
+
%{mnemonic_option_description}
|
197
197
|
dates:
|
198
198
|
desc: dates|dd OPTIONS
|
199
199
|
usage: Displays the DSU entries for the OPTIONS provided
|
@@ -208,13 +208,13 @@ en:
|
|
208
208
|
|
209
209
|
-a|--include-all true|false: If true, all DSU dates within the specified range will be displayed. If false, DSU dates between the first and last DSU dates that have NO entries will NOT be displayed.. The default is taken from the dsu configuration setting :include_all, see `dsu config info`.
|
210
210
|
|
211
|
-
-f|--from DATE|MNEMONIC: The DATE or
|
211
|
+
-f|--from DATE|MNEMONIC: The DATE or MNEMONIC that represents the start of the range of DSU dates to display. If a relative mnemonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the current date (e.g. `<MNEMONIC>.to_i.days.from_now(Time.now)`).
|
212
212
|
|
213
|
-
-t|--to DATE|MNEMONIC: The DATE or
|
213
|
+
-t|--to DATE|MNEMONIC: The DATE or MNEMONIC that represents the end of the range of DSU dates to display. If a relative mnemonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the date that resulting from the `--from` option date calculation.
|
214
214
|
|
215
215
|
%{date_option_description}
|
216
216
|
|
217
|
-
%{
|
217
|
+
%{mnemonic_option_description}
|
218
218
|
|
219
219
|
EXAMPLES:
|
220
220
|
|
@@ -235,16 +235,16 @@ en:
|
|
235
235
|
$ dsu list dates --from today --to -7
|
236
236
|
|
237
237
|
This (assuming "today" is 5/23) will display the DSU entries for the last week 5/16 to 5/22.
|
238
|
-
This example simply illustrates the fact that you can use relative
|
238
|
+
This example simply illustrates the fact that you can use relative mnemonics for
|
239
239
|
both `--from` and `--to` options; this doesn't mean you should do so...
|
240
240
|
|
241
|
-
While you can use relative
|
241
|
+
While you can use relative mnemonics for both `--from` and `--to` options,
|
242
242
|
there is always a more intuitive way. The below example basically lists one week
|
243
243
|
of DSU entries back 1 week from yesterday's date:
|
244
244
|
|
245
245
|
$ dsu list dates --from -7 --to +6
|
246
246
|
|
247
|
-
The above can be accomplished MUCH easier by simply using the `yesterday`
|
247
|
+
The above can be accomplished MUCH easier by simply using the `yesterday` mnemonic...
|
248
248
|
|
249
249
|
This (assuming "today" is 5/23) will display the DSU entries back 1 week from yesterday's date 5/16 to 5/22:
|
250
250
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dsu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene M. Angelo, Jr.
|
@@ -130,25 +130,14 @@ dependencies:
|
|
130
130
|
- - "<"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '2.0'
|
133
|
-
description:
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
dsu will automatically search back to include the weekend and previous Friday dates
|
142
|
-
and display the entries; this is so that you can share what you did over the weekend
|
143
|
-
(if anything) and the previous Friday with your team. When searching for "Yesterday''s"
|
144
|
-
DSU entries, dsu will automatically search back a maximimum of 7 days to find DSU
|
145
|
-
entries to share. This could be helpful if, for example, if you are sharing what
|
146
|
-
you plan to do today (Wednesday), but were sick yesterday (Tuesday); dsu in this
|
147
|
-
case will display the last DSU entries it can find searching backwards a maximum
|
148
|
-
of 7 days. dsu does a LOT more and is perfect for command-line junkies and those
|
149
|
-
who LOVE simplicity. Give it a try and a star if you like it!
|
150
|
-
|
151
|
-
'
|
133
|
+
description: " Get ready to jazz and snazz up your daily stand-ups with dsu, the
|
134
|
+
agile developer's new best friend! This handy command-line gem is all about making
|
135
|
+
your Daily Stand-Up (DSU) participation smooth, fun, and super efficient. Effortlessly
|
136
|
+
create, update, and organize your DSU entries, turning the task of tracking and
|
137
|
+
sharing your daily activities into a breeze. With its intuitive interface and smart
|
138
|
+
date management, dsu ensures you’re always ready to inform your team about your
|
139
|
+
recent progress and upcoming plans. Perfect for command-line tool enthusiasts, dsu
|
140
|
+
brings a dash of simplicity and fun, fun, fun to your daily agile routine!\n"
|
152
141
|
email:
|
153
142
|
- public.gma@gmail.com
|
154
143
|
executables:
|
@@ -218,14 +207,13 @@ files:
|
|
218
207
|
- lib/dsu/support/command_hookable.rb
|
219
208
|
- lib/dsu/support/command_options/dsu_times.rb
|
220
209
|
- lib/dsu/support/command_options/time.rb
|
221
|
-
- lib/dsu/support/command_options/
|
222
|
-
- lib/dsu/support/command_options/
|
210
|
+
- lib/dsu/support/command_options/time_mnemonic.rb
|
211
|
+
- lib/dsu/support/command_options/time_mnemonics.rb
|
223
212
|
- lib/dsu/support/descriptable.rb
|
224
213
|
- lib/dsu/support/entry_group_viewable.rb
|
225
214
|
- lib/dsu/support/field_errors.rb
|
226
215
|
- lib/dsu/support/fileable.rb
|
227
216
|
- lib/dsu/support/presentable.rb
|
228
|
-
- lib/dsu/support/subcommand_help_colorizeable.rb
|
229
217
|
- lib/dsu/support/time_comparable.rb
|
230
218
|
- lib/dsu/support/time_formatable.rb
|
231
219
|
- lib/dsu/support/times_sortable.rb
|
@@ -278,7 +266,9 @@ post_install_message: |
|
|
278
266
|
|
279
267
|
Dsu now has a delete command! Try it out by running `dsu delete help`.
|
280
268
|
|
281
|
-
Try a dsu theme by running `dsu theme list` and then `dsu theme use THEME_NAME` where THEME_NAME is the name of the theme you want to try
|
269
|
+
Try a dsu theme by running `dsu theme list` and then `dsu theme use THEME_NAME` where THEME_NAME is the name of the theme you want to try.
|
270
|
+
|
271
|
+
:)
|
282
272
|
rdoc_options: []
|
283
273
|
require_paths:
|
284
274
|
- lib
|
@@ -1,108 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'time_mneumonics'
|
4
|
-
|
5
|
-
module Dsu
|
6
|
-
module Support
|
7
|
-
module CommandOptions
|
8
|
-
# The purpose of this module is to take a command option that is a string and return a Time object.
|
9
|
-
# The command option is expected to be a time mneumoic.
|
10
|
-
module TimeMneumonic
|
11
|
-
include TimeMneumonics
|
12
|
-
|
13
|
-
module_function
|
14
|
-
|
15
|
-
def time_from_mneumonic(command_option:, relative_time: nil)
|
16
|
-
time_from_mneumonic!(command_option: command_option, relative_time: relative_time)
|
17
|
-
rescue ArgumentError
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
|
21
|
-
# command_option: is expected to me a time mneumonic. If relative_time is NOT nil, all
|
22
|
-
# time mneumonics are relative to relative_time. Otherwise, they are relative to Time.now.
|
23
|
-
# relative_time: is a Time object that is required IF command_option is expected to be
|
24
|
-
# a relative time mneumonic. Otherwise, it is optional.
|
25
|
-
def time_from_mneumonic!(command_option:, relative_time: nil)
|
26
|
-
validate_argument!(command_option: command_option, command_option_name: :command_option)
|
27
|
-
unless relative_time.nil? || relative_time.is_a?(::Time)
|
28
|
-
raise ArgumentError, "relative_time is not a Time object: \"#{relative_time}\""
|
29
|
-
end
|
30
|
-
|
31
|
-
relative_time ||= ::Time.now
|
32
|
-
|
33
|
-
time_for_mneumonic(mneumonic: command_option, relative_time: relative_time)
|
34
|
-
end
|
35
|
-
|
36
|
-
# This method returns true if mneumonic is a valid mneumonic OR
|
37
|
-
# a relative time mneumonic.
|
38
|
-
def time_mneumonic?(mneumonic)
|
39
|
-
mneumonic?(mneumonic) || relative_time_mneumonic?(mneumonic)
|
40
|
-
end
|
41
|
-
|
42
|
-
# This method returns true if mneumonic is a valid relative
|
43
|
-
# time mneumonic.
|
44
|
-
def relative_time_mneumonic?(mneumonic)
|
45
|
-
return false unless mneumonic.is_a?(String)
|
46
|
-
|
47
|
-
mneumonic.match?(RELATIVE_REGEX)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Add private_class_methods here.
|
51
|
-
|
52
|
-
# Returns a Time object from a mneumonic.
|
53
|
-
def time_for_mneumonic(mneumonic:, relative_time:)
|
54
|
-
time = relative_time
|
55
|
-
if today_mneumonic?(mneumonic)
|
56
|
-
time
|
57
|
-
elsif tomorrow_mneumonic?(mneumonic)
|
58
|
-
time.tomorrow
|
59
|
-
elsif yesterday_mneumonic?(mneumonic)
|
60
|
-
time.yesterday
|
61
|
-
elsif relative_time_mneumonic?(mneumonic)
|
62
|
-
relative_time_for(days_from_now: mneumonic, time: time)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def relative_time_for(days_from_now:, time:)
|
67
|
-
days_from_now.to_i.days.from_now(time)
|
68
|
-
end
|
69
|
-
|
70
|
-
# This method returns true if mneumonic is a valid time mneumonic.
|
71
|
-
# This method will return false if mneumonic is an invalid mneumonic
|
72
|
-
# OR if mneumonic is a relative time mneumonic.
|
73
|
-
def mneumonic?(mneumonic)
|
74
|
-
today_mneumonic?(mneumonic) ||
|
75
|
-
tomorrow_mneumonic?(mneumonic) ||
|
76
|
-
yesterday_mneumonic?(mneumonic)
|
77
|
-
end
|
78
|
-
|
79
|
-
def today_mneumonic?(mneumonic)
|
80
|
-
TODAY.include?(mneumonic)
|
81
|
-
end
|
82
|
-
|
83
|
-
def tomorrow_mneumonic?(mneumonic)
|
84
|
-
TOMORROW.include?(mneumonic)
|
85
|
-
end
|
86
|
-
|
87
|
-
def yesterday_mneumonic?(mneumonic)
|
88
|
-
YESERDAY.include?(mneumonic)
|
89
|
-
end
|
90
|
-
|
91
|
-
def validate_argument!(command_option:, command_option_name:)
|
92
|
-
raise ArgumentError, "#{command_option_name} cannot be nil." if command_option.nil?
|
93
|
-
raise ArgumentError, "#{command_option_name} cannot be blank." if command_option.blank?
|
94
|
-
unless command_option.is_a?(String)
|
95
|
-
raise ArgumentError, "#{command_option_name} must be a String: \"#{command_option}\""
|
96
|
-
end
|
97
|
-
unless time_mneumonic?(command_option)
|
98
|
-
raise ArgumentError, "#{command_option_name} is an invalid mneumonic: \"#{command_option}\"."
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
private_class_method :time_for_mneumonic, :relative_time_for,
|
103
|
-
:mneumonic?, :today_mneumonic?, :tomorrow_mneumonic?,
|
104
|
-
:yesterday_mneumonic?, :validate_argument!
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../models/color_theme'
|
4
|
-
require_relative '../support/color_themable'
|
5
|
-
|
6
|
-
module Dsu
|
7
|
-
module Support
|
8
|
-
module SubcommandHelpColorizable
|
9
|
-
class << self
|
10
|
-
def included(base)
|
11
|
-
base.extend(ClassMethods)
|
12
|
-
end
|
13
|
-
|
14
|
-
module ClassMethods
|
15
|
-
def command_help(shell, subcommand = false) # rubocop:disable Style/OptionalBooleanParameter
|
16
|
-
help_text = Services::StdoutRedirectorService.call { super }
|
17
|
-
puts apply_theme(help_text, theme_color: color_theme.help)
|
18
|
-
end
|
19
|
-
|
20
|
-
def color_theme
|
21
|
-
@color_theme ||= Models::ColorTheme.current_or_default
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|