Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active December 21, 2023 21:03
Show Gist options
  • Select an option

  • Save MichaelDimmitt/c471852cdfb52a6f8593ef3f14b3a7e5 to your computer and use it in GitHub Desktop.

Select an option

Save MichaelDimmitt/c471852cdfb52a6f8593ef3f14b3a7e5 to your computer and use it in GitHub Desktop.
basic commands for investigating elixir projects

Basic info commands after you have done iex -s mix and started looking at your project. I thought it was ๐Ÿ†’ . More fun than needing to hit tab twice and search at the blurb of text that came back of all possible options.

Get the name of my project instead of looking in the mix file:

  1. Mix.Project.get.project[:app]

Tell me all the keys in my application
2. :application.get_all_key(Mix.Project.get.project[:app])

Tell me the modules in my phoenix application named hello_world
3. :application.get_key(:hello_world, :modules)

Give me a breakdown of the modules in my project (combination of #1 and #3 above)
4. :application.get_key(Mix.Project.get.project[:app], :modules)

Give me a breakdown of the modules of the phoenix application I have brought into this project.
5. :application.get_key(:phoenix, :modules)

And how to get function names for the module Phoenix (can be applied to any other module)

  1. Mix.Phoenix.__info__(:functions)

https://stackoverflow.com/a/28664356/5283424

Most of the information above is extrapolated from this stack overflow answer ๐Ÿ˜› https://stackoverflow.com/a/41738708/5283424

Things to test in a runtime elixir script:

  1. Mix.Project.get.project[:app] |> IO.inspect
  2. :application.get_key(:hi, :modules) |> IO.inspect
  3. Application.get_application HiWeb |> IO.inspect
  4. TOBE continued
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment