@@ -123,8 +123,8 @@ function resolveByOsId(filename, distros) {
123123 * Organized by namespace and version, each entry maps to a resolver function
124124 * that returns the appropriate package names for the current OS.
125125 *
126- * @example <caption> Get the package name for Gtk 4.0 on the current OS</caption>
127- * packages.Gtk['4.0']().packages
126+ * @example Get the package name for Gtk 4.0 on the current OS
127+ * { @includeCode examples/gtk4-pkg-name.js#example}
128128 */
129129export const packages = {
130130 Adw : {
@@ -300,20 +300,8 @@ export class MissingDependencies extends Error {
300300 * {@link MissingDependencies}.
301301 * @throws {Error } If an unknown library is requested.
302302 *
303- * @example <caption>Import 'gi://Handy?version=1' or ask the user to install packages</caption>
304- * try {
305- * const {Handy} = require({Handy: '1'});
306- * // ...
307- * } catch (ex) {
308- * if (!(ex instanceof MissingDependencies))
309- * throw ex;
310- *
311- * if (ex.packages.size > 0)
312- * printerr(`Please install the packages: ${[...ex.packages]}`);
313- *
314- * if (ex.files.size > 0)
315- * printerr(`Please install the packages that contain the files: ${[...ex.files]}`);
316- * }
303+ * @example Import Template-GLib or ask the user to install packages
304+ * {@includeCode examples/require-template.js#example}
317305 */
318306export function require ( versions ) {
319307 /** @type {Partial<Record<string, any>> } */
@@ -648,6 +636,9 @@ export async function findInstallCommand(cancellable = null) {
648636 * @param {Gio.Cancellable|null } cancellable - Optional cancellable for aborting the operation.
649637 * @returns {Promise<TerminalCommandResolver|null> } A function that generates
650638 * the command line, or null if no suitable terminal is found.
639+ *
640+ * @example "Hello, World!" in a new terminal
641+ * {@includeCode examples/terminal-hello.js#example}
651642 */
652643// eslint-disable-next-line @typescript-eslint/require-await
653644export async function findTerminalCommand ( cancellable = null ) {
@@ -682,23 +673,8 @@ export async function findTerminalCommand(cancellable = null) {
682673 * given the list of packages, generates the installation command,
683674 * wrapped for terminal execution, or null if no terminal or install command is found.
684675 *
685- * @example <caption>Install Gtk 4 package in a separate terminal window</caption>
686- * findTerminalInstallCommand().then(installer => {
687- * if (!installer) {
688- * printerr("Can't install packages");
689- * return;
690- * }
691- *
692- * const pkgs = packages.Gtk['4.0']().packages;
693- * if (!pkgs) {
694- * printerr("Can't find a Gtk 4.0 package for this OS");
695- * return;
696- * }
697- *
698- * const argv = installer(pkgs);
699- * const [, pid] = GLib.spawn_async(null, argv, null, GLib.SpawnFlags.DEFAULT, null);
700- * GLib.spawn_close_pid(pid);
701- * });
676+ * @example Install Template-GLib package in a separate terminal window
677+ * {@includeCode examples/install-template.js#example}
702678 */
703679export async function findTerminalInstallCommand ( cancellable = null ) {
704680 cancellable ?. set_error_if_cancelled ( ) ;
0 commit comments