doing 1.0.93 → 2.0.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS +19 -0
- data/CHANGELOG.md +590 -0
- data/COMMANDS.md +1181 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +110 -0
- data/LICENSE +23 -0
- data/README.md +15 -699
- data/Rakefile +79 -0
- data/_config.yml +1 -0
- data/bin/doing +1012 -486
- data/doing.fish +278 -0
- data/doing.gemspec +34 -0
- data/doing.rdoc +1759 -0
- data/example_plugin.rb +209 -0
- data/generate_completions.sh +4 -0
- data/img/doing-colors.jpg +0 -0
- data/img/doing-printf-wrap-800.jpg +0 -0
- data/img/doing-show-note-formatting-800.jpg +0 -0
- data/lib/completion/_doing.zsh +151 -0
- data/lib/completion/doing.bash +416 -0
- data/lib/completion/doing.fish +278 -0
- data/lib/doing/array.rb +8 -0
- data/lib/doing/cli_status.rb +66 -0
- data/lib/doing/colors.rb +136 -0
- data/lib/doing/configuration.rb +310 -0
- data/lib/doing/errors.rb +102 -0
- data/lib/doing/hash.rb +31 -0
- data/lib/doing/hooks.rb +59 -0
- data/lib/doing/item.rb +155 -0
- data/lib/doing/log_adapter.rb +342 -0
- data/lib/doing/markdown_document_listener.rb +174 -0
- data/lib/doing/note.rb +59 -0
- data/lib/doing/pager.rb +95 -0
- data/lib/doing/plugin_manager.rb +208 -0
- data/lib/doing/plugins/export/csv_export.rb +48 -0
- data/lib/doing/plugins/export/html_export.rb +83 -0
- data/lib/doing/plugins/export/json_export.rb +140 -0
- data/lib/doing/plugins/export/markdown_export.rb +85 -0
- data/lib/doing/plugins/export/taskpaper_export.rb +34 -0
- data/lib/doing/plugins/export/template_export.rb +141 -0
- data/lib/doing/plugins/import/cal_to_json.scpt +0 -0
- data/lib/doing/plugins/import/calendar_import.rb +76 -0
- data/lib/doing/plugins/import/doing_import.rb +144 -0
- data/lib/doing/plugins/import/timing_import.rb +78 -0
- data/lib/doing/string.rb +346 -0
- data/lib/doing/symbol.rb +16 -0
- data/lib/doing/time.rb +18 -0
- data/lib/doing/util.rb +186 -0
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +1831 -2358
- data/lib/doing/wwidfile.rb +117 -0
- data/lib/doing.rb +43 -3
- data/lib/examples/commands/wiki.rb +80 -0
- data/lib/examples/plugins/hooks.rb +22 -0
- data/lib/examples/plugins/say_export.rb +202 -0
- data/lib/examples/plugins/templates/wiki.css +169 -0
- data/lib/examples/plugins/templates/wiki.haml +27 -0
- data/lib/examples/plugins/templates/wiki_index.haml +18 -0
- data/lib/examples/plugins/wiki_export.rb +87 -0
- data/lib/templates/doing-markdown.erb +5 -0
- data/man/doing.1 +964 -0
- data/man/doing.1.html +711 -0
- data/man/doing.1.ronn +600 -0
- data/package-lock.json +3 -0
- data/rdoc_to_mmd.rb +42 -0
- data/rdocfixer.rb +13 -0
- data/scripts/generate_bash_completions.rb +210 -0
- data/scripts/generate_fish_completions.rb +201 -0
- data/scripts/generate_zsh_completions.rb +164 -0
- metadata +82 -7
- data/lib/doing/helpers.rb +0 -191
- data/lib/doing/markdown_export.rb +0 -16
data/lib/doing/helpers.rb
DELETED
@@ -1,191 +0,0 @@
|
|
1
|
-
##
|
2
|
-
## @brief Date helpers
|
3
|
-
##
|
4
|
-
class ::Time
|
5
|
-
def relative_date
|
6
|
-
if self > Date.today.to_time
|
7
|
-
strftime(' %_I:%M%P')
|
8
|
-
elsif self > (Date.today - 6).to_time
|
9
|
-
strftime('%a %_I:%M%P')
|
10
|
-
elsif self.year == Date.today.year
|
11
|
-
strftime('%m/%d %_I:%M%P')
|
12
|
-
else
|
13
|
-
strftime('%m/%d/%Y %_I:%M%P')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
##
|
19
|
-
## @brief Hash helpers
|
20
|
-
##
|
21
|
-
class ::Hash
|
22
|
-
def has_tags?(tags, bool = :and)
|
23
|
-
tags = tags.split(/ *, */) if tags.is_a? String
|
24
|
-
bool = bool.normalize_bool if bool.is_a? String
|
25
|
-
item = self
|
26
|
-
tags.map! {|t| t.strip.sub(/^@/, '')}
|
27
|
-
case bool
|
28
|
-
when :and
|
29
|
-
result = true
|
30
|
-
tags.each do |tag|
|
31
|
-
unless item['title'] =~ /@#{tag}/
|
32
|
-
result = false
|
33
|
-
break
|
34
|
-
end
|
35
|
-
end
|
36
|
-
result
|
37
|
-
when :not
|
38
|
-
result = true
|
39
|
-
tags.each do |tag|
|
40
|
-
if item['title'] =~ /@#{tag}/
|
41
|
-
result = false
|
42
|
-
break
|
43
|
-
end
|
44
|
-
end
|
45
|
-
result
|
46
|
-
else
|
47
|
-
result = false
|
48
|
-
tags.each do |tag|
|
49
|
-
if item['title'] =~ /@#{tag}/
|
50
|
-
result = true
|
51
|
-
break
|
52
|
-
end
|
53
|
-
end
|
54
|
-
result
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def matches_search?(search)
|
59
|
-
item = self
|
60
|
-
text = item['note'] ? item['title'] + item['note'].join(' ') : item['title']
|
61
|
-
pattern = if search.strip =~ %r{^/.*?/$}
|
62
|
-
search.sub(%r{/(.*?)/}, '\1')
|
63
|
-
else
|
64
|
-
search.split('').join('.{0,3}')
|
65
|
-
end
|
66
|
-
text =~ /#{pattern}/i ? true : false
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
##
|
71
|
-
## @brief String helpers
|
72
|
-
##
|
73
|
-
class ::String
|
74
|
-
def cap_first
|
75
|
-
sub(/^\w/) do |m|
|
76
|
-
m.upcase
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
##
|
82
|
-
## @brief Convert a boolean string to a symbol
|
83
|
-
##
|
84
|
-
## @return Symbol :and, :or, or :not
|
85
|
-
##
|
86
|
-
def normalize_bool!
|
87
|
-
replace normalize_bool
|
88
|
-
end
|
89
|
-
|
90
|
-
def normalize_bool(default = :and)
|
91
|
-
case self
|
92
|
-
when /(and|all)/i
|
93
|
-
:and
|
94
|
-
when /(any|or)/i
|
95
|
-
:or
|
96
|
-
when /(not|none)/i
|
97
|
-
:not
|
98
|
-
else
|
99
|
-
default.is_a?(Symbol) ? default : default.normalize_bool
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
|
104
|
-
##
|
105
|
-
## @brief Remove duplicate tags, leaving only first occurrence
|
106
|
-
##
|
107
|
-
## @return Deduplicated string
|
108
|
-
##
|
109
|
-
def dedup_tags!
|
110
|
-
replace dedup_tags
|
111
|
-
end
|
112
|
-
|
113
|
-
def dedup_tags
|
114
|
-
item = self.dup
|
115
|
-
tags = item.scan(/(?<=^| )(\@(\S+?)(\([^)]+\))?)(?=\b|$)/).uniq
|
116
|
-
tags.each do |tag|
|
117
|
-
found = false
|
118
|
-
item.gsub!(/( |^)#{tag[0]}\b/) do |m|
|
119
|
-
if found
|
120
|
-
''
|
121
|
-
else
|
122
|
-
found = true
|
123
|
-
m
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
item
|
128
|
-
end
|
129
|
-
|
130
|
-
##
|
131
|
-
## @brief Turn raw urls into HTML links
|
132
|
-
##
|
133
|
-
## @param opt (Hash) Additional Options
|
134
|
-
##
|
135
|
-
def link_urls!(opt = {})
|
136
|
-
replace link_urls(opt)
|
137
|
-
end
|
138
|
-
|
139
|
-
def link_urls(opt = {})
|
140
|
-
opt[:format] ||= :html
|
141
|
-
str = self.dup
|
142
|
-
|
143
|
-
if :format == :markdown
|
144
|
-
# Remove <self-linked> formatting
|
145
|
-
str.gsub!(/<(.*?)>/) do |match|
|
146
|
-
m = Regexp.last_match
|
147
|
-
if m[1] =~ /^https?:/
|
148
|
-
m[1]
|
149
|
-
else
|
150
|
-
match
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
# Replace qualified urls
|
156
|
-
str.gsub!(%r{(?mi)(?<!["'\[(\\])((http|https)://)([\w\-_]+(\.[\w\-_]+)+)([\w\-.,@?^=%&:/~+#]*[\w\-@^=%&/~+#])?}) do |_match|
|
157
|
-
m = Regexp.last_match
|
158
|
-
proto = m[1].nil? ? 'http://' : ''
|
159
|
-
case opt[:format]
|
160
|
-
when :html
|
161
|
-
%(<a href="#{proto}#{m[0]}" title="Link to #{m[0]}">[#{m[3]}]</a>)
|
162
|
-
when :markdown
|
163
|
-
"[#{m[0]}](#{proto}#{m[0]})"
|
164
|
-
else
|
165
|
-
m[0]
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# Clean up unlinked <urls>
|
170
|
-
str.gsub!(/<(\w+:.*?)>/) do |match|
|
171
|
-
m = Regexp.last_match
|
172
|
-
if m[1] =~ /<a href/
|
173
|
-
match
|
174
|
-
else
|
175
|
-
%(<a href="#{m[1]}" title="Link to #{m[1]}">[link]</a>)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
str
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
class ::Symbol
|
184
|
-
def normalize_bool!
|
185
|
-
replace normalize_bool
|
186
|
-
end
|
187
|
-
|
188
|
-
def normalize_bool
|
189
|
-
to_s.normalize_bool
|
190
|
-
end
|
191
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
##
|
2
|
-
## @brief Creates Markdown export
|
3
|
-
##
|
4
|
-
class MarkdownExport
|
5
|
-
attr_accessor :items, :page_title, :totals
|
6
|
-
|
7
|
-
def initialize(page_title, items, totals)
|
8
|
-
@page_title = page_title
|
9
|
-
@items = items
|
10
|
-
@totals = totals
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_binding
|
14
|
-
binding()
|
15
|
-
end
|
16
|
-
end
|