Method: NA.create_todo

Defined in:
lib/na/next_action.rb

.create_todo(target, basename, template: nil) ⇒ Object

Create a new todo file

Parameters:

  • target (String)

    The target path

  • basename (String)

    The project base name



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/na/next_action.rb', line 75

def create_todo(target, basename, template: nil)
  File.open(target, 'w') do |f|
    if template && File.exist?(template)
      content = IO.read(template)
    else
      content = <<~ENDCONTENT
        Inbox:
        #{basename}:
        \tFeature Requests:
        \tIdeas:
        \tBugs:
        Archive:
        Search Definitions:
        \tTop Priority @search(@priority = 5 and not @done)
        \tHigh Priority @search(@priority > 3 and not @done)
        \tMaybe @search(@maybe)
        \tNext @search(@#{NA.na_tag} and not @done and not project = \"Archive\")
      ENDCONTENT
    end
    f.puts(content)
  end
  save_working_dir(target)
  notify("{y}Created {bw}#{target}")
end