Skip to content

Commit

Permalink
added --tags to "ck find" action to be able to search for entries
Browse files Browse the repository at this point in the history
by tags and return their paths
  • Loading branch information
gfursin committed Apr 16, 2021
1 parent 4995f16 commit 83a1fa4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* V1.55.4.1
* added --tags to "ck find" action to be able to search for entries
by tags and return their paths

* V1.55.4
* [sztaylor] fix cpu & gpu set_freq commands

Expand Down
22 changes: 19 additions & 3 deletions ck/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


# We use 3 digits for the main (released) version and 4th digit for development revision
__version__ = "1.55.4"
__version__ = "1.55.4.1"
# Do not use characters (to detect outdated version)!

# Import packages that are global for the whole kernel
Expand Down Expand Up @@ -7171,13 +7171,30 @@ def find2(i):
m = i.get('module_uoa', '')
duoa = i.get('data_uoa', '')

# Check tags
tags = i.get('tags', '')
ltags = []
if tags != '':
xtags = tags.split(',')
for q in xtags:
ltags.append(q.strip())

if duoa.strip() == '' and len(ltags) > 0:
duoa='*'

if m == '':
return {'return': 1, 'error': 'module UOA is not defined'}
if duoa == '':
return {'return': 1, 'error': 'data UOA is not defined'}

if a.find('*') >= 0 or a.find('?') >= 0 or m.find('*') >= 0 or m.find('?') >= 0 or duoa.find('*') >= 0 or duoa.find('?') >= 0:
r = list_data({'repo_uoa': a, 'module_uoa': m, 'data_uoa': duoa})
ii={'repo_uoa': a, 'module_uoa': m, 'data_uoa': duoa}

if len(ltags) > 0:
ii['search_dict'] = {'tags':ltags}
ii['filter_func'] = 'search_filter'

r = list_data(ii)
if r['return'] > 0:
return r

Expand Down Expand Up @@ -9836,7 +9853,6 @@ def search(i):
##############################################################################
# Original search (internal)


def search2(i):

o = i.get('out', '')
Expand Down

0 comments on commit 83a1fa4

Please sign in to comment.