Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CLI cannot accept a path input, though its help and the compiler both support one

Aperta
#501 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
elixir
Ambito
cli, compilers

Direzione di ricerca

Start in lib/elixir_script/cli.ex:91-96 at handle_input/1, then compare its argument handling with ElixirScript.Compiler.compile/2 and the Path.wildcard/1 behavior described in the issue. Check the existing CLI process path and compiler tests before deciding how module names and filesystem paths should be distinguished. Done means a supported path reaches the compiler without breaking module-name input, with regression coverage for both cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The CLI help advertises a path input:

usage: elixirscript <module | path> [options]
<path> the path to .ex(s) files to compile

ElixirScript.Compiler.compile/2 does support it — def compile(path, opts) when is_binary(path) plus the Path.wildcard/1 handling was added by #420 — but the CLI never passes a path through, because handle_input/1 maps every argument token through Module.concat/1:

defp handle_input(input) do
  input
  |> Enum.map(fn x -> String.split(x, [" ", ","], trim: true) end)
  |> List.flatten()
  |> Enum.map(fn x -> Module.concat([x]) end)
end

(lib/elixir_script/cli.ex:91-96)

So a path becomes an atom, the when is_binary(path) clause is unreachable from the CLI, and the compile aborts:

$ mix run -e 'ElixirScript.CLI.process({["test/fixtures/list_ops.ex"], []})'
[warn] ElixirScript: :"Elixir.test/fixtures/list_ops.ex" is missing or unavailable
** (MatchError) no match of right hand side value: nil
    lib/elixir_script/passes/find_used_functions.ex:36: ElixirScript.FindUsedFunctions.walk_module/2

Passing the same path straight to the compiler works, so only the CLI wiring is missing.

Reproduced on cc8a08ae77a9d2e5354b19efd9007b2711e2dba7 with Elixir 1.11.4 / OTP 23.

Filed as an issue rather than a PR because a fix needs a disambiguation rule: a bare token can be either a module name or a relative path (Atom vs ./Atom, my/path vs My.Path), so "treat it as a path when it names an existing file or directory" is a behaviour change worth agreeing on first.

Lingua principale
Elixir
Stelle
1.6k
Fork
69
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di elixirscript/elixirscript

Tutte le issue di elixirscript/elixirscript

Issue simili

Altre issue su Elixir

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.