Open klauer opened 2 years ago
Would it be hard to fuzzy search the happi database? I somewhat frequently find myself messing up search fields or forgetting the field names
Not hard in my opinion - it might be a fun exercise to implement here for our JSON-backed database. I'd imagine you would show the table, allow fuzzy finding with that, and then do something with the selected row (show metadata for starters).
Believe it or not, there's something already built in to happi that supports any backend: (*) https://github.com/pcdshub/happi/blob/master/conda-recipe/activate.sh
It's pretty slow, though, with the happi client sitting behind it and the Python startup costs. cat
/jq
/fzf
should take a small fraction of that time.
A bug in shared-dotfiles stops this mechanism from working, though (PR incoming):
happi search **[tab]
(Thought up by @tangkong)
For a table:
cat /cds/group/pcds/pyps/apps/hutch-python/device_config/db.json | jq '[ to_entries[] | .value ]' | json-to-table - --columns name beamline --sort-key name
JSON information could be readily retrieved with just
jq
from the database