Skip to content

Commit

Permalink
Removed the line "if '*' not in (' '.join(search_criteria))".
Browse files Browse the repository at this point in the history
  • Loading branch information
janeliu-slac committed Oct 15, 2024
1 parent 4f4982a commit 5e86159
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions happi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,24 +406,18 @@ def load(
use_glob: bool,
search_criteria: list[str]
):
""" Checks if the search string contains a glob pattern. If so,
it's sent to the search_parser() function. """

item_names = []

if '*' not in (' '.join(search_criteria)):
item_names = search_criteria
else:
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 []
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 res in final_results:
item_names.append(res['name'])
item_names = []
for res in final_results:
item_names.append(res['name'])

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

Expand All @@ -432,12 +426,14 @@ def load(
client = get_happi_client_from_config(ctx.obj)

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

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

for name in item_names:
for name in names:
try:
devices[name] = client.load_device(name=name)
except SearchError as e:
Expand Down

0 comments on commit 5e86159

Please sign in to comment.