Refactor: use shutil.which instead of manual PATH walk in PosixHelpRenderer
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
Research direction
Start by reviewing PosixHelpRenderer._exists_on_path and the surrounding imports in awscli/help.py, around lines 162-170. Done means the manual PATH walk is replaced as proposed without changing the method's behavior.
Written by the indexing model from the issue text.
Description
Summary
`PosixHelpRenderer._exists_on_path` in `awscli/help.py` (lines ~162-170) manually reimplements PATH lookup by joining each PATH entry with `os.path.join`/`os.path.exists` inside a list comprehension, then calls `any()` on the resulting list.
Proposed change
Use the stdlib `shutil.which` (available since Python 3.3): `return shutil.which(name) is not None`. Removes the manual PATH-walking logic and avoids building a throwaway list. Pure refactor, no behavior change.
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.7k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 25
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-cli
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
codeartifact login investigating p2
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100