@@ -70,6 +70,10 @@ def add_arguments(self, parser, cli_name):
70
70
group .add_argument (
71
71
'--stdin' , action = 'store_true' ,
72
72
help = 'Read values from standard input' )
73
+ group .add_argument (
74
+ '--yaml-file' , type = str , default = None ,
75
+ help = 'YAML file that has message contents, '
76
+ 'e.g STDOUT from ros2 topic echo <topic>' )
73
77
parser .add_argument (
74
78
'-r' , '--rate' , metavar = 'N' , type = positive_float , default = 1.0 ,
75
79
help = 'Publishing rate in Hz (default: 1)' )
@@ -98,10 +102,6 @@ def add_arguments(self, parser, cli_name):
98
102
'--keep-alive' , metavar = 'N' , type = positive_float , default = 0.1 ,
99
103
help = 'Keep publishing node alive for N seconds after the last msg '
100
104
'(default: 0.1)' )
101
- parser .add_argument (
102
- '--yaml-file' , type = str , default = None ,
103
- help = 'YAML file that has message contents, prevails <values>. '
104
- 'e.g STDOUT from ros2 topic echo <topic>' )
105
105
parser .add_argument (
106
106
'-n' , '--node-name' ,
107
107
help = 'Name of the created publishing node' )
@@ -124,12 +124,10 @@ def main(args):
124
124
if args .once :
125
125
times = 1
126
126
127
- values = None
128
- if not args .yaml_file :
129
- if args .stdin :
130
- values = collect_stdin ()
131
- else :
132
- values = args .values
127
+ if args .stdin :
128
+ values = collect_stdin ()
129
+ else :
130
+ values = args .values
133
131
134
132
with DirectNode (args , node_name = args .node_name ) as node :
135
133
return publisher (
0 commit comments