mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-10-30 16:30:56 +08:00
lib: Various realm / flux fixes
This commit is contained in:
+1
-1
@@ -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"]
|
||||
|
||||
|
||||
@@ -127,10 +127,9 @@ 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(())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#[path = "flux/select.rs"]
|
||||
pub mod select;
|
||||
@@ -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,
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user