Skip to content

Commit

Permalink
Add ability to specify custom log view command
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpas committed Aug 20, 2024
1 parent ff851c1 commit 4bcc971
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion armaqdl/armaqdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ def open_last_rpt():
rpt_path = Path.home() / "AppData" / "Local" / "Arma 3"
rpt_list = rpt_path.glob("*.rpt")
last_rpt = max(rpt_list, key=os.path.getctime)
if not DRY:

log_command = SETTINGS.get('log', {}).get('command', '')
if log_command:
log_command = [cmd.replace("$PATH", str(last_rpt.resolve())) for cmd in log_command]
log_command = [cmd.replace("$FILE", last_rpt.name) for cmd in log_command]
if not DRY:
subprocess.run(log_command, cwd=rpt_path, shell=True)
elif not DRY:
os.startfile(last_rpt)
else:
print("Warning! Opening last log only implemented for Windows.")
Expand Down
4 changes: 4 additions & 0 deletions config/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ profile = "Dev"
[log]
open_delay = 3

# Custom command to open the log file with (avilable replacement patterns: $PATH, $FILE)
# Example: Open in Windows Terminal PowerShell, set the tab title and tail the given RPT
# command = ["wt", "--title", "$FILE", "pwsh", "-NoProfile", "-Command", "Get-Content -Wait -Tail 100 '$PATH'"]

# Default server information to use with ArmaQDL
[server]
profile = "Server"
Expand Down

0 comments on commit 4bcc971

Please sign in to comment.