Class: Hiiro

Inherits:
Object
  • Object
show all
Defined in:
lib/hiiro.rb,
lib/hiiro/db.rb,
lib/hiiro/git.rb,
lib/hiiro/tui.rb,
lib/hiiro/bins.rb,
lib/hiiro/glob.rb,
lib/hiiro/link.rb,
lib/hiiro/tags.rb,
lib/hiiro/tmux.rb,
lib/hiiro/todo.rb,
lib/hiiro/paths.rb,
lib/hiiro/queue.rb,
lib/hiiro/rbenv.rb,
lib/hiiro/shell.rb,
lib/hiiro/tasks.rb,
lib/hiiro/branch.rb,
lib/hiiro/config.rb,
lib/hiiro/git/pr.rb,
lib/hiiro/capture.rb,
lib/hiiro/effects.rb,
lib/hiiro/matcher.rb,
lib/hiiro/options.rb,
lib/hiiro/project.rb,
lib/hiiro/version.rb,
lib/hiiro/projects.rb,
lib/hiiro/registry.rb,
lib/hiiro/registry.rb,
lib/hiiro/reminder.rb,
lib/hiiro/app_files.rb,
lib/hiiro/check_run.rb,
lib/hiiro/fuzzyfind.rb,
lib/hiiro/pane_home.rb,
lib/hiiro/pinned_pr.rb,
lib/hiiro/tmux/pane.rb,
lib/hiiro/any_struct.rb,
lib/hiiro/app_record.rb,
lib/hiiro/assignment.rb,
lib/hiiro/background.rb,
lib/hiiro/git/branch.rb,
lib/hiiro/git/remote.rb,
lib/hiiro/input_file.rb,
lib/hiiro/invocation.rb,
lib/hiiro/pin_record.rb,
lib/hiiro/tmux/panes.rb,
lib/hiiro/runner_tool.rb,
lib/hiiro/task_colors.rb,
lib/hiiro/task_record.rb,
lib/hiiro/tmux/buffer.rb,
lib/hiiro/tmux/window.rb,
lib/hiiro/git/branches.rb,
lib/hiiro/git/worktree.rb,
lib/hiiro/notification.rb,
lib/hiiro/tmux/buffers.rb,
lib/hiiro/tmux/session.rb,
lib/hiiro/tmux/windows.rb,
lib/hiiro/git/worktrees.rb,
lib/hiiro/tmux/sessions.rb,
lib/hiiro/service_manager.rb,
lib/hiiro/pinned_pr_manager.rb

Defined Under Namespace

Modules: Background, DB, Effects, TaskColors, Tasks, Tui Classes: AnyStruct, App, AppFiles, AppRecord, Args, Assignment, Bins, Branch, Capture, CheckRun, Config, Environment, FallbackTarget, Fuzzyfind, Git, Glob, InputFile, Invocation, InvocationResolution, Link, Matcher, Notification, Options, PaneHome, Paths, PinRecord, PinnedPRManager, PinnedPr, Project, Projects, PsProcess, Queue, Rbenv, RegistryEntry, Reminder, Result, RunnerTool, Runners, ServiceManager, Shell, SparseGroups, Tag, Tags, Task, TaskManager, TaskRecord, Tmux, TodoItem, TodoManager, Tree

Constant Summary collapse

WORK_DIR =
File.join(Dir.home, 'work')
REPO_PATH =
File.join(WORK_DIR, '.git')
PrefixMatcher =

Backward compatibility alias

Matcher
VERSION =
"0.1.353"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bin, *all_args, logging: false, tasks: false, task_scope: nil, **values) ⇒ Hiiro

Returns a new instance of Hiiro.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/hiiro.rb', line 158

def initialize(bin, *all_args, logging: false, tasks: false, task_scope: nil, **values)
  @bin = bin
  @bin_name = File.basename(bin)
  @all_args = all_args
  @subcmd, *@args = all_args # normally i would never do this
  @loaded_plugins = []
  @logging = logging
  @tasks_enabled = tasks
  @task_scope = task_scope
  @global_values = values
  @full_command = [
    bin_name,
    *all_args,
  ].map(&:shellescape).join(' ')
end

Instance Attribute Details

#all_argsObject (readonly)

Returns the value of attribute all_args.



150
151
152
# File 'lib/hiiro.rb', line 150

def all_args
  @all_args
end

#argsObject (readonly)

Returns the value of attribute args.



151
152
153
# File 'lib/hiiro.rb', line 151

def args
  @args
end

#binObject (readonly)

Returns the value of attribute bin.



150
151
152
# File 'lib/hiiro.rb', line 150

def bin
  @bin
end

#bin_nameObject (readonly)

Returns the value of attribute bin_name.



150
151
152
# File 'lib/hiiro.rb', line 150

def bin_name
  @bin_name
end

#full_commandObject (readonly)

Returns the value of attribute full_command.



150
151
152
# File 'lib/hiiro.rb', line 150

def full_command
  @full_command
end

#global_valuesObject (readonly)

Returns the value of attribute global_values.



154
155
156
# File 'lib/hiiro.rb', line 154

def global_values
  @global_values
end

#loaded_pluginsObject (readonly)

Returns the value of attribute loaded_plugins.



152
153
154
# File 'lib/hiiro.rb', line 152

def loaded_plugins
  @loaded_plugins
end

#loggingObject (readonly)

Returns the value of attribute logging.



153
154
155
# File 'lib/hiiro.rb', line 153

def logging
  @logging
end

#optsObject (readonly)

Returns the value of attribute opts.



156
157
158
# File 'lib/hiiro.rb', line 156

def opts
  @opts
end

#subcmdObject (readonly)

Returns the value of attribute subcmd.



151
152
153
# File 'lib/hiiro.rb', line 151

def subcmd
  @subcmd
end

#task_scopeObject (readonly)

Returns the value of attribute task_scope.



155
156
157
# File 'lib/hiiro.rb', line 155

def task_scope
  @task_scope
end

Class Method Details

.init(*oargs, plugins: [], logging: false, tasks: false, task_scope: nil, **values, &block) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/hiiro.rb', line 69

def self.init(*oargs, plugins: [], logging: false, tasks: false, task_scope: nil, **values, &block)
  load_env
  Hiiro::DB.setup!


  h_bin = values[:bin_name] || $0
  h_args = oargs
  h_args = ARGV if h_args.empty?
  h_args = values[:args] if values.key?(:args)

  # if values[:args]
  #   args = values[:args]
  # else
  #   args ||= oargs
  #   args = ARGV if args.empty?
  # end
  #
  # bin_name = values[:bin_name] || $0

  begin
    Hiiro::Invocation.record!(
      bin: File.basename(h_bin),
      subcmd: h_args.first,
      args: h_args[1..]
    )
  rescue => e
    puts " ... ERROR ... there shouldn't be any reason for this to fail...unless sqlite is broken"
    binding.pry
  end

  new(h_bin, *h_args, logging: logging, tasks: tasks, task_scope: task_scope, **values).tap do |hiiro|
    hiiro.load_plugins(plugins)

    hiiro.add_subcommand(:pry) { |*args|
      binding.pry
    }

    hiiro.add_subcmd(:edit, **values) { |*args|
      hiiro.edit_files(hiiro.bin)
    }

    if hiiro.tasks_enabled?
      hiiro.add_subcmd(:task) do |*args|
        tm = TaskManager.new(hiiro, scope: :task)
        Tasks.build_hiiro(hiiro, tm).run
      end

      hiiro.add_subcmd(:subtask) do |*args|
        tm = TaskManager.new(hiiro, scope: :subtask)
        Tasks.build_hiiro(hiiro, tm).run
      end
    end

    if block
      if block.arity == 1
        block.call(hiiro)
      else
        hiiro.instance_eval(&block)
      end
    end
  end
end

.load_envObject



142
143
144
145
146
147
148
# File 'lib/hiiro.rb', line 142

def self.load_env
  Config.plugin_files.each do |plugin_file|
    require plugin_file
  end

  self
end

.options(&block) ⇒ Object



132
133
134
# File 'lib/hiiro.rb', line 132

def self.options(&block)
  Options.setup(&block)
end

.run(*args, plugins: [], logging: false, tasks: false, task_scope: nil, **values, &block) ⇒ Object



136
137
138
139
140
# File 'lib/hiiro.rb', line 136

def self.run(*args, plugins: [], logging: false, tasks: false, task_scope: nil, **values, &block)
  hiiro = init(*args, plugins:, logging:, tasks:, task_scope:, **values, &block)

  hiiro.run
end

Instance Method Details

#add_cmd(*names, args: [], opts: [], &block) ⇒ Object



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/hiiro.rb', line 359

def add_cmd(*names, args: [], opts: [], &block)
  cmd_opts = options.select(opts)

  wrapper = lambda do |*raw_args|
    @opts = cmd_opts.parse(raw_args)
    instance_eval(&block)
  end

  names.each do |name|
    runners.add_subcommand(
      name, wrapper,
      subcmd_args: args,
      subcmd_opts: cmd_opts,
      **global_values
    )
  end
end

#add_default(**values, &handler) ⇒ Object



320
321
322
# File 'lib/hiiro.rb', line 320

def add_default(**values, &handler)
  runners.add_default(handler, **global_values, **values)
end

#add_flag(name, **kwargs) ⇒ Object



339
340
341
# File 'lib/hiiro.rb', line 339

def add_flag(name, **kwargs)
  options.flag(name, **kwargs)
end

#add_option(name, **kwargs) ⇒ Object



335
336
337
# File 'lib/hiiro.rb', line 335

def add_option(name, **kwargs)
  options.option(name, **kwargs)
end

#add_resolver(name, current = nil, &lookup) ⇒ Object



343
344
345
346
# File 'lib/hiiro.rb', line 343

def add_resolver(name, current = nil, &lookup)
  @resolvers ||= {}
  @resolvers[name.to_sym] = { current:, lookup: }
end

#add_subcommand(*names, opts: nil, **values, &handler) ⇒ Object Also known as: add_subcmd



324
325
326
327
328
# File 'lib/hiiro.rb', line 324

def add_subcommand(*names, opts: nil, **values, &handler)
  names.each do |name|
    runners.add_subcommand(name, handler, opts: opts, **global_values, **values)
  end
end

#attach_method(name, &block) ⇒ Object



396
397
398
# File 'lib/hiiro.rb', line 396

def attach_method(name, &block)
  define_singleton_method(name.to_sym, &block)
end

#auto_tag_branch_with_taskObject



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/hiiro.rb', line 292

def auto_tag_branch_with_task
  task = environment.task
  return unless task

  branch = environment.tree&.branch
  return if branch.nil? || branch.empty?
  return if %w[master main].include?(branch)

  tag_store = Tags.new(:branch)
  return if tag_store.get(branch).include?(task.name)

  tag_store.add(branch, task.name)
rescue
  # never let auto-tagging break a command
end

#auto_var_name(path, existing_vars) ⇒ Object



518
519
520
521
522
523
524
525
# File 'lib/hiiro.rb', line 518

def auto_var_name(path, existing_vars)
  parts = path.delete_prefix('/').split('/')
  (1..parts.length).each do |n|
    candidate = parts.last(n).join('_').upcase.gsub(/[^A-Z0-9]/, '_').squeeze('_').delete_prefix('_').delete_suffix('_')
    return candidate unless existing_vars.key?(candidate)
  end
  "DIR_#{existing_vars.length + 1}"
end

#build_location_vars(list) ⇒ Object



481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/hiiro.rb', line 481

def build_location_vars(list)
  paths = list.map { |r| r.location }.compact.map { |loc| loc.sub(/:\d+$/, '') }
  dirs  = paths.map { |p| File.dirname(p) }.uniq

  ancestors = consolidate_dirs(dirs, min_depth: 4)

  vars = {}
  ancestors.sort.each do |ancestor|
    name = auto_var_name(ancestor, vars)
    vars[name] = ancestor
  end
  vars
end

#consolidate_dirs(dirs, min_depth:) ⇒ Object

Recursively group directories under their common ancestor when that ancestor is deep enough to be a useful alias (>= min_depth components).



497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/hiiro.rb', line 497

def consolidate_dirs(dirs, min_depth:)
  return dirs if dirs.length <= 1

  lca       = dirs.reduce { |a, b| path_lca(a, b) }
  lca_depth = lca.delete_prefix('/').split('/').reject(&:empty?).length

  if lca_depth >= min_depth
    [lca]
  else
    lca_parts = lca.split('/')
    subgroups = dirs.group_by { |d| d.split('/').first(lca_parts.length + 1).join('/') }
    subgroups.flat_map { |_, group| consolidate_dirs(group, min_depth: min_depth) }.uniq
  end
end

#default_subcommandObject



557
558
559
560
561
562
563
# File 'lib/hiiro.rb', line 557

def default_subcommand
  Runners::Subcommand.new(
    bin_name,
    :DEFAULT,
    lambda { |*args| help; false },
  )
end

#edit_files(*files, max_splits: 3) ⇒ Object



215
216
217
218
219
220
221
222
223
224
225
# File 'lib/hiiro.rb', line 215

def edit_files(*files, max_splits: 3)
  if editor.match?(/vim/i)
    if files.count > max_splits.to_i
      system(editor, '-O' + max_splits.to_i.to_s, *files)
    else
      system(editor, '-O', *files)
    end
  else
    system(editor, *files)
  end
end

#editorObject



197
198
199
200
201
# File 'lib/hiiro.rb', line 197

def editor
  editors = Bins.glob(%w[nvim vim vi]).find(&File.method(:executable?))

  ENV['EDITOR'] || editors.first
end

#environmentObject Also known as: env



182
183
184
# File 'lib/hiiro.rb', line 182

def environment
  @environment ||= Environment.current
end

#full_nameObject



382
383
384
# File 'lib/hiiro.rb', line 382

def full_name
  runner&.full_name || [bin_name, subcmd].join(?-)
end

#fuzzyfind(lines) ⇒ Object



545
546
547
# File 'lib/hiiro.rb', line 545

def fuzzyfind(lines)
  Fuzzyfind.select(lines)
end

#fuzzyfind_from_map(mapping) ⇒ Object



549
550
551
# File 'lib/hiiro.rb', line 549

def fuzzyfind_from_map(mapping)
  Fuzzyfind.map_select(mapping)
end

#get_value(name) ⇒ Object



553
554
555
# File 'lib/hiiro.rb', line 553

def get_value(name)
  runner&.values&.[](name)
end

#gitObject



392
393
394
# File 'lib/hiiro.rb', line 392

def git
  @git ||= Git.new(self, Dir.pwd)
end

#handle_result(result) ⇒ Object



286
287
288
289
290
# File 'lib/hiiro.rb', line 286

def handle_result(result)
  exit 0 if result.nil? || result

  exit 1
end

#help(options = nil) ⇒ Object



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/hiiro.rb', line 421

def help(options=nil)
  ambiguous = runners.ambiguous_matches

  puts "Current command: #{bin_name}!"

  if ambiguous.any?
    puts "Ambiguous subcommand #{subcmd.inspect}!"
    puts
    puts "Did you mean one of these?"
    list_runners(ambiguous)
    puts
  else
    puts "Subcommand required for #{bin_name}"
    puts
    puts "Possible subcommands:"
    list_runners(runners.all_runners)
    puts
  end

  global = @options
  if global && global.definitions.any? { |k, _| k != :help }
    puts "Options:"
    puts global.help_text
    puts
  end

  if options
    puts "Options:"
    puts options.help_text
    puts
  end

  exit 1
end

#list_runners(list) ⇒ Object



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/hiiro.rb', line 456

def list_runners(list)
  sorted = list.sort_by(&:subcommand_name)
  vars = build_location_vars(sorted)

  vars.each { |var_name, path| puts "export #{var_name}=\"#{path}\"" }
  puts if vars.any?

  max_name   = sorted.map { |r| r.subcommand_name.length }.max || 0
  max_type   = sorted.map { |r| r.type.to_s.length }.max || 0

  params_with_opts = sorted.map do |r|
    parts = [r.params_string, (r.respond_to?(:opts_hint) ? r.opts_hint : nil)]
    parts.compact.reject(&:empty?).join('  ')
  end
  max_params = params_with_opts.map(&:length).max || 0

  sorted.each_with_index do |r, i|
    name       = r.subcommand_name.ljust(max_name)
    type       = "(#{r.type})".ljust(max_type + 2)
    params_col = params_with_opts[i].ljust(max_params)
    location   = shorten_location(r.location, vars)
    puts "  #{name}  #{params_col}  #{type}  #{location}"
  end
end

#load_plugin(plugin_const) ⇒ Object



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/hiiro.rb', line 404

def load_plugin(plugin_const)
  if plugin_const.is_a?(String) || plugin_const.is_a?(Symbol)
    begin
      plugin_const = Kernel.const_get(plugin_const.to_sym)
    rescue => e
      puts "unable to load plugin: #{plugin_const}"
      puts "Error message: #{e.message}"
      return
    end
  end

  return if @loaded_plugins.include?(plugin_const)

  plugin_const.load(self)
  @loaded_plugins.push(plugin_const)
end

#load_plugins(*plugins) ⇒ Object



400
401
402
# File 'lib/hiiro.rb', line 400

def load_plugins(*plugins)
  plugins.flatten.each { |plugin| load_plugin(plugin) }
end

#log(message) ⇒ Object



535
536
537
538
539
# File 'lib/hiiro.rb', line 535

def log(message)
  return unless logging

  puts "[Hiiro: #{bin_name} #{(runner&.subcommand_name || subcmd).inspect}]: #{message}"
end

#make_child(custom_subcmd = nil, custom_args = nil, **kwargs, &block) ⇒ Object



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/hiiro.rb', line 239

def make_child(custom_subcmd=nil, custom_args=nil, **kwargs, &block)
  child_subcmd = custom_subcmd || subcmd
  child_args = custom_args || args

  child_bin_name = [bin, child_subcmd.to_s].join(?-)

  parent_resolvers = @resolvers&.dup

  wrapper = lambda do |h|
    h.instance_variable_set(:@resolvers, parent_resolvers.dup) if parent_resolvers
    block.arity == 1 ? block.call(h) : h.instance_eval(&block) if block
  end

  begin
    Hiiro.init(bin_name: child_bin_name, args: child_args, **kwargs, &wrapper)
  rescue => e
    binding.pry
  end
end

#md_input_file(content: nil, append: false, prefix: 'edit-') ⇒ Object



211
212
213
# File 'lib/hiiro.rb', line 211

def md_input_file(content: nil, append: false, prefix: 'edit-')
  InputFile.md_file(hiiro: self, content:, append:, prefix:)
end

#open_config(file, dir: nil) ⇒ Object



227
228
229
# File 'lib/hiiro.rb', line 227

def open_config(file, dir: nil)
  Hiiro::Config.open(file, dir: dir)
end

#optionsObject



331
332
333
# File 'lib/hiiro.rb', line 331

def options
  @options ||= Hiiro::Options.setup {}
end

#parsed_argsObject



541
542
543
# File 'lib/hiiro.rb', line 541

def parsed_args
  i = Args.new(*args)
end

#path_lca(a, b) ⇒ Object



512
513
514
515
516
# File 'lib/hiiro.rb', line 512

def path_lca(a, b)
  a_parts = a.split('/')
  b_parts = b.split('/')
  a_parts.zip(b_parts).take_while { |x, y| x == y }.map(&:first).join('/')
end

#pinsObject



390
# File 'lib/hiiro.rb', line 390

def pins = @pins ||= Pin.new(self)

#queueObject



267
268
269
# File 'lib/hiiro.rb', line 267

def queue
  @queue ||= Queue.current
end

#registry_pick(type = nil) ⇒ Object

Pick a registry entry by fuzzyfinder. Returns the canonical name string, or nil. Usage inside a subcommand block:

task = opts.task || registry_pick('isc_task')


129
130
131
132
133
134
135
136
# File 'lib/hiiro/registry.rb', line 129

def registry_pick(type = nil)
  lines = Hiiro::RegistryEntry.fuzzy_lines(type: type)
  return nil if lines.empty?
  chosen = fuzzyfind(lines)
  return nil unless chosen
  # fuzzy_line format: "type  short  name  # desc" — name is 3rd column
  chosen.strip.split(/\s{2,}/)[2]
end

#resolve(name, ref = nil) ⇒ Object



348
349
350
351
352
353
354
355
356
357
# File 'lib/hiiro.rb', line 348

def resolve(name, ref = nil)
  @resolvers ||= {}
  r = @resolvers[name.to_sym] or raise "No resolver registered for :#{name}"
  if ref.nil?
    c = r[:current]
    c.respond_to?(:call) ? c.call : c
  else
    r[:lookup]&.call(ref)
  end
end

#runObject



271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/hiiro.rb', line 271

def run
  auto_tag_branch_with_task if tasks_enabled?

  run_args = runners.using_default? ? [subcmd, *args].compact : args
  result = runner.run(*run_args)

  handle_result(result)

  exit 1
rescue => e
  puts "ERROR: #{e.message}"
  puts e.backtrace
  exit 1
end

#run_child(custom_subcmd = nil, custom_args = nil, **kwargs, &block) ⇒ Object



259
260
261
# File 'lib/hiiro.rb', line 259

def run_child(custom_subcmd=nil, custom_args=nil, **kwargs, &block)
  make_child(custom_subcmd, custom_args, **kwargs, &block).run
end

#run_subcommand(name, *args) ⇒ Object Also known as: run_subcmd



377
378
379
# File 'lib/hiiro.rb', line 377

def run_subcommand(name, *args)
  runners.run_subcommand(name, *args)
end

#runnable?Boolean

Returns:

  • (Boolean)


308
309
310
# File 'lib/hiiro.rb', line 308

def runnable?
  runner
end

#runnerObject



312
313
314
# File 'lib/hiiro.rb', line 312

def runner
  runners.runner || runners.default_subcommand
end

#runnersObject



316
317
318
# File 'lib/hiiro.rb', line 316

def runners
  @runners ||= Runners.new(self)
end

#shorten_location(loc, vars) ⇒ Object



527
528
529
530
531
532
533
# File 'lib/hiiro.rb', line 527

def shorten_location(loc, vars)
  return loc if loc.nil?
  vars.sort_by { |_, path| -path.length }.each do |var_name, path|
    return loc.sub(path, "$#{var_name}") if loc.start_with?(path + '/') || loc == path
  end
  loc
end

#start_tmux_session(name, **opts) ⇒ Object



235
236
237
# File 'lib/hiiro.rb', line 235

def start_tmux_session(name, **opts)
  tmux_client.open_session(name, **opts)
end

#subcommand_namesObject



386
387
388
# File 'lib/hiiro.rb', line 386

def subcommand_names
  runners.subcommand_names
end

#task_managerObject Also known as: tm



187
188
189
190
# File 'lib/hiiro.rb', line 187

def task_manager
  return nil unless tasks_enabled?
  @task_manager ||= TaskManager.new(self, scope: task_scope || :task)
end

#tasksObject



193
194
195
# File 'lib/hiiro.rb', line 193

def tasks
  task_manager&.tasks
end

#tasks_enabled?Boolean

Returns:

  • (Boolean)


178
179
180
# File 'lib/hiiro.rb', line 178

def tasks_enabled?
  @tasks_enabled
end

#thisObject



174
175
176
# File 'lib/hiiro.rb', line 174

def this
  self
end

#tmux_clientObject



231
232
233
# File 'lib/hiiro.rb', line 231

def tmux_client
  @tmux_client ||= Tmux.client!(self)
end

#todo_managerObject



263
264
265
# File 'lib/hiiro.rb', line 263

def todo_manager
  @todo_manager ||= TodoManager.new
end

#vim?Boolean

Returns:

  • (Boolean)


203
204
205
# File 'lib/hiiro.rb', line 203

def vim?
  editor.to_s.match?(/vim/i)
end

#yaml_input_file(content: nil, append: false, prefix: 'edit-') ⇒ Object



207
208
209
# File 'lib/hiiro.rb', line 207

def yaml_input_file(content: nil, append: false, prefix: 'edit-')
  InputFile.yaml_file(hiiro: self, content:, append:, prefix:)
end