Skip to content

Commit 28e8f4f

Browse files
authored
Merge branch 'humble' into mergify/bp/humble/pr-1413
2 parents e16947f + e3391da commit 28e8f4f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ros2controlcli/ros2controlcli/verb/list_controllers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
from controller_manager import list_controllers
16+
from controller_manager.spawner import bcolors
1617

1718
from ros2cli.node.direct import add_arguments
1819
from ros2cli.node.strategy import NodeStrategy
@@ -22,7 +23,15 @@
2223

2324

2425
def print_controller_state(c, args):
25-
print(f"{c.name:20s}[{c.type:20s}] {c.state:10s}")
26+
state_color = ""
27+
if c.state == "active":
28+
state_color = bcolors.OKGREEN
29+
elif c.state == "inactive":
30+
state_color = bcolors.OKCYAN
31+
elif c.state == "unconfigured":
32+
state_color = bcolors.WARNING
33+
34+
print(f"{c.name:20s}[{c.type:20s}] {state_color}{c.state:10s}{bcolors.ENDC}")
2635
if args.claimed_interfaces or args.verbose:
2736
print("\tclaimed interfaces:")
2837
for claimed_interface in c.claimed_interfaces:

0 commit comments

Comments
 (0)