@@ -20,7 +20,12 @@ class VNClient(CompositeClient):
2020
2121 @property
2222 def tcp (self ) -> TCPClient :
23- """Get the TCP client."""
23+ """
24+ Access the underlying TCP client.
25+
26+ Returns:
27+ TCPClient: The TCP client instance stored in this composite client's children mapping.
28+ """
2429 return typing .cast ("TCPClient" , self .children ["tcp" ])
2530
2631 def stream (self , method = "connect" ):
@@ -33,7 +38,15 @@ async def stream_async(self, method="connect"):
3338
3439 @contextlib .contextmanager
3540 def session (self , * , encrypt : bool = True ) -> typing .Iterator [str ]:
36- """Create a new VNC session."""
41+ """
42+ Open a noVNC session and yield the connection URL.
43+
44+ Parameters:
45+ encrypt (bool): If True, request an encrypted vnc connection.
46+
47+ Returns:
48+ url (str): The URL to connect to the VNC session.
49+ """
3750 with NovncAdapter (client = self .tcp , method = "connect" , encrypt = encrypt ) as adapter :
3851 yield adapter
3952
@@ -42,11 +55,28 @@ def get_default_encrypt(self) -> bool:
4255 return typing .cast (bool , self .call ("get_default_encrypt" ))
4356
4457 def cli (self ) -> click .Command :
45- """Return a click command handler for this driver."""
58+ """
59+ Provide a Click command group for running VNC sessions.
60+
61+ The returned command exposes a `session` subcommand that opens a VNC session,
62+ prints the connection URL, optionally opens it in the user's browser,
63+ and waits until the user cancels the session.
64+
65+ Returns:
66+ click.Command: Click command group with a `session` subcommand that accepts
67+ `--browser/--no-browser` and `--encrypt/--no-encrypt` options.
68+ """
4669
4770 @driver_click_group (self )
4871 def vnc ():
49- """Open a VNC session."""
72+ """
73+ Open a VNC session and block until the user closes it.
74+
75+ When invoked, prints the connection URL for the noVNC session, optionally
76+ opens that URL in the user's web browser, and waits for user-initiated
77+ termination (for example, Ctrl+C). On exit, prints a message indicating
78+ the session is closing.
79+ """
5080
5181 @vnc .command ()
5282 @click .option ("--browser/--no-browser" , default = True , help = "Open the session in a web browser." )
@@ -55,16 +85,28 @@ def vnc():
5585 "encrypt_override" ,
5686 flag_value = True ,
5787 default = None ,
58- help = "Force an encrypted connection (wss://) . Overrides the driver default." ,
88+ help = "Force an encrypted vnc connection . Overrides the driver default." ,
5989 )
6090 @click .option (
6191 "--no-encrypt" ,
6292 "encrypt_override" ,
6393 flag_value = False ,
64- help = "Force an unencrypted connection (ws://) . Overrides the driver default." ,
94+ help = "Force an unencrypted vnc connection . Overrides the driver default." ,
6595 )
6696 def session (browser : bool , encrypt_override : bool | None ):
67- """Open a VNC session."""
97+ """
98+ Open an interactive VNC session and wait for the user to terminate it.
99+
100+ Starts a VNC session using the client's session context, prints the connection
101+ URL, optionally opens that URL in a web browser, and blocks until the user
102+ cancels (e.g., Ctrl+C), then closes the session.
103+
104+ Parameters:
105+ browser (bool): If True, open the session URL in the default web browser.
106+ encrypt_override (bool | None): If provided, overrides the driver's default
107+ encryption setting. True for encrypted,
108+ False for unencrypted, None to use driver default.
109+ """
68110 encrypt = encrypt_override if encrypt_override is not None else self .get_default_encrypt ()
69111 # The NovncAdapter is a blocking context manager that runs in a thread.
70112 # We can enter it, open the browser, and then just wait for the user
0 commit comments