@@ -20,31 +20,76 @@ 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 @contextlib .contextmanager
2732 def session (self , * , encrypt : bool = False ) -> typing .Iterator [str ]:
28- """Create a new VNC session."""
33+ """
34+ Open a noVNC session and yield the connection URL.
35+
36+ Parameters:
37+ encrypt (bool): If True, request an encrypted WebSocket (use `https://`
38+ and `encrypt` query parameter); otherwise use `http://`.
39+
40+ Returns:
41+ url (str): The URL to connect to the VNC session.
42+ """
2943 with NovncAdapter (client = self .tcp , method = "connect" , encrypt = encrypt ) as adapter :
3044 yield adapter
3145
3246 def cli (self ) -> click .Command :
33- """Return a click command handler for this driver."""
47+ """
48+ Provide a Click command group for running VNC sessions.
49+
50+ The returned command exposes a `session` subcommand that opens a VNC session,
51+ prints the connection URL, optionally opens it in the user's browser,
52+ and waits until the user cancels the session.
53+
54+ Returns:
55+ click.Command: Click command group with a `session` subcommand that accepts
56+ `--browser/--no-browser` and `--encrypt/--no-encrypt` options.
57+ """
3458
3559 @driver_click_group (self )
3660 def vnc ():
37- """Open a VNC session."""
61+ """
62+ Open a VNC session and block until the user closes it.
63+
64+ When invoked, prints the connection URL for the noVNC session, optionally
65+ opens that URL in the user's web browser, and waits for user-initiated
66+ termination (for example, Ctrl+C). On exit, prints a message indicating
67+ the session is closing.
68+
69+ Parameters:
70+ browser (bool): If True, open the session URL in the default web browser.
71+ encrypt (bool): If True, request an encrypted (wss://) connection.
72+ """
3873
3974 @vnc .command ()
4075 @click .option ("--browser/--no-browser" , default = True , help = "Open the session in a web browser." )
4176 @click .option (
4277 "--encrypt/--no-encrypt" ,
4378 default = False ,
44- help = "Use an encrypted connection (wss://) ." ,
79+ help = "Use HTTPS and request noVNC to use secure WebSockets ." ,
4580 )
4681 def session (browser : bool , encrypt : bool ):
47- """Open a VNC session."""
82+ """
83+ Open an interactive VNC session and wait for the user to terminate it.
84+
85+ Starts a VNC session using the client's session context, prints the connection
86+ URL, optionally opens that URL in a web browser, and blocks until the user
87+ cancels (e.g., Ctrl+C), then closes the session.
88+
89+ Parameters:
90+ browser (bool): If True, open the session URL in the default web browser.
91+ encrypt (bool): If True, use HTTPS and request noVNC to use secure WebSockets.
92+ """
4893 # The NovncAdapter is a blocking context manager that runs in a thread.
4994 # We can enter it, open the browser, and then just wait for the user
5095 # to press Ctrl+C to exit. The adapter handles the background work.
0 commit comments