rbnotes 0.4.18 → 0.4.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a831d67abfd0bae05156f047b6baf44428bc4940058e43bfb9825b5d91c4177
4
- data.tar.gz: 7fb70e39e9feb75edfabe3461697ddfb0145cf449205c25068471687952908d0
3
+ metadata.gz: 6b77835e83f5e0d1397d86e19cde13466b02cfb84d211d2521c7180f2e362861
4
+ data.tar.gz: 28821a8a8b53df64caf1c06baa83d61ffd63ae4a739199971e9d560111fc709f
5
5
  SHA512:
6
- metadata.gz: 7ea3b1ea6517130e5ba5ece651da8f3e30f1013aaa40aa375ad16fb09a7e07a033c7da4e59a721fade178ed4720cf804cb60cc843ea42cbcb177fdf81f947f01
7
- data.tar.gz: 6a19760bdecd4b967717c30bed0974a8098d5b3f9e9df9a90bd81cd6b1498a6ba226f2e5654547f1ec67da9beb3d54c740ab9895163d8488df9801b74539f8aa
6
+ metadata.gz: 1aad71bb657dd5c3fd9ec40b493fb3290df4e21a4b333bd8c7bb1cfe0368ae226eff1cee04615fc2f7a5cd7054593de20924d1722e88743d9faf686eb8959298
7
+ data.tar.gz: 3c4a1631efceb61c11f90cc3c97dcdeeb9a7b8dee3cc5cabb3b5071af9e97ce01296fefba830a346edfdf7fd28a3a6930793b1d09e185c3d0c2615bf73f18d32
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
  ## [Unreleased]
8
8
  - (nothing to record here)
9
9
 
10
+ ## [0.4.19] - 2021-05-24
11
+ ### Added
12
+ - Add an option to search in only the subject of each note. (#128)
13
+
14
+ ### Modified
15
+ - Update copyright year in `LICENSE`. (#127)
16
+
17
+ ### Fixed
18
+ - Fix #129: add description about the keyword, "all."
19
+
10
20
  ## [0.4.18] - 2021-04-29
11
21
  ### Added
12
22
  - Use ERB to generate the initial content of a new note from the
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbnotes (0.4.18)
4
+ rbnotes (0.4.19)
5
5
  textrepo (~> 0.5.8)
6
6
  unicode-display_width (~> 1.7)
7
7
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 mnbi
3
+ Copyright (c) 2020, 2021 mnbi
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +33,7 @@ module Rbnotes::Commands
33
33
  # - "last_week" (or "lw")
34
34
  # - "this_month" (or "tm")
35
35
  # - "last_month" (or "lm")
36
+ # - "all"
36
37
  #
37
38
  # Here is several examples of timestamp patterns.
38
39
  #
@@ -106,23 +107,6 @@ OPTIONS:
106
107
  -v, --verbose
107
108
  -w, --week
108
109
 
109
- STAMP_PATTERN must be:
110
-
111
- (a) full qualified timestamp (with suffix): "20201030160200"
112
- (b) year and date part: "20201030"
113
- (c) year and month part: "202010"
114
- (d) year part only: "2020"
115
- (e) date part only: "1030"
116
-
117
- KEYWORD:
118
-
119
- - "today" (or "to")
120
- - "yeasterday" (or "ye")
121
- - "this_week" (or "tw")
122
- - "last_week" (or "lw")
123
- - "this_month" (or "tm")
124
- - "last_month" (or "lm")
125
-
126
110
  An option "--verbose" is acceptable. It specifies to counts number of
127
111
  notes by each day, then put it with the date before notes. It looks
128
112
  like as follows:
@@ -140,11 +124,32 @@ days of a week. Typically, the option is used with a STAMP_PATTERN
140
124
  which specifies a date, such "20201117", then it enumerates all days
141
125
  of the week which contains "17th November 2020".
142
126
 
127
+ STAMP_PATTERN must be:
128
+
129
+ (a) full qualified timestamp (with suffix): "20201030160200"
130
+ (b) year and date part: "20201030"
131
+ (c) year and month part: "202010"
132
+ (d) year part only: "2020"
133
+ (e) date part only: "1030"
134
+
143
135
  A STAMP_PATTERN other than (a) and (b) causes an error if it was used
144
136
  with "--week" option.
145
137
 
146
138
  When no STAMP_PATTERN was specified with "--week" option, the output
147
139
  would be as same as the KEYWORD, "this_week" was specified.
140
+
141
+ KEYWORD:
142
+
143
+ - "today" (or "to")
144
+ - "yeasterday" (or "ye")
145
+ - "this_week" (or "tw")
146
+ - "last_week" (or "lw")
147
+ - "this_month" (or "tm")
148
+ - "last_month" (or "lm")
149
+ - "all"
150
+
151
+ The keyword, "all" specifies to enumerate all notes in the repository.
152
+
148
153
  HELP
149
154
  end
150
155
 
@@ -29,6 +29,9 @@ module Rbnotes::Commands
29
29
  end
30
30
 
31
31
  def execute(args, conf)
32
+ @opts = {}
33
+ parse_opts(args)
34
+
32
35
  pattern = args.shift
33
36
  raise MissingArgumentError, args if pattern.nil?
34
37
 
@@ -46,11 +49,18 @@ module Rbnotes::Commands
46
49
  def help # :nodoc:
47
50
  puts <<HELP
48
51
  usage:
49
- #{Rbnotes::NAME} search PATTERN [STAMP_PATTERN]
52
+ #{Rbnotes::NAME} search [OPTIONS] PATTERN [STAMP_PATTERN]
50
53
 
51
54
  PATTERN is a word (or words) to search, it may also be a regular
52
55
  expression.
53
56
 
57
+ OPTIONS:
58
+ -s, --subject-only
59
+
60
+ An option "--subject-only" is acceptable. It specifies to search in
61
+ only the subject of each note. The subject means the first line of
62
+ the note text.
63
+
54
64
  STAMP_PATTERN must be:
55
65
 
56
66
  (a) full qualified timestamp (with suffix): "20201030160200"
@@ -58,11 +68,25 @@ STAMP_PATTERN must be:
58
68
  (c) year and month part: "202010"
59
69
  (d) year part only: "2020"
60
70
  (e) date part only: "1030"
71
+
61
72
  HELP
62
73
  end
63
74
 
64
75
  private
65
76
 
77
+ def parse_opts(args)
78
+ while args.size > 0
79
+ arg = args.shift
80
+ case arg
81
+ when "-s", "--subject-only"
82
+ @opts[:subject_only] = true
83
+ else
84
+ args.unshift(arg)
85
+ break
86
+ end
87
+ end
88
+ end
89
+
66
90
  # Each entry of search result is:
67
91
  #
68
92
  # [<timestamp>, <line_number>, <matched_text>]
@@ -84,6 +108,10 @@ HELP
84
108
  }
85
109
 
86
110
  def print_search_result(entries)
111
+ if @opts[:subject_only]
112
+ entries.select!{|e| e.line_number == 1}
113
+ end
114
+
87
115
  maxcol_stamp = entries.map(&:timestamp_size).max
88
116
  maxcol_num = entries.map(&:line_number_digits_size).max
89
117
 
@@ -91,7 +119,11 @@ HELP
91
119
  stamp_display = "%- *s" % [maxcol_stamp, e.timestamp]
92
120
  num_display = "%*d" % [maxcol_num, e.line_number]
93
121
 
94
- puts "#{stamp_display}: #{num_display}: #{e.matched_text}"
122
+ if @opts[:subject_only]
123
+ puts "#{stamp_display}: #{e.matched_text}"
124
+ else
125
+ puts "#{stamp_display}: #{num_display}: #{e.matched_text}"
126
+ end
95
127
  }
96
128
  end
97
129
 
@@ -1,4 +1,4 @@
1
1
  module Rbnotes
2
- VERSION = "0.4.18"
3
- RELEASE = "2021-04-29"
2
+ VERSION = "0.4.19"
3
+ RELEASE = "2021-05-24"
4
4
  end
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.18
4
+ version: 0.4.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - mnbi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-29 00:00:00.000000000 Z
11
+ date: 2021-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: textrepo