work-md 0.3.10 → 0.4.0

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
- SHA1:
3
- metadata.gz: 536c5338145316ed33c03cf959b02c4ef1272f9c
4
- data.tar.gz: 4aec526afbd5eb318727a0a7466813856dcba970
2
+ SHA256:
3
+ metadata.gz: 6b2365dee8d1e62694565724b031df8975b11a9eafab0eb2290956915fdfcc89
4
+ data.tar.gz: d1ef9938b25eb53b38535374872c9d567759c1ddddcee9ad3c54030277453d61
5
5
  SHA512:
6
- metadata.gz: 52784d41c3612a41408ba48755e48790a96b61a76362059031a0509092106f5cbd1c6dd74b6d8dd50261d8f533a47b8df787be83bdfa780b6c20387bdad27232
7
- data.tar.gz: d4c730abe51cd1ba28b3dbda73f3ad862b034215a054b904d2d6ab0b81c873c7b676e7e79aedd37ed6ca0cff40627daa7486ab8a4c48fc79be8e35b47fc198fd
6
+ metadata.gz: 7e2a875215334876bc1bd28be738fe2ce8500c8186604e87797439b0f654d0dfce7049ba44f6d6d78a4f5962d72a86674d4d9b5920f1a91d56f40bcff06cc574
7
+ data.tar.gz: 6b2696a31327292c75b1b62e8f17e1cb9b0cc483cd04f44f416412a73767a20f7f9ebf7baa95117d36382bb81a1e212825cb59a8060034a2f682dc0d959cc946
data/lib/work/md/cli.rb CHANGED
@@ -12,7 +12,9 @@ module Work
12
12
  'y' => 'yesterday',
13
13
  'c' => 'config',
14
14
  'p' => 'parse',
15
- 'a' => 'annotations'
15
+ 'a' => 'annotations',
16
+ 'l' => 'last',
17
+ 'tl' => 'tlast'
16
18
  }.freeze
17
19
 
18
20
  def self.execute(argv)
@@ -27,7 +29,7 @@ module Work
27
29
  Object
28
30
  .const_get("Work::Md::Commands::#{command}")
29
31
  .send(:execute, argv)
30
- rescue NameError
32
+ rescue NameError => e
31
33
  puts help(
32
34
  ::TTY::Box.frame(
33
35
  "Command '#{first_argv_argument}' not found!",
@@ -50,6 +52,8 @@ module Work
50
52
  '- work-md today',
51
53
  '- work-md yesterday',
52
54
  '- work-md tyesterday',
55
+ '- work-md last',
56
+ '- work-md tlast',
53
57
  '- work-md parse',
54
58
  '- work-md annotations',
55
59
  '- work-md config',
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Work
4
+ module Md
5
+ module Commands
6
+ class Last
7
+ class << self
8
+ def execute(_argv = [])
9
+ found_file = false
10
+ current_day = Date.today.prev_day
11
+ work_dir = Work::Md::Config.work_dir
12
+
13
+ (1..90).each do
14
+
15
+ file_name = "#{current_day.strftime('%Y/%m/%d')}.md"
16
+
17
+ if ::File.exist?("#{work_dir}/#{file_name}")
18
+ Work::Md::File.open_in_editor([file_name])
19
+ found_file = true
20
+ break
21
+ end
22
+
23
+ current_day = current_day.prev_day
24
+ end
25
+
26
+ unless found_file
27
+ Work::Md::Cli.help(
28
+ ::TTY::Box.frame(
29
+ "message: No file found in last 90 days",
30
+ **Work::Md::Cli.error_frame_style
31
+ )
32
+ )
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -102,10 +102,11 @@ module Work
102
102
  '',
103
103
  'Usage examples:',
104
104
  '',
105
- 'work-md parse -d=1 -m=5 -y=2000 | get day 1 from month 5 and year 2000',
106
- 'work-md parse -d=1,2,3 | get day 1, 2 and 3 from the current month and year',
107
- 'work-md parse -d=1,2 -m=4 | get day 1 and 2 from month 4 and current year',
108
- 'work-md parse -d=1..10 -m=4 | get day 1 to 10 from month 4 and current year',
105
+ 'work-md p -d=1 -m=5 -y=2000 # get day 1 from month 5 and year 2000',
106
+ 'work-md p -d=1,2,3 # get day 1, 2 and 3 from the current month and year',
107
+ 'work-md p -d=1,2 -m=4 # get day 1 and 2 from month 4 and current year',
108
+ 'work-md p -d=1..10 -m=4 # get day 1 to 10 from month 4 and current year',
109
+ 'work-md p -d=1..25 -m=2 and -d=1..25 -m=2 -y=1999 # get day 1 to 25 from month 2 and current year and 1 to 25 from month 2 in 1999',
109
110
  **Work::Md::Cli.error_frame_style
110
111
  )
111
112
  )
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Work
4
+ module Md
5
+ module Commands
6
+ class Tlast
7
+ class << self
8
+ def execute(_argv = [])
9
+ last_date = Date.today.prev_day
10
+ work_dir = Work::Md::Config.work_dir
11
+ last_file_name = nil
12
+
13
+ (1..90).each do
14
+ last_file_name = "#{last_date.strftime('%Y/%m/%d')}.md"
15
+ break if ::File.exist?("#{work_dir}/#{last_file_name}")
16
+
17
+ last_date = last_date.prev_day
18
+ end
19
+
20
+ today_file_name = Work::Md::DateFile.create_if_not_exist(DateTime.now)
21
+
22
+ Work::Md::File.open_in_editor([today_file_name, last_file_name].compact)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Work
4
4
  module Md
5
- VERSION = '0.3.10'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
data/lib/work/md.rb CHANGED
@@ -9,6 +9,8 @@ require_relative 'md/commands/config'
9
9
  require_relative 'md/commands/yesterday'
10
10
  require_relative 'md/commands/tyesterday'
11
11
  require_relative 'md/commands/annotations'
12
+ require_relative 'md/commands/last'
13
+ require_relative 'md/commands/tlast'
12
14
  require_relative 'md/parser/engine'
13
15
  require_relative 'md/commands/parse'
14
16
  require_relative 'md/cli'
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.3.10
4
+ version: 0.4.0
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-09-17 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-box
@@ -54,7 +54,9 @@ files:
54
54
  - lib/work/md/cli.rb
55
55
  - lib/work/md/commands/annotations.rb
56
56
  - lib/work/md/commands/config.rb
57
+ - lib/work/md/commands/last.rb
57
58
  - lib/work/md/commands/parse.rb
59
+ - lib/work/md/commands/tlast.rb
58
60
  - lib/work/md/commands/today.rb
59
61
  - lib/work/md/commands/tyesterday.rb
60
62
  - lib/work/md/commands/yesterday.rb
@@ -83,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  - !ruby/object:Gem::Version
84
86
  version: '0'
85
87
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.6.14.4
88
+ rubygems_version: 3.2.22
88
89
  signing_key:
89
90
  specification_version: 4
90
91
  summary: Track your work activities, write annotations, recap what you did for a week,