work-md 0.4.9 → 0.4.91
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/work-md.rb +1 -1
- data/lib/work/md/cli.rb +2 -1
- data/lib/work/md/commands/daily.rb +70 -0
- data/lib/work/md/config.rb +9 -3
- data/lib/work/md/date_file.rb +3 -3
- data/lib/work/md/file.rb +1 -1
- data/lib/work/md/version.rb +1 -1
- data/lib/work/md.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a55beb3be3c6aa6e71b58f7522f0a78fb6093370f89b6a631a3478e62623078b
|
4
|
+
data.tar.gz: bdc684d99630d3b4b41f1f9cc2fe958bc607ef3907f75c300d504764890fdf18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 528f98fa5f6275186ee7057dbcf165f8a5d30edfd012d2ae86fd394511055bbddc4f3405574e205bc60e742d8c8e2dbc031de864e2b669226e4c09d9128a006f
|
7
|
+
data.tar.gz: 291f52d9d0bfba1ddd6fa09fba96c54a44aeb012fcf4c664384c92c45ad97dbb74561da14da03e13508bc5ecc86eab5a64e80f4f0776ac4cc68cc9b61e6be189
|
data/bin/work-md.rb
CHANGED
data/lib/work/md/cli.rb
CHANGED
@@ -21,7 +21,7 @@ module Work
|
|
21
21
|
'tl' => 'tlast'
|
22
22
|
}.freeze
|
23
23
|
|
24
|
-
def self.execute(argv)
|
24
|
+
def self.execute(argv, development: false)
|
25
25
|
first_argv_argument = argv.shift
|
26
26
|
tag = fetch_argv_keys(argv)['tag']
|
27
27
|
|
@@ -70,6 +70,7 @@ module Work
|
|
70
70
|
'- work-md parse',
|
71
71
|
'- work-md plast',
|
72
72
|
'- work-md annotations',
|
73
|
+
'- work-md daily',
|
73
74
|
'- work-md open',
|
74
75
|
'- work-md config',
|
75
76
|
'',
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Work
|
4
|
+
module Md
|
5
|
+
module Commands
|
6
|
+
class Daily
|
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..160).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
|
+
parser_today = Work::Md::Parser::Engine.new
|
23
|
+
parser_today.add_file("#{work_dir}/#{today_file_name}")
|
24
|
+
parser_today.freeze
|
25
|
+
|
26
|
+
parser_last_day = Work::Md::Parser::Engine.new
|
27
|
+
parser_last_day.add_file("#{work_dir}/#{last_file_name}")
|
28
|
+
parser_last_day.freeze
|
29
|
+
|
30
|
+
daily_file_path = work_dir + '/daily.md'
|
31
|
+
::File.delete(daily_file_path) if ::File.exist? daily_file_path
|
32
|
+
|
33
|
+
t = Work::Md::Config.translations
|
34
|
+
|
35
|
+
ajust_line = lambda do |line|
|
36
|
+
get_first_line = ->(multiline_string) do
|
37
|
+
lines = multiline_string.split("\n")
|
38
|
+
first_line = lines.first
|
39
|
+
return first_line
|
40
|
+
end
|
41
|
+
|
42
|
+
get_first_line.call(line.sub('x]', '-').sub(']', '-'))
|
43
|
+
end
|
44
|
+
|
45
|
+
::File.open(daily_file_path, 'w+') do |f|
|
46
|
+
f.puts("📅 Daily\n\n")
|
47
|
+
f.puts("#{t[:did]}:\n")
|
48
|
+
parser_last_day.tasks.each do |task|
|
49
|
+
f.puts("#{ajust_line.call(task)}\n") if task != ' ]'
|
50
|
+
end
|
51
|
+
parser_last_day.meetings.each do |meeting|
|
52
|
+
f.puts("#{ajust_line.call(meeting)}\n") if meeting != ' ]'
|
53
|
+
end
|
54
|
+
f.puts("\n")
|
55
|
+
f.puts("#{t[:todo]}:\n")
|
56
|
+
parser_today.tasks.each do |task|
|
57
|
+
f.puts("#{ajust_line.call(task)}\n") if task != ' ]'
|
58
|
+
end
|
59
|
+
parser_today.meetings.each do |meeting|
|
60
|
+
f.puts("#{ajust_line.call(meeting)}\n") if meeting != ' ]'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
Work::Md::File.open_in_editor([daily_file_path])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/work/md/config.rb
CHANGED
@@ -17,7 +17,9 @@ module Work
|
|
17
17
|
pomodoros: 'Pomodoros / Ciclos',
|
18
18
|
per_day: 'por dia',
|
19
19
|
total: 'total',
|
20
|
-
days_bars: 'Resumo'
|
20
|
+
days_bars: 'Resumo',
|
21
|
+
did: 'Feito',
|
22
|
+
todo: 'Planejado'
|
21
23
|
},
|
22
24
|
'en' =>
|
23
25
|
{
|
@@ -29,7 +31,9 @@ module Work
|
|
29
31
|
pomodoros: 'Pomodoros / Cycles',
|
30
32
|
per_day: 'per day',
|
31
33
|
total: 'all',
|
32
|
-
days_bars: 'Summary'
|
34
|
+
days_bars: 'Summary',
|
35
|
+
did: 'Done',
|
36
|
+
todo: 'To do'
|
33
37
|
},
|
34
38
|
'es' =>
|
35
39
|
{
|
@@ -41,7 +45,9 @@ module Work
|
|
41
45
|
pomodoros: 'Pomodoros / Ciclos',
|
42
46
|
per_day: 'por dÃa',
|
43
47
|
total: 'total',
|
44
|
-
days_bars: 'Abstracto'
|
48
|
+
days_bars: 'Abstracto',
|
49
|
+
did: 'Hecho',
|
50
|
+
todo: 'Planificado'
|
45
51
|
}
|
46
52
|
}.freeze
|
47
53
|
|
data/lib/work/md/date_file.rb
CHANGED
@@ -12,7 +12,7 @@ module Work
|
|
12
12
|
def self.list_file_paths_by_argv_query(argv, create_inexistent: false)
|
13
13
|
file_paths = []
|
14
14
|
|
15
|
-
argv_keys_to_files =
|
15
|
+
argv_keys_to_files = lambda { |argv_keys, acc_file_paths|
|
16
16
|
year = argv_keys['y'] || Time.new.year
|
17
17
|
month = argv_keys['m'] || Time.new.month
|
18
18
|
|
@@ -43,8 +43,8 @@ module Work
|
|
43
43
|
acc_file_paths
|
44
44
|
}
|
45
45
|
|
46
|
-
argv.join('#').split('#and#').map { |v| v.split(
|
47
|
-
argv_keys_to_files.(Work::Md::Cli.fetch_argv_keys(args), file_paths)
|
46
|
+
argv.join('#').split('#and#').map { |v| v.split('#') }.each do |args|
|
47
|
+
argv_keys_to_files.call(Work::Md::Cli.fetch_argv_keys(args), file_paths)
|
48
48
|
end
|
49
49
|
|
50
50
|
file_paths
|
data/lib/work/md/file.rb
CHANGED
@@ -6,7 +6,7 @@ module Work
|
|
6
6
|
def self.create_and_open_parsed(parser)
|
7
7
|
parser.freeze
|
8
8
|
|
9
|
-
parsed_file_path = Work::Md::Config.work_dir
|
9
|
+
parsed_file_path = "#{Work::Md::Config.work_dir}/parsed.md"
|
10
10
|
t = Work::Md::Config.translations
|
11
11
|
|
12
12
|
::File.delete(parsed_file_path) if ::File.exist? parsed_file_path
|
data/lib/work/md/version.rb
CHANGED
data/lib/work/md.rb
CHANGED
@@ -17,6 +17,7 @@ require_relative 'md/commands/delete'
|
|
17
17
|
require_relative 'md/parser/engine'
|
18
18
|
require_relative 'md/commands/parse'
|
19
19
|
require_relative 'md/commands/plast'
|
20
|
+
require_relative 'md/commands/daily'
|
20
21
|
require_relative 'md/cli'
|
21
22
|
require 'date'
|
22
23
|
require 'fileutils'
|
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.91
|
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:
|
11
|
+
date: 2024-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-box
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/work/md/cli.rb
|
69
69
|
- lib/work/md/commands/annotations.rb
|
70
70
|
- lib/work/md/commands/config.rb
|
71
|
+
- lib/work/md/commands/daily.rb
|
71
72
|
- lib/work/md/commands/delete.rb
|
72
73
|
- lib/work/md/commands/last.rb
|
73
74
|
- lib/work/md/commands/open.rb
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '0'
|
105
106
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
107
|
+
rubygems_version: 3.3.7
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: Track your work activities, write annotations, recap what you did for a week,
|