CLI cannot accept a path input, though its help and the compiler both support one
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di elixirscript/elixirscript
-
Inactive project Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
elixirscript/elixirscript#497 · 6 commenti · 3 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
elixirscript/elixirscript#496 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
elixirscript/elixirscript#494 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
elixirscript/elixirscript#449 ·
-
Beginner Tutorial Apertahelp wanted kind:documentation
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
elixirscript/elixirscript#448 · 2 commenti ·
Tutte le issue di elixirscript/elixirscript
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
phoenixframework/phoenix#6847 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
moderation
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
beyond-all-reason/teiserver#1584 · 1 commento ·