@@ -21,21 +21,56 @@ class VNClient(CompositeClient):
2121
2222 @property
2323 def tcp (self ) -> TCPClient :
24- """Get the TCP client."""
24+ """
25+ Access the underlying TCP client.
26+
27+ Returns:
28+ TCPClient: The TCP client instance stored in this composite client's children mapping.
29+ """
2530 return typing .cast ("TCPClient" , self .children ["tcp" ])
2631
2732 @contextlib .contextmanager
2833 def session (self , * , encrypt : bool = False ) -> typing .Iterator [str ]:
29- """Create a new VNC session."""
34+ """
35+ Open a noVNC session and yield the connection URL.
36+
37+ Parameters:
38+ encrypt (bool): If True, request an encrypted WebSocket (use `wss://`);
39+ otherwise use `ws://`.
40+
41+ Returns:
42+ url (str): The URL to connect to the VNC session.
43+ """
3044 with NovncAdapter (client = self .tcp , method = "connect" , encrypt = encrypt ) as adapter :
3145 yield adapter
3246
3347 def cli (self ) -> click .Command :
34- """Return a click command handler for this driver."""
48+ """
49+ Provide a Click command group for running VNC sessions.
50+
51+ The returned command exposes a `session` subcommand that opens a VNC session,
52+ prints the connection URL, optionally opens it in the user's browser,
53+ and waits until the user cancels the session.
54+
55+ Returns:
56+ click.Command: Click command group with a `session` subcommand that accepts
57+ `--browser/--no-browser` and `--encrypt/--no-encrypt` options.
58+ """
3559
3660 @driver_click_group (self )
3761 def vnc ():
38- """Open a VNC session."""
62+ """
63+ Open a VNC session and block until the user closes it.
64+
65+ When invoked, prints the connection URL for the noVNC session, optionally
66+ opens that URL in the user's web browser, and waits for user-initiated
67+ termination (for example, Ctrl+C). On exit, prints a message indicating
68+ the session is closing.
69+
70+ Parameters:
71+ browser (bool): If True, open the session URL in the default web browser.
72+ encrypt (bool): If True, request an encrypted (wss://) connection.
73+ """
3974
4075 @vnc .command ()
4176 @click .option ("--browser/--no-browser" , default = True , help = "Open the session in a web browser." )
@@ -45,7 +80,17 @@ def vnc():
4580 help = "Use an encrypted connection (wss://)." ,
4681 )
4782 def session (browser : bool , encrypt : bool ):
48- """Open a VNC session."""
83+ """
84+ Open an interactive VNC session and wait for the user to terminate it.
85+
86+ Starts a VNC session using the client's session context, prints the connection
87+ URL, optionally opens that URL in a web browser, and blocks until the user
88+ cancels (e.g., Ctrl+C), then closes the session.
89+
90+ Parameters:
91+ browser (bool): If True, open the session URL in the default web browser.
92+ encrypt (bool): If True, request an encrypted (wss://) connection for the session.
93+ """
4994 # The NovncAdapter is a blocking context manager that runs in a thread.
5095 # We can enter it, open the browser, and then just wait for the user
5196 # to press Ctrl+C to exit. The adapter handles the background work.
0 commit comments