Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #519 by adding --hide-progress #2811

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions awscli/customizations/s3/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,12 @@ def _print_success(self, result, **kwargs):
pass


class HideProgressResultPrinter(ResultPrinter):
"""A result printer that only lists files transferred upon completion"""
def _print_progress(self, **kwargs):
pass


class ResultProcessor(threading.Thread):
def __init__(self, result_queue, result_handlers=None):
"""Thread to process results from result queue
Expand Down
3 changes: 3 additions & 0 deletions awscli/customizations/s3/s3handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from awscli.customizations.s3.results import ResultRecorder
from awscli.customizations.s3.results import ResultPrinter
from awscli.customizations.s3.results import OnlyShowErrorsResultPrinter
from awscli.customizations.s3.results import HideProgressResultPrinter
from awscli.customizations.s3.results import ResultProcessor
from awscli.customizations.s3.results import CommandResultRecorder
from awscli.customizations.s3.utils import RequestParamsMapper
Expand Down Expand Up @@ -110,6 +111,8 @@ def _add_result_printer(self, result_recorder, result_processor_handlers):
result_printer = OnlyShowErrorsResultPrinter(result_recorder)
elif self._cli_params.get('is_stream'):
result_printer = OnlyShowErrorsResultPrinter(result_recorder)
elif self._cli_params.get('hide_progress'):
result_printer = HideProgressResultPrinter(result_recorder)
else:
result_printer = ResultPrinter(result_recorder)
result_processor_handlers.append(result_printer)
Expand Down
9 changes: 7 additions & 2 deletions awscli/customizations/s3/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
'Only errors and warnings are displayed. All other '
'output is suppressed.')}

HIDE_PROGRESS = {'name': 'hide-progress', 'action': 'store_true',
'help_text': (
'Suppress transfer progress messages, but still list '
'files transferred.')}


EXPECTED_SIZE = {'name': 'expected-size',
'help_text': (
Expand Down Expand Up @@ -424,7 +429,7 @@
SSE_C_COPY_SOURCE_KEY, STORAGE_CLASS, GRANTS,
WEBSITE_REDIRECT, CONTENT_TYPE, CACHE_CONTROL,
CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE,
EXPIRES, SOURCE_REGION, ONLY_SHOW_ERRORS,
EXPIRES, SOURCE_REGION, ONLY_SHOW_ERRORS, HIDE_PROGRESS,
PAGE_SIZE, IGNORE_GLACIER_WARNINGS, FORCE_GLACIER_TRANSFER]


Expand Down Expand Up @@ -735,7 +740,7 @@ class RmCommand(S3TransferCommand):
USAGE = "<S3Uri>"
ARG_TABLE = [{'name': 'paths', 'nargs': 1, 'positional_arg': True,
'synopsis': USAGE}, DRYRUN, QUIET, RECURSIVE, INCLUDE,
EXCLUDE, ONLY_SHOW_ERRORS, PAGE_SIZE]
EXCLUDE, ONLY_SHOW_ERRORS, HIDE_PROGRESS, PAGE_SIZE]


class SyncCommand(S3TransferCommand):
Expand Down