~sjm/notesviz_files

a992c3fff196fbbc44235562c7aa6688a0873885 — Sam Marshall 3 years ago b8b8ea4 master
add Note structure and ability to generate list of notes
2 files changed, 14 insertions(+), 0 deletions(-)

M lib/notesviz_files/files.ex
A lib/notesviz_files/note.ex
M lib/notesviz_files/files.ex => lib/notesviz_files/files.ex +11 -0
@@ 1,4 1,15 @@
defmodule NotesvizFiles.Files do
  alias NotesvizFiles.Note

  def notes(dir) do
    {:ok, fs} = files(dir)

    fs
    |> Enum.map(fn f ->
      {:ok, m} = metadata(f)
      %Note{name: "", path: f, metadata: m}
    end)
  end

  def files(dir) do
    case File.dir?(dir) do

A lib/notesviz_files/note.ex => lib/notesviz_files/note.ex +3 -0
@@ 0,0 1,3 @@
defmodule NotesvizFiles.Note do
  defstruct [:name, :path, :metadata]
end