Skip to content

Commit 3d6d319

Browse files
committed
LITE-28260: sync stream command
1 parent 826de2e commit 3d6d319

File tree

5 files changed

+507
-2
lines changed

5 files changed

+507
-2
lines changed

connect/cli/plugins/commerce/commands.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
display_streams_table,
1515
export_stream,
1616
get_destination_account,
17+
print_errors,
1718
print_results,
19+
sync_stream,
1820
)
1921

2022

@@ -165,5 +167,33 @@ def cmd_clone_stream(
165167
print_results(results)
166168

167169

170+
@grp_commerce_streams.command(
171+
name='sync',
172+
short_help='Synchronize a stream from an excel file.',
173+
)
174+
@click.argument('input_file', metavar='input_file', nargs=1, required=True) # noqa: E304
175+
@pass_config
176+
def cmd_sync_stream(config, input_file):
177+
stream_id = None
178+
if '.xlsx' not in input_file:
179+
stream_id = input_file
180+
input_file = f'{input_file}/{input_file}.xlsx'
181+
else:
182+
stream_id = input_file.split('/')[-1].split('.')[0]
183+
results, errors = sync_stream(
184+
account=config.active,
185+
stream_id=stream_id,
186+
input_file=input_file,
187+
)
188+
189+
console.echo('')
190+
191+
print_results(results)
192+
193+
console.echo('')
194+
195+
print_errors(errors)
196+
197+
168198
def get_group():
169199
return grp_commerce

0 commit comments

Comments
 (0)