markdo 0.1.10 → 0.1.11
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 +4 -4
- data/lib/markdo/cli.rb +3 -0
- data/lib/markdo/forecast_command.rb +61 -0
- data/lib/markdo/help_command.rb +1 -0
- data/lib/markdo/version.rb +1 -1
- data/lib/markdo/week_command.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3af72a1862891028263caacca3bd0d95932aacb5
|
4
|
+
data.tar.gz: 25594deae9cd552eb401f00acfbd8cd6fd7aedfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 137137bbf1175513b0c2f5711f09b67c62c7afac050cbef6da61e5605cf3a0de57b5d5954b2c1415cc8b9c3f1057c3883ac937efa07085c333b4c19526bd81f5
|
7
|
+
data.tar.gz: ac0ead1ae05ead74ec67b08f67fdd9fd506a2119ce2efa0eeedd8527a070a018503e3a02dd9f8a39e9e8f0bd461cca3fbb740a79a68e670bb8f9607cf84aa3bd
|
data/lib/markdo/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'markdo/add_command'
|
2
2
|
require 'markdo/edit_command'
|
3
|
+
require 'markdo/forecast_command'
|
3
4
|
require 'markdo/help_command'
|
4
5
|
require 'markdo/ics_command'
|
5
6
|
require 'markdo/inbox_command'
|
@@ -28,6 +29,8 @@ module Markdo
|
|
28
29
|
AddCommand
|
29
30
|
when 'edit'
|
30
31
|
EditCommand
|
32
|
+
when 'forecast'
|
33
|
+
ForecastCommand
|
31
34
|
when 'ics'
|
32
35
|
IcsCommand
|
33
36
|
when 'inbox'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'stringio'
|
3
|
+
require 'markdo/query_command'
|
4
|
+
require 'markdo/week_command'
|
5
|
+
|
6
|
+
module Markdo
|
7
|
+
# TODO: More testing of this logic. As of 2016-01-23, I was building this
|
8
|
+
# project as a proof of concept.
|
9
|
+
class ForecastCommand < WeekCommand
|
10
|
+
def initialize(*)
|
11
|
+
@date = Date.today
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
# This is pretty ugly, but works. Just testing out how useful the concept is.
|
17
|
+
dates = dates_over_the_next_week
|
18
|
+
dates.shift
|
19
|
+
dates.shift
|
20
|
+
|
21
|
+
dates.each do |query|
|
22
|
+
stringio = StringIO.new
|
23
|
+
query_command = QueryCommand.new(stringio, @stderr, @env)
|
24
|
+
query_command.run(query)
|
25
|
+
|
26
|
+
abbreviation = weekday_abbreviation(query)
|
27
|
+
count = stringio.string.split("\n").length
|
28
|
+
|
29
|
+
@stdout.puts("#{abbreviation}: #{count}")
|
30
|
+
end
|
31
|
+
|
32
|
+
stringio = StringIO.new
|
33
|
+
next_week_command = WeekCommand.new(stringio, @stderr, @env)
|
34
|
+
next_week_command.date = @date + 7
|
35
|
+
next_week_command.run
|
36
|
+
next_week_count = stringio.string.split("\n").length
|
37
|
+
@stdout.puts("Next: #{next_week_count}")
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def abbreviations_by_wday(wday)
|
43
|
+
abbrevs = {
|
44
|
+
0 => 'Su',
|
45
|
+
1 => 'Mo',
|
46
|
+
2 => 'Tu',
|
47
|
+
3 => 'We',
|
48
|
+
4 => 'Th',
|
49
|
+
5 => 'Fr',
|
50
|
+
6 => 'Sa',
|
51
|
+
}
|
52
|
+
|
53
|
+
abbrevs[wday]
|
54
|
+
end
|
55
|
+
|
56
|
+
def weekday_abbreviation(iso8601_date)
|
57
|
+
wday = Date.strptime(iso8601_date, '%Y-%m-%d').wday
|
58
|
+
abbreviations_by_wday(wday)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/markdo/help_command.rb
CHANGED
@@ -8,6 +8,7 @@ Markdown-based task manager.
|
|
8
8
|
|
9
9
|
add "string" Add a task to the inbox. (Set $MARKDO_ROOT and $MARKDO_INBOX.)
|
10
10
|
edit Edit $MARKDO_ROOT in $EDITOR.
|
11
|
+
forecast Display counts of dates in the next week. (YYYY-MM-DD format.)
|
11
12
|
help, --help Display this help text.
|
12
13
|
inbox Display contents of $MARKDO_INBOX.
|
13
14
|
ics Make an iCalendar feed of all due dates in Markdo. Can be imported
|
data/lib/markdo/version.rb
CHANGED
data/lib/markdo/week_command.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Oakes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/markdo/date_command.rb
|
77
77
|
- lib/markdo/edit_command.rb
|
78
78
|
- lib/markdo/fake_version.rb
|
79
|
+
- lib/markdo/forecast_command.rb
|
79
80
|
- lib/markdo/help_command.rb
|
80
81
|
- lib/markdo/ics_command.rb
|
81
82
|
- lib/markdo/inbox_command.rb
|