Organized
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
with open("redmine_tickets.py") as f:
|
||||
txt = f.read()
|
||||
|
||||
old = ''' normalized_argv = inject_default_sync_command(raw_argv)
|
||||
parser = build_parser()
|
||||
args = parser.parse_args(normalized_argv)
|
||||
|
||||
cache = TicketCache(args.cache_dir, args.project)
|
||||
'''
|
||||
|
||||
new = ''' normalized_argv = inject_default_sync_command(raw_argv)
|
||||
parser = build_parser()
|
||||
args = parser.parse_args(normalized_argv)
|
||||
|
||||
# Post-process common globals so subparsers (tui/browse/...) that re-declare them
|
||||
# (to support "cmd --allow-prod-writes ...") don't leave them as None.
|
||||
if getattr(args, "cache_dir", None) in (None, ""):
|
||||
from pathlib import Path as _P
|
||||
args.cache_dir = _P(".cache/redmine_tickets")
|
||||
if getattr(args, "project", None) in (None, ""):
|
||||
args.project = "customer-service"
|
||||
if getattr(args, "base_url", None) in (None, ""):
|
||||
args.base_url = os.getenv("REDMINE_BASE_URL", "https://rm.ldrprep.com")
|
||||
|
||||
cache = TicketCache(args.cache_dir, args.project)
|
||||
'''
|
||||
|
||||
if old in txt:
|
||||
txt = txt.replace(old, new)
|
||||
with open("redmine_tickets.py", "w") as f:
|
||||
f.write(txt)
|
||||
print("Inserted post-parse normalizer for common globals")
|
||||
else:
|
||||
print("Anchor not found for post-parse fix")
|
||||
Reference in New Issue
Block a user