Skip to content

Conversation

supersaiyansubtlety
Copy link
Member

@supersaiyansubtlety supersaiyansubtlety commented Aug 17, 2025

based on #280

Adds a search-mappings command for searching a project's mappings using one or more regular expressions.

help entry:

- search-mappings
	Searches for class, method, field, and parameter names using regular expressions.
	Each can additionally be filtered using access expressions; methods, fields, and parameters can be filtered by type.
	An access expression is a boolean combination of access flag keywords. They support &, |, !, and parentheses.
	Available access flag keywords are public, private, protected, static, final, super, synchronized, open, transitive, volatile, bridge, static_phase, varargs, transient, native, interface, abstract, strict, synthetic, annotation, enum, mandated, module, record, and deprecated.
arg help:
Arguments:
Argument 0: [input-jar=]<path>
A path to the .jar file to use in executing the command.
Argument 1: [input-mappings=]<path>
A path to the file or folder to read mappings from.

Optional arguments:
Argument 2: [classes=]<regex>
A regular expression to filter class names.
Argument 3: [class-access=]<access-expression>
An access expression to filter classes.
Argument 4: [methods=]<regex>
A regular expression to filter method names.
Argument 5: [method-returns=]<regex>
A regular expression to filter method return type names. Pass 'void' to filter void methods.
Argument 6: [method-access=]<access-expression>
An access expression to filter methods.
Argument 7: [fields=]<regex>
A regular expression to filter field names.
Argument 8: [field-types=]<regex>
A regular expression to filter field type names.
Argument 9: [field-access=]<access-expression>
An access expression to filter fields.
Argument 10: [params=]<regex>
A regular expression to filter parameter names.
Argument 11: [param-types=]<regex>
A regular expression to filter parameter type names.
Argument 12: [param-access=]<access-expression>
An access expression to filter parameters.
Argument 13: [sort=]<NAME|PACKAGE|DEPTH>
How results should be sorted.
Argument 14: [limit=]<int>
A limit on the number of individual results to display per result type (class, method, field, parameter).
The total, unlimited result count is always reported.
A limit of 0 causes only counts to be reported and negative limits are ignored.

Also makes the LocalVariableDefEntrys of MethodEntrys' params obtainable and adds parameter indexing to EntryIndex.

Todo:

  • rebase back onto Named command args #280 and target develop/2.7 once I get constructor params sorted
  • support primitive and void types
  • add option to limit result entries
  • add access filter
  • test
  • javadoc

@supersaiyansubtlety supersaiyansubtlety self-assigned this Aug 17, 2025
@supersaiyansubtlety supersaiyansubtlety added enhancement New feature or request wip in progress cli affects the enigma command-line interface labels Aug 17, 2025
@supersaiyansubtlety supersaiyansubtlety force-pushed the grep-command branch 2 times, most recently from b1cf6d1 to 1e88409 Compare August 20, 2025 22:07
@supersaiyansubtlety supersaiyansubtlety changed the base branch from master to develop/2.7 August 20, 2025 22:07
@supersaiyansubtlety supersaiyansubtlety changed the title Grep command search-mappings command Aug 23, 2025
@supersaiyansubtlety supersaiyansubtlety removed the wip in progress label Aug 30, 2025
public Stream<LocalVariableDefEntry> streamParameters(EntryIndex index) {
AccessFlags flags = index.getMethodAccess(this);
return flags == null ? Stream.empty() : this.paramCache
.computeIfAbsent(index, ignored -> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this caching should be fine, but I want to bring attention to it just in case.

@supersaiyansubtlety supersaiyansubtlety marked this pull request as ready for review September 4, 2025 02:26
@supersaiyansubtlety
Copy link
Member Author

rebased, ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli affects the enigma command-line interface enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant