CLI cannot accept a path input, though its help and the compiler both support one
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Elixir
- スター
- 1.6k
- フォーク
- 69
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
elixirscript/elixirscript のほかの issue
-
Inactive project オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
elixirscript/elixirscript#497 · コメント 6 件 · リアクション 3 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
elixirscript/elixirscript#496 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
elixirscript/elixirscript#494 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
elixirscript/elixirscript#449 ·
-
Beginner Tutorial オープンhelp wanted kind:documentation
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
elixirscript/elixirscript#448 · コメント 2 件 ·
elixirscript/elixirscript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
phoenixframework/phoenix#6847 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
moderation
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
beyond-all-reason/teiserver#1584 · コメント 1 件 ·