Skip to content

Refactor type command to avoid full parse round-trip #12

@cdprice02

Description

@cdprice02

In src/executor.rs line 87, there is a TODO: get type without fully parsing the arg. Currently, the type builtin converts an Arg back into a Command via the From<&Arg> impl in src/arg.rs, which calls parse_command() and triggers a full PATH traversal.

This is wasteful and couples type to the parser's internals. Refactor to use a lighter lookup that checks builtin names and PATH without constructing a full Command.

Acceptance criteria:

  • type no longer round-trips through parse_command()
  • PATH lookup for type is efficient (no unnecessary iteration)
  • The TODO comment is resolved
  • Existing type tests continue to pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorImprove the codebase

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions