work-md 0.4.3 → 0.4.4

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: 7f44d4a6782b7211c58b01812b8ad00048ac2509abbdc60a20397dd2c16ee3a3
4
- data.tar.gz: e1bc2d24ec7dbe29540e0105663d31c93b8da49c5a29056217ff6c7d311dee60
3
+ metadata.gz: 7dba8433c9dbfaa9a989aeb3fd986a1917aa54d43da9bb4af2e7389a46979938
4
+ data.tar.gz: 2d1540ff631bf222f970efe6a53504704f7f6425247732d1a83340938e9e305e
5
5
  SHA512:
6
- metadata.gz: 587defdc3bf40c0801ea7b1f624974345e2c112cecb6417637fac295891066735440f43c3845574c524357c36453e2b84a33ade5b4ff62881f475cc3c3ecc200
7
- data.tar.gz: 96389252eabac8037b98e2f05d56fab7631b64df53f99bc727cac903e80ffd9c22251f80ab9a29175f8768f9a11c7b9178bb68653fdaf2bd062db9120b7ff441
6
+ metadata.gz: 585e1dece08f50f1b323e751f0bf3d711c69f453773996b2281aef334e11ed564fef356425cd55ea17c79dda36d38724de2759fd717777e8aec8f16a0e1d3609
7
+ data.tar.gz: 137a09fd7e7bdffa9fa64eacc26213f148509dd68461196d9d63aec359d65ac07534ae1b24f1e4dd51af10f8d2b992c33c349a165c9c0874cf5cdb971bcf8764
@@ -6,7 +6,26 @@ module Work
6
6
  class Plast
7
7
  class << self
8
8
  def execute(argv = [])
9
- last_n = argv.first.to_i
9
+ is_numeric = ->(str) {
10
+ str == "#{str.to_f}" || str == "#{str.to_i}"
11
+ }
12
+
13
+ if is_numeric.(argv.first)
14
+ last_n = argv.first.to_i
15
+ else
16
+ Work::Md::Cli.help(
17
+ ::TTY::Box.frame(
18
+ "message: 'plast' command accept only numeric arguments, you give: #{argv.inspect}",
19
+ '',
20
+ 'Usage example:',
21
+ '',
22
+ 'work-md pl 7 # parse the last 7 days',
23
+ **Work::Md::Cli.error_frame_style
24
+ )
25
+ )
26
+ return
27
+ end
28
+
10
29
  last_date = Date.today.prev_day
11
30
  work_dir = Work::Md::Config.work_dir
12
31
  parser = Work::Md::Parser::Engine.new
@@ -28,7 +28,7 @@ module Work
28
28
  raise IS_FROZEN_ERROR_MESSAGE if @frozen
29
29
 
30
30
  begin
31
- file_content = ::File.read(file)
31
+ file_content = ::File.read(file).squeeze(' ').strip
32
32
  rescue Errno::ENOENT
33
33
  return
34
34
  end
@@ -187,7 +187,12 @@ module Work
187
187
  end
188
188
 
189
189
  def basic_parse(content, start_with: nil)
190
- return content.split("#{start_with}:\n")[1] unless start_with.nil?
190
+ unless start_with.nil?
191
+ return content
192
+ .split("#{start_with}:")[1]
193
+ .squeeze(' ')
194
+ .sub("\n\n", "\n")
195
+ end
191
196
 
192
197
  content.split(":\n\n")[1]
193
198
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Work
4
4
  module Md
5
- VERSION = '0.4.3'
5
+ VERSION = '0.4.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work-md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Fernandez Teixeira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2021-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-box