Skip to content

Commit

Permalink
Recoded the feature to gather the results of each search term individ…
Browse files Browse the repository at this point in the history
…ually, then load the union of the results.
  • Loading branch information
janeliu-slac committed Oct 15, 2024
1 parent 5e86159 commit 987daed
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions happi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,32 +406,39 @@ def load(
use_glob: bool,
search_criteria: list[str]
):
term = []
results = set()

final_results = search_parser(
client=get_happi_client_from_config(ctx.obj),
use_glob=use_glob,
search_criteria=search_criteria,
)
if not final_results:
return []
for item in search_criteria:
term.append(item)

final_results = search_parser(
client=get_happi_client_from_config(ctx.obj),
use_glob=use_glob,
search_criteria=term,
)
if not final_results:
print('%s was not found.' % item)
else:
for res in final_results:
results.add(res['name'])

item_names = []
for res in final_results:
item_names.append(res['name'])
term = []

"""Open IPython terminal with ITEM_NAMES loaded."""
# Open IPython terminal with RESULTS loaded

logger.debug('Starting load block')
# retrieve client
client = get_happi_client_from_config(ctx.obj)

devices = {}
names = " ".join(item_names)
names = " ".join(results)
names = names.split()
print(names)

if len(names) < 1:
raise click.BadArgumentUsage('No item names given')
logger.info(f'Creating shell with devices {item_names}')
logger.info(f'Creating shell with devices {results}')

for name in names:
try:
Expand Down

0 comments on commit 987daed

Please sign in to comment.