Skip to content

Commit

Permalink
agent: improve shell script activity rendering
Browse files Browse the repository at this point in the history
PL-131813
  • Loading branch information
dpausp committed Nov 9, 2023
1 parent 91466ec commit 528be4f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkgs/fc/agent/fc/maintenance/lib/shellscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import subprocess

import rich.console
import rich.syntax
import rich.text

Expand Down Expand Up @@ -38,5 +39,8 @@ def run(self):
self.returncode = p.returncode

def __rich__(self):
syntax = rich.syntax.Syntax(self.script, "shell", line_numbers=True)
return syntax
lines = self.script.splitlines()
syntax = rich.syntax.Syntax(
self.script, "shell", line_numbers=len(lines) > 2
)
return rich.console.Group("Execute script:\n", syntax)

0 comments on commit 528be4f

Please sign in to comment.