diff --git a/Gemfile.lock b/Gemfile.lock index f6949770..cf87bd53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - doing (2.1.58) + doing (2.1.59) chronic (~> 0.10, >= 0.10.2) deep_merge (~> 1.2, >= 1.2.1) gli (~> 2.20, >= 2.20.1) @@ -40,7 +40,7 @@ GEM rdoc (6.3.3) redcarpet (3.5.1) rexml (3.2.5) - rouge (3.28.0) + rouge (3.29.0) safe_yaml (1.0.5) strings (0.2.1) strings-ansi (~> 0.2) diff --git a/README.md b/README.md index 387a2dbd..49d26fbd 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ _If you're one of the rare people like me who find this useful, feel free to -The current version of `doing` is 2.1.57. +The current version of `doing` is 2.1.58. Find all of the documentation in the [doing wiki][wiki]. diff --git a/bin/commands/done.rb b/bin/commands/done.rb index 2ee556be..458b80f9 100644 --- a/bin/commands/done.rb +++ b/bin/commands/done.rb @@ -84,16 +84,14 @@ section = Doing.setting('current_section') end - note = Doing::Note.new note.add(options[:note]) if options[:note] - if options[:ask] && !options[:editor] - note.add(Doing::Prompt.read_lines(prompt: 'Add a note')) - end + note.add(Doing::Prompt.read_lines(prompt: 'Add a note')) if options[:ask] && !options[:editor] if options[:editor] raise MissingEditor, 'No EDITOR variable defined in environment' if Doing::Util.default_editor.nil? + is_new = false if args.empty? @@ -122,6 +120,11 @@ note.add(ask_note) if ask_note.good? end + if Doing.auto_tag + title = @wwid.autotag(title) + title.add_tags!(Doing.setting('default_tags')) if Doing.setting('default_tags').good? + end + date = d.nil? ? date : d new_entry = Doing::Item.new(date, title, section, note) if new_entry.should_finish? @@ -171,6 +174,12 @@ new_note.add(options[:note]) title.chomp! section = 'Archive' if options[:archive] + + if Doing.auto_tag + title = @wwid.autotag(title) + title.add_tags!(Doing.setting('default_tags')) if Doing.setting('default_tags').good? + end + new_entry = Doing::Item.new(date, title, section, new_note) if new_entry.should_finish? diff --git a/lib/doing/completion/completion_string.rb b/lib/doing/completion/completion_string.rb index b1cb8a41..d3d35493 100644 --- a/lib/doing/completion/completion_string.rb +++ b/lib/doing/completion/completion_string.rb @@ -1,10 +1,21 @@ module Doing module Completion module StringUtils + + ## + ## Get short description for command completion + ## + ## @return [String] Short description + ## def short_desc split(/[,.]/)[0].sub(/ \(.*?\)?$/, '').strip end + ## + ## Truncate string from left + ## + ## @param max The maximum number of characters + ## def ltrunc(max) if length > max sub(/^.*?(.{#{max - 3}})$/, '...\1') diff --git a/lib/doing/string/query.rb b/lib/doing/string/query.rb index 1a5447aa..ba974b18 100644 --- a/lib/doing/string/query.rb +++ b/lib/doing/string/query.rb @@ -85,6 +85,11 @@ def to_rx(distance: nil, case_type: nil) Regexp.new(pattern, !case_sensitive) end + ## + ## Returns a phrase query (elastic search) representation of the object as a phrase parser. + ## + ## @return Phrase query representation of the object. + ## def to_phrase_query parser = PhraseParser::QueryParser.new transformer = PhraseParser::QueryTransformer.new @@ -92,6 +97,11 @@ def to_phrase_query transformer.apply(parse_tree).to_elasticsearch end + ## + ## Returns a query (elastic search) representation of the object as a boolean term parser. + ## + ## @return Query representation of the object. + ## def to_query parser = BooleanTermParser::QueryParser.new transformer = BooleanTermParser::QueryTransformer.new diff --git a/lib/doing/version.rb b/lib/doing/version.rb index 98caafcf..aaa7ab59 100644 --- a/lib/doing/version.rb +++ b/lib/doing/version.rb @@ -1,3 +1,3 @@ module Doing - VERSION = '2.1.58' + VERSION = '2.1.59' end diff --git a/lib/doing/wwid/modify.rb b/lib/doing/wwid/modify.rb index cad4f266..0909fae0 100644 --- a/lib/doing/wwid/modify.rb +++ b/lib/doing/wwid/modify.rb @@ -159,7 +159,6 @@ def repeat_last(opt) write(@doing_file) end - ## ## Tag the last entry or X entries ##