Fix command-name substitution and rules move with duplicate at destination
ci / test (push) Canceled after 0s
ci / test (push) Canceled after 0s
This commit is contained in:
1 parent
6477fc66d2
commit
cb442e7d6f
4 files changed
+17
-4
No files matched your search
+2
-1
@@ -648,12 +648,13 @@ def move(args, cwd):
|
||||
start, to, to_cwd = " ".join(args[0].split()), args[1], top or cwd
|
||||
forms = [f for f in ([start, start[2:]] if start.startswith("- ") else [start]) if f]
|
||||
homes = {path(lv, c): (lv, c) for lv, c in [(CORE, cwd), (USER, cwd)] + [(PROJECT, c) for c in (cwd, top) if c and has_project(c)]}
|
||||
dst = path(to, to_cwd) if to != "canon" else None
|
||||
hits = [(p, lv, l) for p, (lv, c) in homes.items() for l in dict.fromkeys(scope_lines(lv, c) if lv == PROJECT else lines(p)) if any(" ".join(l[2:].split()).startswith(f) for f in forms)]
|
||||
hits = [h for h in hits if any(" ".join(h[2][2:].split()) == f for f in forms)] or hits
|
||||
hits = [h for h in hits if h[0] != dst] or hits
|
||||
if len(hits) != 1:
|
||||
return "no rule line starts with that; run `sisi rules` to see the rules" if not hits else "more than one rule starts with that; give more of it:\n" + "\n".join(" [%s] %s" % (lv, l) for _, lv, l in hits)
|
||||
src, lv, line = hits[0]
|
||||
dst = path(to, to_cwd) if to != "canon" else None
|
||||
if to == "canon" and lv != CORE:
|
||||
return "only a rule queued for the product goes to canon, after it is added to canon/core.md; this is a %s rule" % lv
|
||||
if src == dst:
|
||||
|
||||
Reference in new issue
Block a user