pcdshub / shared-dotfiles

Shared configuration useful for PCDS engineers: "dot" files such as ~/.bashrc or .ssh/config
https://github.com/pcdshub/shared-dotfiles/blob/master/helpme.md
3 stars 11 forks source link

Add which_happi or similar #32

Open klauer opened 2 years ago

klauer commented 2 years ago

(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

tangkong commented 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

klauer commented 2 years ago

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]

image