CLI Plugin: List items matching a pattern #44
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just an idea: I have a lot of items and the
la
command output is really large and i need to search for the items I currently want to see, which is not handy.I implemented a item matching mechanism using the
sh.match_item()
function instead ofsh.return_item()
for:ls
- will list all matching items, e.g.ls groundfloor.*.light
update
,up
- will update all matching items to value, e.g.up groundfloor.*.light = True
Maybe we should use a new keyword for the update command, since this actually change values and it could happen that someone change a lot of values accidentally by typing a
*
somewhere in the path.Since every time the match_item() function is used, this patch will slightly slow down the mentioned commands. I did not a benchmark on this, since the CLI interface is mainly used for developers, debugging or testing purpose.
The documentation update is not included in this patch - I can do this if we want to support this feature.