From cf452aa92c567b2eedc59512156807fef84c4f3a Mon Sep 17 00:00:00 2001 From: Fernando Ayats Date: Mon, 2 Sep 2024 16:48:38 +0200 Subject: [PATCH] FIXME --- src/flake.rs | 28 ++++++++++++++++++++++++++++ src/main.rs | 1 + 2 files changed, 29 insertions(+) create mode 100644 src/flake.rs diff --git a/src/flake.rs b/src/flake.rs new file mode 100644 index 0000000..9ae8e93 --- /dev/null +++ b/src/flake.rs @@ -0,0 +1,28 @@ +use std::fmt; + +#[derive(Debug)] +enum Installable { + Flake(FlakeInstallable), +} + +impl fmt::Display for Installable { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Installable::Flake(flake) => { + write!(f, "{}", flake.reference)?; + + if !flake.attribute.is_empty() { + write!(f, "#")?; + } + } + } + + Ok(()) + } +} + +#[derive(Debug)] +struct FlakeInstallable { + reference: String, + attribute: Vec, +} diff --git a/src/main.rs b/src/main.rs index 2542f7a..0d84e0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ mod clean; mod commands; mod completion; +mod flake; mod home; mod interface; mod json;