Add Enum or Mix-in Class for Selecting Enums from CLI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2
- Forks
- 6
- Avg merge
- 7d 11h
- Merged PRs (30d)
- 1
Description
Expected Behavior
See https://github.com/pcdshub/typhos/pull/450#discussion_r752715420
I'd be nice to create some shortcuts for converting user str input from the cli into specific enum values.
Consider the case where we have an enum with values "Red", "Green", and "Blue" and the user passes in some input. The following string inputs should all cleanly slot into specific enum slots:
- red
- Green
- g
- re
- bl
And bad input can be generically handled as well.
Current Behavior
No such feature
Possible Solution
Start from the implementation in typhos and make it more generic and connected to an enum subclass or mixin.
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.
Research direction
Start with the typhos implementation referenced in the issue and read the linked discussion to understand the proposed enum-selection behavior. Generalize that approach for pcdsutils, covering case-insensitive and abbreviated inputs plus generic handling for invalid input; no files or tests are named, so completion should include tests for the listed examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100