Method: NA.add_action

Defined in:
lib/na/next_action.rb

.add_action(file, project, action, note = [], priority: 0, finish: false, append: false) ⇒ Object

Add an action to a todo file

Parameters:

  • file (String)

    The target file

  • project (String)

    The project name

  • action (String)

    The action

  • note (String) (defaults to: [])

    The note



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/na/next_action.rb', line 395

def add_action(file, project, action, note = [], priority: 0, finish: false, append: false)
  parent = project.split(%r{[:/]})

  if NA.global_file
    puts NA.global_file
    if NA.cwd_is == :tag
      add_tag = [NA.cwd]
    else
      project = NA.cwd
    end
    puts [add_tag, project]
  end

  action = Action.new(file, project, parent, action, nil, note)

  update_action(file, nil, add: action, project: project, add_tag: add_tag, priority: priority, finish: finish, append: append)
end