mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #1643 from dhozac/fileglob-drop-dwim
Drop dwim prefix from returned items in fileglob
This commit is contained in:
commit
14f7bba64e
1 changed files with 4 additions and 1 deletions
|
@ -25,7 +25,10 @@ class LookupModule(object):
|
||||||
self.basedir = basedir
|
self.basedir = basedir
|
||||||
|
|
||||||
def run(self, terms, **kwargs):
|
def run(self, terms, **kwargs):
|
||||||
return [ f for f in glob.glob(utils.path_dwim(self.basedir, terms)) if os.path.isfile(f) ]
|
dwimterms = utils.path_dwim(self.basedir, terms)
|
||||||
|
# This skips whatever prefix the dwim added, leaving just the filename for the item
|
||||||
|
dwim_prefix_len = len(dwimterms) - len(terms)
|
||||||
|
return [ f[dwim_prefix_len:] for f in glob.glob(dwimterms) if os.path.isfile(f) ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue