diff --git a/lib/igniter/libs/phoenix.ex b/lib/igniter/libs/phoenix.ex index 05aa905..303610a 100644 --- a/lib/igniter/libs/phoenix.ex +++ b/lib/igniter/libs/phoenix.ex @@ -163,7 +163,29 @@ defmodule Igniter.Libs.Phoenix do {igniter, router} {igniter, routers} -> - {igniter, Owl.IO.select(routers, label: label, render_as: &inspect/1)} + router_numbers = + routers + |> Enum.with_index() + |> Enum.map_join("\n", fn {router, index} -> + "#{index}. #{inspect(router)}" + end) + + case String.trim( + Mix.shell().prompt(label <> "\n" <> router_numbers <> "\nInput router number ❯ ") + ) do + "" -> + select_router(igniter, label) + + router -> + case Integer.parse(router) do + {int, ""} -> + {igniter, Enum.at(routers, int)} + + _ -> + Mix.shell().info("Expected a number, got: #{router}") + select_router(igniter, label) + end + end end end diff --git a/lib/igniter/project/igniter_config.ex b/lib/igniter/project/igniter_config.ex index 1c48a16..4a6cfee 100644 --- a/lib/igniter/project/igniter_config.ex +++ b/lib/igniter/project/igniter_config.ex @@ -4,9 +4,9 @@ defmodule Igniter.Project.IgniterConfig do type: {:in, [:outside_matching_folder, :inside_matching_folder]}, default: :outside_matching_folder, doc: """ - - `:outside_matching_folder`, modules will be placed in a folder exactly matching their path. - - `:inside_matching_folder`, modules who's name matches an existing folder will be placed inside that folder, - or moved there if the folder is created. + - `:outside_matching_folder`, modules will be placed in a folder exactly matching their path. + - `:inside_matching_folder`, modules who's name matches an existing folder will be placed inside that folder, + or moved there if the folder is created. """ ], source_folders: [ @@ -22,6 +22,11 @@ defmodule Igniter.Project.IgniterConfig do ] ] + docs = + Enum.map_join(@configs, "\n", fn {name, config} -> + "- `#{name}` - \n#{config[:doc]}" + end) + @moduledoc """ Tools for reading and modifying the `.igniter.exs` file. @@ -33,7 +38,7 @@ defmodule Igniter.Project.IgniterConfig do ## Options - #{NimbleOptions.docs(@configs)} + #{docs} """ def get(igniter, config) do diff --git a/mix.exs b/mix.exs index 6b0da8b..74310d5 100644 --- a/mix.exs +++ b/mix.exs @@ -91,9 +91,6 @@ defmodule Igniter.MixProject do {:spitfire, "~> 0.1 and >= 0.1.3"}, {:sourceror, "~> 1.4"}, {:jason, "~> 1.4"}, - {:owl, "~> 0.9"}, - # can't use spark because spark depends on this - {:nimble_options, "~> 1.0"}, # Dev/Test dependencies {:eflame, "~> 1.0", only: [:dev, :test]}, {:ex_doc, "~> 0.32", only: [:dev, :test], runtime: false}, diff --git a/mix.lock b/mix.lock index e900197..52bb73e 100644 --- a/mix.lock +++ b/mix.lock @@ -22,9 +22,7 @@ "mimic": {:hex, :mimic, "1.9.0", "c96367749a884556718f64657a4bdc99ce0cb5d19333aa04308fbd061c31b8b7", [:mix], [], "hexpm", "92107697938490b300566317c2a1490ef52e23aeac16632c0e56740721189116"}, "mix_audit": {:hex, :mix_audit, "2.1.4", "0a23d5b07350cdd69001c13882a4f5fb9f90fbd4cbf2ebc190a2ee0d187ea3e9", [:make, :mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.11", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "fd807653cc8c1cada2911129c7eb9e985e3cc76ebf26f4dd628bb25bbcaa7099"}, "mix_test_watch": {:hex, :mix_test_watch, "1.2.0", "1f9acd9e1104f62f280e30fc2243ae5e6d8ddc2f7f4dc9bceb454b9a41c82b42", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "278dc955c20b3fb9a3168b5c2493c2e5cffad133548d307e0a50c7f2cfbf34f6"}, - "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, - "owl": {:hex, :owl, "0.11.0", "2cd46185d330aa2400f1c8c3cddf8d2ff6320baeff23321d1810e58127082cae", [:mix], [{:ucwidth, "~> 0.2", [hex: :ucwidth, repo: "hexpm", optional: true]}], "hexpm", "73f5783f0e963cc04a061be717a0dbb3e49ae0c4bfd55fb4b78ece8d33a65efe"}, "rewrite": {:hex, :rewrite, "0.10.5", "6afadeae0b9d843b27ac6225e88e165884875e0aed333ef4ad3bf36f9c101bed", [:mix], [{:glob_ex, "~> 0.1", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "51cc347a4269ad3a1e7a2c4122dbac9198302b082f5615964358b4635ebf3d4f"}, "sourceror": {:hex, :sourceror, "1.6.0", "9907884e1449a4bd7dbaabe95088ed4d9a09c3c791fb0103964e6316bc9448a7", [:mix], [], "hexpm", "e90aef8c82dacf32c89c8ef83d1416fc343cd3e5556773eeffd2c1e3f991f699"}, "spitfire": {:hex, :spitfire, "0.1.3", "7ea0f544005dfbe48e615ed90250c9a271bfe126914012023fd5e4b6b82b7ec7", [:mix], [], "hexpm", "d53b5107bcff526a05c5bb54c95e77b36834550affd5830c9f58760e8c543657"},