defmodule MealTracker.Commands.List do
  @moduledoc """
  Handles the `track list` command.
  """

  alias MealTracker.Config

  @doc """
  Executes the command.
  """
  def run(_options) do
    files =
      Config.root()
      |> File.ls!()
      |> Enum.map(fn file_name -> String.slice(file_name, 0..-4) end)

    IO.puts(files)
  end
end

defmodule MealTracker.Commands.List do
  @moduledoc """
  Handles the `track list` command.
  """

  alias MealTracker.Config

  @doc """
  Executes the command.
  """
  def run(_options) do
    files =
      Config.root()
      |> File.ls!()
      |> Enum.map(fn file_name -> String.slice(file_name, 0..-4) end)
      |> Enum.reverse()
      |> Enum.join("\n")

    IO.puts(files)
  end
end

Print each log file on its own line
Print each log file on its own line

lee-dohm/meal-tracker,lee-dohm/meal-tracker