Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Fantastic job! #35

Open
josevalim opened this issue Sep 14, 2020 · 7 comments
Open

Fantastic job! #35

josevalim opened this issue Sep 14, 2020 · 7 comments

Comments

@josevalim
Copy link

This looks amazing!

Let me know if you believe there are improvements we can do to our release scripts. In particular, I wonder if it is worth supporting bin/my_app start ARGV so you can access argv as System.argv directly. :)

@fhunleth
Copy link
Contributor

Yes! In our rush, we totally missed System.argv, but we definitely want to switch to that. That will clean up one of the areas that I was unhappy with and wanted to revisit. Thanks!

@josevalim
Copy link
Author

Unfortunately I don't think System.argv will work today... unless you set it explicitly or we do improvements to releases. :)

@stefanchrobot
Copy link

I love you, guys! ❤️

@tsloughter
Copy link

Why wouldn't argv work?

Does this not run the regular start script that simply appends the additional args to the erl command? I did similar to this project with makeself.io and argument passing works fine if I remember correctly.

@josevalim
Copy link
Author

@tsloughter so, our current release doesn't do that :)

@tsloughter
Copy link

Aah ok. I assumed it was the same as our (rebar3/relx) scripts that does -- $@ or whatever.

@Faheetah
Copy link

Faheetah commented Mar 16, 2021

I was playing around with bakeware today and I am impressed how clean the end result feels. I've dealt with plenty of small systems utilities (like stuff written in Go) and they have the benefit of dropping a small (<10mb) blob on a box and running it. A bakeware bundle feels a lot like that. But those kinds of small applications typically lean heavily on arguments. If the whole argv issue could be sorted it out it would open up a lot more use cases for using Elixir, and would generally be more flexible for everyone. I hope this is something that can be worked out over time, but looking at how releases work I can see how it's not immediately feasible.

Edit: I was able to kind of replicate argv() behavior by iterating over the environment variables, I had a case of the RTFM here but this works

  defp argv() do
    nargs =
      System.get_env("BAKEWARE_ARGC")
      |> String.to_integer()

    for n <- 1..nargs, do: System.get_env("BAKEWARE_ARG#{n}")
  end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants