work-md 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/work/md/commands/plast.rb +20 -1
- data/lib/work/md/parser/engine.rb +7 -2
- data/lib/work/md/version.rb +1 -1
- 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: 7dba8433c9dbfaa9a989aeb3fd986a1917aa54d43da9bb4af2e7389a46979938
|
4
|
+
data.tar.gz: 2d1540ff631bf222f970efe6a53504704f7f6425247732d1a83340938e9e305e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
data/lib/work/md/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-box
|