rbnotes 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -12
- data/Gemfile.lock +2 -2
- data/README.md +4 -4
- data/lib/rbnotes/commands/list.rb +42 -24
- data/lib/rbnotes/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 840d2acc4c93d5b03d833b6a518c9740518e025aeb3bb2b6751864d5cf9e9d1c
|
4
|
+
data.tar.gz: 759f8bdc29d64e32c73d7e02540603c3bdf84b6bdf3ac91b7a76bf8e3cf2005d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b47f361e68f7e5275b981848035621fd31342a994d6bd5d90002f91417f4806ba364714b4ea86728f993e43e74868bf08508701531361c4e785830cc772a5b2e
|
7
|
+
data.tar.gz: '09cea0ff486e4e2a8521d732296e64a520c7d076088dd63c05cc4a9c219a2be28e65e50234859bab0d2772a92fb466b1ffc580525fb3565e8d68f7f7f81f8eec'
|
data/CHANGELOG.md
CHANGED
@@ -7,8 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
## [Unreleased]
|
8
8
|
Nothing to record here.
|
9
9
|
|
10
|
+
## [0.4.5] - 2020-11-12
|
11
|
+
### Changed
|
12
|
+
- Add a feature to accept multiple args for `list`. (#57)
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
- Fix issue #54: Notes list does not sort correctly.
|
16
|
+
|
10
17
|
## [0.4.4] - 2020-11-09
|
11
|
-
###
|
18
|
+
### Changed
|
12
19
|
- Add a feature to use a keyword as an argument for `list`. (#47)
|
13
20
|
|
14
21
|
## [0.4.3] - 2020-11-08
|
@@ -20,14 +27,14 @@ Nothing to record here.
|
|
20
27
|
- Fix `add` fails without modification (#48)
|
21
28
|
|
22
29
|
## [0.4.2] - 2020-11-05
|
23
|
-
###
|
30
|
+
### Changed
|
24
31
|
- Add a feature to keep the timestamp in `update` command. (#44)
|
25
32
|
|
26
33
|
### Fixed
|
27
34
|
- Fix issue #45: hanging up of `add` command.
|
28
35
|
|
29
36
|
## [0.4.1] - 2020-11-04
|
30
|
-
###
|
37
|
+
### Changed
|
31
38
|
- Add a feature to accept a timestamp in `add` command. (#34)
|
32
39
|
|
33
40
|
## [0.4.0] - 2020-11-03
|
@@ -36,20 +43,21 @@ Nothing to record here.
|
|
36
43
|
|
37
44
|
## [0.3.1] - 2020-10-30
|
38
45
|
### Added
|
39
|
-
- Add feature to specify configuration file in the command
|
46
|
+
- Add a feature to specify configuration file in the command
|
47
|
+
line. (#21)
|
40
48
|
|
41
49
|
## [0.3.0] - 2020-10-29
|
42
|
-
###
|
50
|
+
### Changed
|
43
51
|
- Add feature to read argument from the standard input. (#27)
|
44
52
|
|
45
53
|
## [0.2.2] - 2020-10-27
|
46
|
-
###
|
47
|
-
- Add feature to accept a timestamp pattern in `list` command. (#22)
|
54
|
+
### Changed
|
55
|
+
- Add a feature to accept a timestamp pattern in `list` command. (#22)
|
48
56
|
|
49
57
|
## [0.2.1] - 2020-10-25
|
50
58
|
### Added
|
51
|
-
- Add feature to load the configuration from an external file.
|
52
|
-
- Add description about the configuration file in README.md
|
59
|
+
- Add a feature to load the configuration from an external file.
|
60
|
+
- Add a description about the configuration file in README.md.
|
53
61
|
|
54
62
|
## [0.2.0] - 2020-10-23
|
55
63
|
### Added
|
@@ -59,15 +67,15 @@ Nothing to record here.
|
|
59
67
|
- Add a new task into `Rakefile` to generate RI docs.
|
60
68
|
- The intention of the task is to verify RI docs.
|
61
69
|
|
62
|
-
###
|
70
|
+
### Changed
|
63
71
|
- Refactor some tests.
|
64
72
|
|
65
73
|
## [0.1.3] - 2020-10-15
|
66
|
-
###
|
74
|
+
### Changed
|
67
75
|
- Add help text for the `conf` command.
|
68
76
|
|
69
77
|
## [0.1.2] - 2020-10-15
|
70
|
-
###
|
78
|
+
### Changed
|
71
79
|
- Adapt the API change in `textrepo` (0.4.0).
|
72
80
|
|
73
81
|
## [0.1.0] - 2020-10-12
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbnotes (0.4.
|
4
|
+
rbnotes (0.4.5)
|
5
5
|
textrepo (~> 0.5.4)
|
6
6
|
unicode-display_width (~> 1.7)
|
7
7
|
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
minitest (5.14.2)
|
12
12
|
rake (13.0.1)
|
13
|
-
textrepo (0.5.
|
13
|
+
textrepo (0.5.6)
|
14
14
|
unicode-display_width (1.7.0)
|
15
15
|
|
16
16
|
PLATFORMS
|
data/README.md
CHANGED
@@ -164,10 +164,10 @@ don't have to set `:searcher_options` for them.
|
|
164
164
|
|
165
165
|
| searcher | default options in `textrepo` |
|
166
166
|
|:---------|:---------------------------------------------------|
|
167
|
-
| `grep` | `["-i", "-n", "-R", "-E"]`
|
168
|
-
| `egrep` | `["-i", "-n", "-R"]`
|
169
|
-
| `ggrep` | `["-i", "-n", "-R", "-E"]`
|
170
|
-
| `gegrep` | `["-i", "-n", "-R"]`
|
167
|
+
| `grep` | `["-i", "-n", "-H", "-R", "-E"]` |
|
168
|
+
| `egrep` | `["-i", "-n", "-H", "-R"]` |
|
169
|
+
| `ggrep` | `["-i", "-n", "-H", "-R", "-E"]` |
|
170
|
+
| `gegrep` | `["-i", "-n", "-H", "-R"]` |
|
171
171
|
| `rg` | `["-S", "-n", "--no-heading", "--color", "never"]` |
|
172
172
|
|
173
173
|
Those searcher names are used in macOS (with Homebrew). Any other OS
|
@@ -15,11 +15,23 @@ module Rbnotes::Commands
|
|
15
15
|
end
|
16
16
|
|
17
17
|
##
|
18
|
-
# Shows a list of notes in the repository.
|
19
|
-
# optional. If
|
20
|
-
# timestamp
|
21
|
-
#
|
22
|
-
#
|
18
|
+
# Shows a list of notes in the repository. Arguments are
|
19
|
+
# optional. If several args are passed, each of them must be a
|
20
|
+
# timestamp pattern or a keyword.
|
21
|
+
#
|
22
|
+
# Any order of timestamp patterns and keywords mixture is
|
23
|
+
# acceptable. The redundant patterns are just ignored.
|
24
|
+
#
|
25
|
+
# A timestamp pattern is a string which would match several
|
26
|
+
# Timestamp objects. A timestamp is an instance of
|
27
|
+
# Textrepo::Timestamp class.
|
28
|
+
#
|
29
|
+
# A keyword must be one of them:
|
30
|
+
#
|
31
|
+
# - "today" (or "to")
|
32
|
+
# - "yeasterday" (or "ye")
|
33
|
+
# - "this_week" (or "tw")
|
34
|
+
# - "last_week" (or "lw")
|
23
35
|
#
|
24
36
|
# Here is several examples of timestamp patterns.
|
25
37
|
#
|
@@ -43,28 +55,13 @@ module Rbnotes::Commands
|
|
43
55
|
# execute(Array, Rbnotes::Conf or Hash) -> nil
|
44
56
|
|
45
57
|
def execute(args, conf)
|
46
|
-
|
47
|
-
patterns = []
|
48
|
-
|
49
|
-
case arg.to_s
|
50
|
-
when "today", "to"
|
51
|
-
patterns << Textrepo::Timestamp.new(Time.now).to_s[0..7]
|
52
|
-
when "yesterday", "ye"
|
53
|
-
t = Time.now
|
54
|
-
patterns << Date.new(t.year, t.mon, t.day).prev_day.strftime("%Y%m%d")
|
55
|
-
when "this_week", "tw"
|
56
|
-
patterns.concat(dates_in_this_week)
|
57
|
-
when "last_week", "lw"
|
58
|
-
patterns.concat(dates_in_last_week)
|
59
|
-
else
|
60
|
-
patterns << arg
|
61
|
-
end
|
58
|
+
patterns = args.size > 0 ? convert_keyword(args) : [nil]
|
62
59
|
|
63
60
|
@repo = Textrepo.init(conf)
|
64
|
-
stamps = patterns.map { |pat|
|
65
|
-
@repo.entries(pat).sort{|a, b| b <=> a}
|
66
|
-
}.flatten
|
67
61
|
# newer stamp shoud be above
|
62
|
+
stamps = patterns.map { |pat|
|
63
|
+
@repo.entries(pat)
|
64
|
+
}.flatten.sort{|a, b| b <=> a}.uniq
|
68
65
|
stamps.each { |timestamp|
|
69
66
|
puts make_headline(timestamp)
|
70
67
|
}
|
@@ -145,6 +142,27 @@ HELP
|
|
145
142
|
str.sub(/^#+ +/, '')
|
146
143
|
end
|
147
144
|
|
145
|
+
def convert_keyword(args)
|
146
|
+
patterns = []
|
147
|
+
while args.size > 0
|
148
|
+
arg = args.shift
|
149
|
+
case arg.to_s
|
150
|
+
when "today", "to"
|
151
|
+
patterns << Textrepo::Timestamp.new(Time.now).to_s[0..7]
|
152
|
+
when "yesterday", "ye"
|
153
|
+
t = Time.now
|
154
|
+
patterns << Date.new(t.year, t.mon, t.day).prev_day.strftime("%Y%m%d")
|
155
|
+
when "this_week", "tw"
|
156
|
+
patterns.concat(dates_in_this_week)
|
157
|
+
when "last_week", "lw"
|
158
|
+
patterns.concat(dates_in_last_week)
|
159
|
+
else
|
160
|
+
patterns << arg
|
161
|
+
end
|
162
|
+
end
|
163
|
+
patterns.sort!.uniq
|
164
|
+
end
|
165
|
+
|
148
166
|
# week day for Monday start calendar
|
149
167
|
def wday(time)
|
150
168
|
(time.wday - 1) % 7
|
data/lib/rbnotes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbnotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mnbi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: textrepo
|