Skip to content

Commit e8aa3e5

Browse files
authored
Merge pull request #224 from cloudblue/LITE-28260-sync-stream
Lite 28260 sync stream
2 parents 826de2e + 90074cd commit e8aa3e5

File tree

8 files changed

+987
-8
lines changed

8 files changed

+987
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ You can download its zip file from the [Github Releases](https://github.com/clou
6868
* [Reports](docs/reports_usage.md)
6969
* [Translations](docs/translations_usage.md)
7070
* [Projects](docs/project_usage.md)
71+
* [Streams](docs/stream_usage.md)
7172

7273

7374
## Development

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)