Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
lib: Various realm / flux fixes
Erik Kundt committed 2 years ago
commit 98b54a4ffef4f6f78dcbe9d06649e9601a42e724
parent 06a01946c250776e7caaab28603930a7da35e07e
7 files changed +13 -71
modified Cargo.toml
@@ -11,7 +11,7 @@ name = "rad-tui"
path = "bin/main.rs"

[features]
-
default = ["realm"]
+
default = ["flux"]
realm = ["dep:tuirealm", "dep:tui-realm-stdlib"]
flux = ["dep:tokio", "dep:tokio-stream"]

modified bin/commands/inbox.rs
@@ -128,9 +128,8 @@ impl Args for Options {
#[cfg(feature = "realm")]
pub fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()> {
    use tui::common::context;
-
    use tui::realm::Window;
-
    use tui::common::context;
    use tui::common::log;
+
    use tui::realm::Window;

    pub const FPS: u64 = 60;
    let (_, id) = radicle::rad::cwd()
@@ -162,6 +161,7 @@ pub fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()>
#[tokio::main]
pub async fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()> {
    use radicle::storage::ReadStorage;
+
    use tui::common::log;

    let (_, rid) = radicle::rad::cwd()
        .map_err(|_| anyhow!("this command must be run in the context of a project"))?;
@@ -189,4 +189,6 @@ pub async fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Resu
            eprint!("{output}");
        }
    }
+

+
    Ok(())
}
added bin/commands/inbox/flux.rs
@@ -0,0 +1,2 @@
+
#[path = "flux/select.rs"]
+
pub mod select;
modified bin/commands/issue/realm/select.rs
@@ -5,12 +5,10 @@ mod page;
#[path = "select/ui.rs"]
mod ui;

-
use std::fmt::Display;
use std::hash::Hash;

use anyhow::Result;
use radicle::issue::IssueId;
-
use serde::Serialize;

use tuirealm::application::PollStrategy;
use tuirealm::event::Key;
@@ -32,35 +30,6 @@ use super::super::common::Mode;

type Selection = tui::Selection<IssueId>;

-
/// The selected issue operation returned by the operation
-
/// selection widget.
-
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
-
pub enum IssueOperation {
-
    Show,
-
    Delete,
-
    Edit,
-
    Comment,
-
}
-

-
impl Display for IssueOperation {
-
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-
        match self {
-
            IssueOperation::Show => {
-
                write!(f, "show")
-
            }
-
            IssueOperation::Delete => {
-
                write!(f, "delete")
-
            }
-
            IssueOperation::Edit => {
-
                write!(f, "edit")
-
            }
-
            IssueOperation::Comment => {
-
                write!(f, "comment")
-
            }
-
        }
-
    }
-
}
-

#[derive(Debug, Eq, PartialEq, Clone, Hash)]
pub enum ListCid {
    Header,
modified bin/commands/issue/realm/select/event.rs
@@ -12,8 +12,10 @@ use tui::realm::ui::widget::context::{ContextBar, Shortcuts};
use tui::realm::ui::widget::list::PropertyList;
use tui::realm::ui::widget::Widget;

+
use crate::tui_issue::common::IssueOperation;
+

use super::ui::{IdSelect, OperationSelect};
-
use super::{IssueOperation, Message};
+
use super::Message;

type Selection = tui::Selection<IssueId>;

modified bin/commands/patch/realm/select.rs
@@ -5,12 +5,10 @@ mod page;
#[path = "select/ui.rs"]
mod ui;

-
use std::fmt::Display;
use std::hash::Hash;

use anyhow::Result;
use radicle::patch::PatchId;
-
use serde::Serialize;

use tuirealm::application::PollStrategy;
use tuirealm::event::Key;
@@ -32,39 +30,6 @@ use super::super::common::Mode;

type Selection = tui::Selection<PatchId>;

-
/// The selected patch operation returned by the operation
-
/// selection widget.
-
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
-
pub enum PatchOperation {
-
    Show,
-
    Checkout,
-
    Delete,
-
    Edit,
-
    Comment,
-
}
-

-
impl Display for PatchOperation {
-
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-
        match self {
-
            PatchOperation::Show => {
-
                write!(f, "show")
-
            }
-
            PatchOperation::Checkout => {
-
                write!(f, "checkout")
-
            }
-
            PatchOperation::Delete => {
-
                write!(f, "delete")
-
            }
-
            PatchOperation::Edit => {
-
                write!(f, "edit")
-
            }
-
            PatchOperation::Comment => {
-
                write!(f, "comment")
-
            }
-
        }
-
    }
-
}
-

#[derive(Debug, Eq, PartialEq, Clone, Hash)]
pub enum ListCid {
    Header,
modified bin/commands/patch/realm/select/event.rs
@@ -11,8 +11,10 @@ use tui::realm::ui::widget::context::{ContextBar, Shortcuts};
use tui::realm::ui::widget::list::PropertyList;
use tui::realm::ui::widget::Widget;

+
use crate::tui_patch::common::PatchOperation;
+

use super::ui::{IdSelect, OperationSelect};
-
use super::{Message, PatchOperation};
+
use super::Message;

type Selection = tui::Selection<PatchId>;