module Doing

Main doing module

Cribbed from github.com/flori/term-ansicolor

title: CSV Export description: Export CSV formatted data with header row author: Brett Terpstra url: brettterpstra.com

title: Day One Export description: Export entries to Day One plist for auto import author: Brett Terpstra url: brettterpstra.com

title: HTML Export description: Export styled HTML view of data author: Brett Terpstra url: brettterpstra.com

title: JSON Export description: Export JSON-formatted data, including entry durations and tag totals author: Brett Terpstra url: brettterpstra.com

title: Markdown Export description: Export GFM-style task list author: Brett Terpstra url: brettterpstra.com

title: TaskPaper Export description: Export TaskPaper-friendly data author: Brett Terpstra url: brettterpstra.com

title: Template Export description: Default export option using configured template placeholders author: Brett Terpstra url: brettterpstra.com

title: Doing Format Import description: Import entries from a Doing-formatted file author: Brett Terpstra url: brettterpstra.com

title: Timing.app Import description: Import entries from a Timing.app report (JSON) author: Brett Terpstra url: brettterpstra.com

title: Capture Thing Import description: Import entries from a Capture Thing folder author: Brett Terpstra url: brettterpstra.com

Example

doing show -o sayit

Configuration

Change what the plugin says by generating a template with doing template --type say, saving it to a file, and putting the path to that file in export_templates->say in .doingrc.

export_templates: say: /path/to/template.txt

Use a different voice by adding a say_voice key to your .doingrc. Use say -v ? to see available voices.

say_voice: Zarvox

title: HTML Export description: Export styled HTML view of data author: Brett Terpstra url: brettterpstra.com

Constants

VERSION

Attributes

auto_tag[RW]

Public Class Methods

add_to_day_one(entry, config) click to toggle source

Add the entry to Day One using the CLI

@param entry The entry to add

# File lib/examples/plugins/hooks.rb, line 43
def self.add_to_day_one(entry, config)
  dayone = TTY::Which.which('dayone2')
  flagged = entry.tags?('flagged') ? ' -s' : ''
  tags = entry.tags.map { |t| Shellwords.escape(t) }.join(' ')
  tags = tags.length.positive? ? " -t #{tags}" : ''
  date = " -d '#{entry.date.strftime('%Y-%m-%d %H:%M:%S')}'"
  title = entry.title.tag(config['day_one_trigger'], remove: true)
  title += "\n#{entry.note}" unless entry.note.empty?
  `echo #{Shellwords.escape(title)} | #{dayone} new#{flagged}#{date}#{tags}`
end
config() click to toggle source

Holds a Configuration object with methods and a @settings hash

@return [Configuration] Configuration object

# File lib/doing.rb, line 75
def config
  @config ||= Configuration.new
end
config_with(file, options = {}) click to toggle source

Update configuration from specified file

@param file [String] Path to new config file @param options [Hash] options

@option options :ignore_local Ignore local configuration files

# File lib/doing.rb, line 131
def config_with(file, options = {})
  @config = Configuration.new(file, options: options)
end
logger() click to toggle source

Fetch the logger

@return the Logger instance.

# File lib/doing.rb, line 66
def logger
  @logger ||= Logger.new((ENV['DOING_LOG_LEVEL'] || :info).to_sym)
end
set(keypath, value) click to toggle source
# File lib/doing.rb, line 116
def set(keypath, value)
  real_path = config.resolve_key_path(keypath, create: false)
  return nil unless real_path&.count&.positive?

  config.settings.deep_set(real_path, value)
end
setting(keypath, default = nil) click to toggle source

Fetch a config setting using a dot-separated keypath or array of keys

@param keypath [String|Array] Either a dot-separated key path (search.case) or array of keys (['search', 'case']) @param default A default value to return if the provided path returns nil result

# File lib/doing.rb, line 99
def setting(keypath, default = nil)
  cfg = config.settings
  case keypath
  when Array
    cfg.dig(*keypath) || default
  when String
    unless keypath =~ /^[.*]?$/
      real_path = config.resolve_key_path(keypath, create: false)
      return default unless real_path&.count&.positive?

      cfg = cfg.dig(*real_path)
    end

    cfg.nil? ? default : cfg
  end
end
settings() click to toggle source

Shortcut for Doing.config.settings

@return [Hash] Settings hash

# File lib/doing.rb, line 84
def settings
  config.settings
end