Class: Doing::WWID
- Inherits:
-
Object
- Object
- Doing::WWID
- Defined in:
- lib/doing/wwid.rb
Overview
Main "What Was I Doing" methods
Instance Attribute Summary collapse
-
#additional_configs ⇒ Object
readonly
Returns the value of attribute additional_configs.
-
#auto_tag ⇒ Object
Returns the value of attribute auto_tag.
-
#config ⇒ Object
Returns the value of attribute config.
-
#config_file ⇒ Object
Returns the value of attribute config_file.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#current_section ⇒ Object
readonly
Returns the value of attribute current_section.
-
#default_option ⇒ Object
Returns the value of attribute default_option.
-
#doing_file ⇒ Object
readonly
Returns the value of attribute doing_file.
Instance Method Summary collapse
-
#act_on(items, opt = {}) ⇒ Object
Perform actions on a set of entries.
-
#add_item(title, section = nil, opt = {}) ⇒ Object
Adds an entry.
-
#add_section(title) ⇒ Object
Adds a section.
- #all_tags(items, opt: {}) ⇒ Object
-
#archive(section = @config['current_section'], options = {}) ⇒ Object
Move entries from a section to Archive or other specified section.
-
#autotag(text) ⇒ Object
Uses 'autotag' configuration to turn keywords into tags for time tracking.
-
#choose_from(options, prompt: 'Make a selection: ', multiple: false, sorted: true, fzf_args: []) ⇒ String
Generate a menu of options and allow user selection.
- #choose_from_items(items, opt = {}, include_section: false) ⇒ Object
-
#choose_section ⇒ String
Generate a menu of sections and allow user selection.
-
#choose_view ⇒ String
Generate a menu of views and allow user selection.
-
#chronify(input, future: false, guess: :begin) ⇒ DateTime
Converts input string into a Time object when input takes on the following formats: - interval format e.g.
-
#chronify_qty(qty) ⇒ Integer
Converts simple strings into seconds that can be added to a Time object.
-
#create(filename = nil) ⇒ Object
Create a new doing file.
-
#dedup(items, no_overlap = false) ⇒ Object
Remove items from a list that already exist in @content.
-
#delete_item(item, single: false) ⇒ Object
Delete an item from the index.
-
#edit_last(section: 'All', options: {}) ⇒ Object
Edit the last entry.
-
#filter_items(items = [], opt: {}) ⇒ Object
Filter items based on search criteria.
-
#fork_editor(input = '') ⇒ Object
Create a process for an editor and wait for the file handle to return.
-
#format_input(input) ⇒ Array
Takes a multi-line string and formats it as an entry.
-
#format_time(seconds, human: false) ⇒ Object
Format human readable time from seconds.
-
#get_interval(item, formatted: true, record: true) ⇒ Object
Gets the interval between entry's start date and @done date.
-
#get_view(title) ⇒ Object
Gets a view from configuration.
-
#guess_section(frag, guessed: false, suggest: false) ⇒ Object
Attempt to match a string with an existing section.
-
#guess_view(frag, guessed: false, suggest: false) ⇒ Object
Attempt to match a string with an existing view.
-
#import(paths, opt = {}) ⇒ Object
Imports external entries.
-
#init_doing_file(path = nil) ⇒ Object
Initializes the doing file.
-
#initialize ⇒ WWID
constructor
Initializes the object.
-
#interactive(opt = {}) ⇒ Object
Display an interactive menu of entries.
-
#last(times: true, section: nil, options: {}) ⇒ Object
Show the last entry.
-
#last_entry(opt = {}) ⇒ Object
Get the last entry.
-
#last_note(section = 'All') ⇒ Object
Return the content of the last note for a given section.
-
#list_date(dates, section, times = nil, output = nil, opt = {}) ⇒ Object
Display entries within a date range.
-
#list_section(opt = {}) ⇒ Object
Display contents of a section based on options.
-
#logger ⇒ Object
Logger.
-
#move_item(item, section, label: true) ⇒ Item
Move item from current section to destination section.
-
#next_item(item, options = {}) ⇒ Item
Get next item in the index.
-
#recent(count = 10, section = nil, opt = {}) ⇒ Object
Show recent entries.
- #repeat_item(item, opt = {}) ⇒ Object
-
#repeat_last(opt = {}) ⇒ Object
Restart the last entry.
- #reset_item(item, resume: false) ⇒ Object
-
#restore_backup(file) ⇒ Object
Restore a backed up version of a file.
-
#rotate(opt = {}) ⇒ Object
Rename doing file with date and start fresh one.
-
#sections ⇒ Array
List sections.
-
#stop_start(target_tag, opt = {}) ⇒ Object
Accepts one tag and the raw text of a new item if the passed tag is on any item, it's replaced with @done.
- #tag_groups(items, opt: {}) ⇒ Object
-
#tag_item(item, tags, remove: false, date: false, single: false) ⇒ Item
Tag an item from the index.
-
#tag_last(opt = {}) ⇒ Object
Tag the last entry or X entries.
-
#tag_times(format: :text, sort_by_name: false, sort_order: 'asc') ⇒ Object
Get total elapsed time for all tags in selection.
-
#today(times = true, output = nil, opt = {}) ⇒ Object
Show all entries from the current day.
-
#update_item(old_item, new_item) ⇒ Object
Update an item in the index with a modified item.
-
#views ⇒ Array
List available views.
-
#write(file = nil, backup: true) ⇒ Object
Write content to file or STDOUT.
-
#yesterday(section, times = nil, output = nil, opt = {}) ⇒ Object
Show entries from the previous day.
-
#yn(question, default_response: false) ⇒ Bool
Ask a yes or no question in the terminal.
Constructor Details
#initialize ⇒ WWID
Initializes the object.
Instance Attribute Details
#additional_configs ⇒ Object (readonly)
Returns the value of attribute additional_configs.
#auto_tag ⇒ Object
Returns the value of attribute auto_tag.
#config ⇒ Object
Returns the value of attribute config.
#config_file ⇒ Object
Returns the value of attribute config_file.
#content ⇒ Object (readonly)
Returns the value of attribute content.
#current_section ⇒ Object (readonly)
Returns the value of attribute current_section.
#default_option ⇒ Object
Returns the value of attribute default_option.
#doing_file ⇒ Object (readonly)
Returns the value of attribute doing_file.
Instance Method Details
#act_on(items, opt = {}) ⇒ Object
Perform actions on a set of entries. If no valid action is included in the opt hash and the terminal is a TTY, a menu will be presented
#add_item(title, section = nil, opt = {}) ⇒ Object
Adds an entry
#add_section(title) ⇒ Object
Adds a section.
#all_tags(items, opt: {}) ⇒ Object
#archive(section = @config['current_section'], options = {}) ⇒ Object
Move entries from a section to Archive or other specified section
#autotag(text) ⇒ Object
Uses 'autotag' configuration to turn keywords into tags for time tracking. Does not repeat tags in a title, and only converts the first instance of an untagged keyword
#choose_from(options, prompt: 'Make a selection: ', multiple: false, sorted: true, fzf_args: []) ⇒ String
Generate a menu of options and allow user selection
#choose_from_items(items, opt = {}, include_section: false) ⇒ Object
#choose_section ⇒ String
Generate a menu of sections and allow user selection
#choose_view ⇒ String
Generate a menu of views and allow user selection
#chronify(input, future: false, guess: :begin) ⇒ DateTime
Converts input string into a Time object when input takes on the following formats: - interval format e.g. '1d2h30m', '45m' etc. - a semantic phrase e.g. 'yesterday 5:30pm' - a strftime e.g. '2016-03-15 15:32:04 PDT'
#chronify_qty(qty) ⇒ Integer
Converts simple strings into seconds that can be added to a Time object
#create(filename = nil) ⇒ Object
Create a new doing file
#dedup(items, no_overlap = false) ⇒ Object
Remove items from a list that already exist in @content
#delete_item(item, single: false) ⇒ Object
Delete an item from the index
#edit_last(section: 'All', options: {}) ⇒ Object
Edit the last entry
#filter_items(items = [], opt: {}) ⇒ Object
Filter items based on search criteria
#fork_editor(input = '') ⇒ Object
Create a process for an editor and wait for the file handle to return
#format_input(input) ⇒ Array
Takes a multi-line string and formats it as an entry
#format_time(seconds, human: false) ⇒ Object
Format human readable time from seconds
#get_interval(item, formatted: true, record: true) ⇒ Object
Gets the interval between entry's start date and @done date
#get_view(title) ⇒ Object
Gets a view from configuration
#guess_section(frag, guessed: false, suggest: false) ⇒ Object
Attempt to match a string with an existing section
#guess_view(frag, guessed: false, suggest: false) ⇒ Object
Attempt to match a string with an existing view
#import(paths, opt = {}) ⇒ Object
Imports external entries
#init_doing_file(path = nil) ⇒ Object
Initializes the doing file.
#interactive(opt = {}) ⇒ Object
Display an interactive menu of entries
#last(times: true, section: nil, options: {}) ⇒ Object
Show the last entry
#last_entry(opt = {}) ⇒ Object
Get the last entry
#last_note(section = 'All') ⇒ Object
Return the content of the last note for a given section
#list_date(dates, section, times = nil, output = nil, opt = {}) ⇒ Object
Display entries within a date range
#list_section(opt = {}) ⇒ Object
Display contents of a section based on options
#logger ⇒ Object
Logger
Responds to :debug, :info, :warn, and :error
Each method takes a topic, and a message or block
Example: debug('Hooks', 'Hook 1 triggered')
#move_item(item, section, label: true) ⇒ Item
Move item from current section to destination section
#next_item(item, options = {}) ⇒ Item
Get next item in the index
#recent(count = 10, section = nil, opt = {}) ⇒ Object
Show recent entries
#repeat_item(item, opt = {}) ⇒ Object
#repeat_last(opt = {}) ⇒ Object
Restart the last entry
#reset_item(item, resume: false) ⇒ Object
#restore_backup(file) ⇒ Object
Restore a backed up version of a file
#rotate(opt = {}) ⇒ Object
Rename doing file with date and start fresh one
#sections ⇒ Array
List sections
#stop_start(target_tag, opt = {}) ⇒ Object
Accepts one tag and the raw text of a new item if the passed tag is on any item, it's replaced with @done. if new_item is not nil, it's tagged with the passed tag and inserted. This is for use where only one instance of a given tag should exist (@meanwhile)
#tag_groups(items, opt: {}) ⇒ Object
#tag_item(item, tags, remove: false, date: false, single: false) ⇒ Item
Tag an item from the index
#tag_last(opt = {}) ⇒ Object
Tag the last entry or X entries
#tag_times(format: :text, sort_by_name: false, sort_order: 'asc') ⇒ Object
Get total elapsed time for all tags in selection
#today(times = true, output = nil, opt = {}) ⇒ Object
Show all entries from the current day
#update_item(old_item, new_item) ⇒ Object
Update an item in the index with a modified item
#views ⇒ Array
List available views
#write(file = nil, backup: true) ⇒ Object
Write content to file or STDOUT
#yesterday(section, times = nil, output = nil, opt = {}) ⇒ Object
Show entries from the previous day
#yn(question, default_response: false) ⇒ Bool
Ask a yes or no question in the terminal