Skip to content

Commit

Permalink
add new --exported-interfaces arg and deprecate the old one
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Oct 16, 2024
1 parent e760fa7 commit 61fd6c4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ros2controlcli/ros2controlcli/verb/list_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import warnings
from controller_manager import list_controllers, bcolors

from ros2cli.node.direct import add_arguments
Expand Down Expand Up @@ -50,11 +51,11 @@ def print_controller_state(c, args, col_width_name, col_width_state, col_width_t
for connection in c.chain_connections:
for reference in connection.reference_interfaces:
print(f"\t\t{reference:20s}")
if args.reference_interfaces or args.verbose:
if args.reference_interfaces or args.exported_interfaces or args.verbose:
print("\texported reference interfaces:")
for reference_interface in c.reference_interfaces:
print(f"\t\t{reference_interface}")
if args.reference_interfaces or args.verbose:
if args.reference_interfaces or args.exported_interfaces or args.verbose:
print("\texported state interfaces:")
for exported_state_interface in c.exported_state_interfaces:
print(f"\t\t{exported_state_interface}")
Expand Down Expand Up @@ -90,6 +91,11 @@ def add_arguments(self, parser, cli_name):
action="store_true",
help="List controller's exported references",
)
parser.add_argument(
"--exported-interfaces",
action="store_true",
help="List controller's exported state and reference interfaces",
)
parser.add_argument(
"--verbose",
"-v",
Expand All @@ -102,6 +108,13 @@ def main(self, *, args):
with NodeStrategy(args).direct_node as node:
response = list_controllers(node, args.controller_manager)

if args.reference_interfaces:
warnings.filterwarnings("always")
warnings.warn(
"The '--reference-interfaces' argument is deprecated and will be removed in future releases. Use '--exported-interfaces' instead.",
DeprecationWarning,
)

if not response.controller:
print("No controllers are currently loaded!")
return 0
Expand Down

0 comments on commit 61fd6c4

Please sign in to comment.