ruby / ruby/syntax_suggest

Support multiple files from the CLI (support dir globs)

Open
#109 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
350
Forks
17
Avg merge
48m
Merged PRs (30d)
5

Description

Problem

To run this against multiple files developers want to run:

$ dead_end **/*.rb

This doesn't work today due to terminal globbing, which we don't yet support. What's happening when that command is run is that info isn't coming to dead_end. Your shell is expanding the input to be all files:

$ echo **/*.rb
lib/dead_end.rb lib/dead_end/around_block_scan.rb lib/dead_end/auto.rb lib/dead_end/block_expand.rb lib/dead_end/capture_code_context.rb lib/dead_end/clean_document.rb lib/dead_end/cli.rb lib/dead_end/code_block.rb lib/dead_end/code_frontier.rb lib/dead_end/code_line.rb lib/dead_end/code_search.rb lib/dead_end/display_code_with_line_numbers.rb lib/dead_end/display_invalid_blocks.rb lib/dead_end/explain_syntax.rb lib/dead_end/insertion_sort.rb lib/dead_end/left_right_lex_count.rb lib/dead_end/lex_all.rb lib/dead_end/lex_value.rb lib/dead_end/parse_blocks_from_indent_line.rb lib/dead_end/ripper_errors.rb lib/dead_end/version.rb spec/integration/dead_end_spec.rb spec/integration/exe_cli_spec.rb spec/integration/ruby_command_line_spec.rb spec/spec_helper.rb spec/unit/around_block_scan_spec.rb spec/unit/block_expand_spec.rb spec/unit/capture_code_context_spec.rb spec/unit/clean_document_spec.rb spec/unit/cli_spec.rb spec/unit/code_block_spec.rb spec/unit/code_frontier_spec.rb spec/unit/code_line_spec.rb spec/unit/code_search_spec.rb spec/unit/display_invalid_blocks_spec.rb spec/unit/explain_syntax_spec.rb spec/unit/insertion_sort_spec.rb spec/unit/lex_all_spec.rb

So what's really happening when you run that dead_end **/*.rb command (I think) is that we're only looking at the first file in the list. i.e. calling this:

$ dead_end **/*.rb

Is functionally the same as calling:

$ dead_end lib/dead_end.rb # based on the file output from above

That's the problem.

Solution

The fix would be pretty easy, which would be to look at all inputs rather than just the first one. Essentially change this in the CLI to loop over all args, https://github.com/zombocom/dead_end/blob/e8eb54c651bfa196fc933f76def5d811bb5d57dc/lib/dead_end/cli.rb#L43-L55

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/dead_end/cli.rb around lines 43-55, where the CLI currently handles its inputs, and trace how the first path is selected. Check the existing CLI and integration specs for argument behavior. Done means a command such as dead_end **/*.rb processes every expanded file rather than only the first one.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.