Skip to content

Commit 011731f

Browse files
committed
docs: add documentation for DistroboxCommandRunnerResponse enum
Add comprehensive documentation comments explaining: - The purpose of the enum for mock responses in testing/previews - Each variant's function (Version, NoVersion, List, Compatibility, ExportedApps) - Use cases: UI previews, unit testing, Flatpak sandbox testing
1 parent 91e8a4c commit 011731f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/backends/distrobox/distrobox.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,31 @@ pub enum Error {
330330
ResolveHostPath(String),
331331
}
332332

333+
/// Represents mock responses for the NullCommandRunner used in previews and testing.
334+
///
335+
/// These responses simulate the output of various distrobox commands without
336+
/// actually executing them. This is essential for:
337+
/// - UI previews in development (via DistroboxStoreTy::NullWorking)
338+
/// - Unit testing without requiring a real distrobox installation
339+
/// - Flatpak sandbox testing
333340
#[derive(Clone)]
334341
pub enum DistroboxCommandRunnerResponse {
342+
/// Mock response for `distrobox version` command
343+
/// Returns a successful version string like "distrobox: 1.7.2.1"
335344
Version,
345+
/// Mock response for when distrobox is not installed
346+
/// Returns an error when version is queried
336347
NoVersion,
348+
/// Mock response for `distrobox ls --no-color` command
349+
/// Returns a list of containers in the expected pipe-delimited format
337350
List(Vec<ContainerInfo>),
351+
/// Mock response for `distrobox create --compatibility` command
352+
/// Returns a list of compatible container images
338353
Compatibility(Vec<String>),
339-
// The exported apps commands is complex, it may fail, but we don't want the app to crash
340-
ExportedApps(String, Vec<(String, String, String)>), // (distrobox_name, [(filename, name, icon)])
354+
/// Mock response for listing exportable applications from a container
355+
/// Contains: (distrobox_name, [(filename, app_name, icon_name)])
356+
/// Generates the TOML hex-encoded format expected by the desktop file parser
357+
ExportedApps(String, Vec<(String, String, String)>),
341358
}
342359

343360
impl DistroboxCommandRunnerResponse {

0 commit comments

Comments
 (0)