summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--patternutils/commands/pmatch.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/patternutils/commands/pmatch.py b/patternutils/commands/pmatch.py
index 62fc256..20f71a1 100644
--- a/patternutils/commands/pmatch.py
+++ b/patternutils/commands/pmatch.py
@@ -34,13 +34,18 @@ def apply_regex(
except ValueError:
click.secho(f"'{subject}' did not match!", fg="red", err=True)
yield None
- else:
- match["_path"] = f.path
- match["_name"] = f.name
- match["_abspath"] = os.path.abspath(f.path)
- match["_realpath"] = os.path.realpath(f.path)
- match["_relpath"] = os.path.relpath(f.path)
- yield match
+ continue
+
+ match.update(
+ {
+ "_path": entry.path,
+ "_name": entry.name,
+ "_abspath": os.path.abspath(entry.path),
+ "_realpath": os.path.realpath(entry.path),
+ "_relpath": os.path.relpath(entry.path),
+ }
+ )
+ yield match
@click.command(context_settings={"help_option_names": ("-h", "--help", "-?")})