Skip to content

[bug] --globs flag overridden by --langΒ #1861

@ScottKayeNeo

Description

@ScottKayeNeo

Please read the FAQ for the bug you encountered.

  • I have read the existing FAQ

⏯ Playground Link

N/A

πŸ’» Code

secret.js:

console.log(123)

πŸ™ Actual behavior

ast-grep run --pattern 'console.log'

βœ… Returns the match in secret.js as expected.

ast-grep run --pattern 'console.log' --lang js

βœ… Continues to match in secret.js as expected.

ast-grep run --pattern 'console.log' --globs '!secret*'

βœ… Does not match file (since the glob excludes secret.js)

ast-grep run --pattern 'console.log' --lang js --globs '!secret*'

❌ Returns the match in secret.js, which is supposed to be excluded by --globs

πŸ™‚ Expected behavior

I expect --lang and --globs to coexist. In my example, I would like to be able to search JS files that match my glob expression. I haven't found a spot in the docs that explains that these options are one-or-the-other.

Additional information about the issue

Potentially related issue: #1842.

Running ast-grep 0.36.0.

Thank you for all of your hard work on this awesome tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions