@@ -520,7 +520,9 @@ def _merge_metadata(paths):
520520 type = click .Path (file_okay = True , dir_okay = False , readable = True ))
521521@click .option ('--port' , required = False , type = click .IntRange (1024 , 65535 ),
522522 default = None , help = 'The port to serve the webapp on.' )
523- def view (result_path , port ):
523+ @click .option ('--verbose' , is_flag = True ,
524+ help = 'Display all GET requests in the terminal.' )
525+ def view (result_path , port , verbose ):
524526 # Guard headless envs from having to import anything large
525527 import sys
526528
@@ -556,6 +558,10 @@ def view(result_path, port):
556558 # Start server
557559 class Handler (http .server .SimpleHTTPRequestHandler ):
558560 def do_GET (self ):
561+ # Redirect the output from these requests to devnull if not verbose
562+ if not verbose :
563+ sys .stderr = open (os .devnull , 'w' )
564+
559565 # Determine if this is a request for the file we are supposed to be
560566 # viewing
561567 if self .path == result_path :
@@ -624,8 +630,10 @@ def stop():
624630 thread .start ()
625631
626632 # Open page on server
627- launch_status = click .launch (
628- f'http://localhost:{ port } ?file={ result_path } &session={ session } ' )
633+ url = f'http://localhost:{ port } ?file={ result_path } &session={ session } '
634+ launch_status = click .launch (url )
635+ click .echo ('Your view should open in your default browser shortly. You '
636+ f'may open it manually at the URL: { url } ' )
629637
630638 # Yell if there was an error
631639 if launch_status != 0 :
0 commit comments