rbnotes 0.4.15 → 0.4.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54f0c34e51ca307615ee9995cf7daeb2f65dff0a3aaa41df305f3414ce6e197e
4
- data.tar.gz: 48bb529501aabc93ec78dd3fa6d984e11eb4a5dfb8e823d8ea6bdcb80e065e9c
3
+ metadata.gz: a3f023516dcf1e39f18c6cd0195a548debfd635e23d476bdb7e89a6ddc5f981e
4
+ data.tar.gz: 52507a17c873c8732922e1cc5990fa41d74f36fca1f558fa5440090f3fcd9fe2
5
5
  SHA512:
6
- metadata.gz: b51574083b7d894773b1f597e693209ea6a152533d0035342f4e88f764ac925bf8fe1effd0b81b1a17200d1d5b6e386a0f12c4d790746aae4a6ee7896aa3b990
7
- data.tar.gz: 59032141edc6f7335d6f6b00c76da7c64f983be04825603b9f3feaa3213e4599b55eff19744df446e5d66b1f8248c523f926a155de3a9d1a5f94a907afea7646
6
+ metadata.gz: '0946450a7eeda50688cc5dc836ce30e86d5db28e2af8dca8e84805026648ba018116e98d5b3d316339960a0273d1e717178c4832932418440e0db3c1d1b4e9a9'
7
+ data.tar.gz: 125c3c6fa116fc5cf13d82ba6fb522972b82364b61002de2adc6d36ab1f6d77051f89a948a7cc9ec28acce8179399b040bfc4d983e1c83c65bb2548cc44ee8eb
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
  ## [Unreleased]
8
8
  - Nothing to record here.
9
9
 
10
+ ## [0.4.16] - 2021-04-17
11
+ - Add a new configuration setting to change the default behavior of
12
+ the `list` (and `pick`) command. (#109)
13
+
10
14
  ## [0.4.15] - 2021-04-15
11
15
  - Enable to use delimiters within a timestamp string. (#104)
12
16
  - Fix issue #105: `list` ignores the 2nd arg when specified `-w`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbnotes (0.4.15)
4
+ rbnotes (0.4.16)
5
5
  textrepo (~> 0.5.8)
6
6
  unicode-display_width (~> 1.7)
7
7
 
@@ -10,6 +10,8 @@ module Rbnotes::Commands
10
10
  "List notes"
11
11
  end
12
12
 
13
+ DEFAULT_BEHAVIOR = "today" # :nodoc:
14
+
13
15
  ##
14
16
  # Shows a list of notes in the repository. Arguments are
15
17
  # optional. If several args are passed, each of them must be a
@@ -56,6 +58,11 @@ module Rbnotes::Commands
56
58
  @opts = {}
57
59
  parse_opts(args)
58
60
 
61
+ if args.empty?
62
+ default_behavior = conf[:list_default] || DEFAULT_BEHAVIOR
63
+ args << default_behavior
64
+ end
65
+
59
66
  utils = Rbnotes.utils
60
67
  patterns = utils.read_timestamp_patterns(args, enum_week: @opts[:enum_week])
61
68
 
@@ -68,13 +75,13 @@ module Rbnotes::Commands
68
75
  timestamps.each { |timestamp|
69
76
  pad = " "
70
77
  output << utils.make_headline(timestamp,
71
- @repo.read(timestamp), pad)
78
+ @repo.read(timestamp), pad)
72
79
  }
73
80
  }
74
81
  else
75
82
  notes.each { |timestamp|
76
83
  output << utils.make_headline(timestamp,
77
- @repo.read(timestamp))
84
+ @repo.read(timestamp))
78
85
  }
79
86
  end
80
87
  puts output
@@ -9,10 +9,17 @@ module Rbnotes::Commands
9
9
  "Pick a timestamp with a picker program"
10
10
  end
11
11
 
12
+ DEFAULT_BEHAVIOR = "today" # :nodoc:
13
+
12
14
  def execute(args, conf)
13
15
  @opts = {}
14
16
  parse_opts(args)
15
17
 
18
+ if args.empty?
19
+ default_behavior = conf[:list_default] || DEFAULT_BEHAVIOR
20
+ args << default_behavior
21
+ end
22
+
16
23
  utils = Rbnotes.utils
17
24
  patterns = utils.read_timestamp_patterns(args, enum_week: @opts[:enum_week])
18
25
 
data/lib/rbnotes/utils.rb CHANGED
@@ -247,17 +247,18 @@ module Rbnotes
247
247
  # - "last_week" (or "lw")
248
248
  # - "this_month" (or "tm")
249
249
  # - "last_month" (or "lm")
250
+ # - "all"
250
251
  #
251
252
  # :call-seq:
252
253
  # expand_keyword_in_args(Array of Strings) -> Array of Strings
253
254
  #
254
255
  def expand_keyword_in_args(args)
255
- return [nil] if args.empty?
256
-
257
256
  patterns = []
258
257
  while args.size > 0
259
258
  arg = args.shift
260
- if KEYWORDS.include?(arg)
259
+ if arg == "all"
260
+ return [nil]
261
+ elsif KEYWORDS.include?(arg)
261
262
  patterns.concat(expand_keyword(arg))
262
263
  else
263
264
  patterns << arg
@@ -1,4 +1,4 @@
1
1
  module Rbnotes
2
- VERSION = "0.4.15"
3
- RELEASE = "2021-04-15"
2
+ VERSION = "0.4.16"
3
+ RELEASE = "2021-04-17"
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.15
4
+ version: 0.4.16
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-15 00:00:00.000000000 Z
11
+ date: 2021-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: textrepo