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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/na/next_action.rb', line 85

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("#{NA.theme[:warning]}Created #{NA.theme[:file]}#{target}")
end