mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-10-18 19:10:36 +08:00
lib/terminal: Remove option to run command quietly
This commit is contained in:
@@ -13,7 +13,6 @@ use radicle_cli::terminal::{Args, Error, Help};
|
||||
|
||||
use crate::commands::tui_inbox::common::InboxOperation;
|
||||
use crate::terminal;
|
||||
use crate::terminal::Quiet;
|
||||
use crate::ui::items::notification::filter::{NotificationFilter, SortBy};
|
||||
|
||||
use self::common::RepositoryMode;
|
||||
@@ -220,7 +219,6 @@ pub async fn run(options: Options, ctx: impl radicle_cli::terminal::Context) ->
|
||||
terminal::run_rad(
|
||||
Some("inbox"),
|
||||
&["show".into(), id.to_string().into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
break;
|
||||
}
|
||||
@@ -228,7 +226,6 @@ pub async fn run(options: Options, ctx: impl radicle_cli::terminal::Context) ->
|
||||
terminal::run_rad(
|
||||
Some("inbox"),
|
||||
&["clear".into(), id.to_string().into()],
|
||||
Quiet::Yes,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +236,7 @@ pub async fn run(options: Options, ctx: impl radicle_cli::terminal::Context) ->
|
||||
}
|
||||
}
|
||||
Operation::Other { args } => {
|
||||
terminal::run_rad(Some("inbox"), &args, Quiet::No)?;
|
||||
terminal::run_rad(Some("inbox"), &args)?;
|
||||
}
|
||||
Operation::Unknown { .. } => {
|
||||
anyhow::bail!("unknown operation provided");
|
||||
|
||||
@@ -22,7 +22,7 @@ use cli::terminal::{Args, Error, Help};
|
||||
|
||||
use crate::cob;
|
||||
use crate::commands::tui_issue::common::IssueOperation;
|
||||
use crate::terminal::{self, Quiet};
|
||||
use crate::terminal;
|
||||
use crate::ui::TerminalInfo;
|
||||
|
||||
lazy_static! {
|
||||
@@ -237,7 +237,6 @@ pub async fn run(options: Options, ctx: impl Context) -> anyhow::Result<()> {
|
||||
terminal::run_rad(
|
||||
Some("issue"),
|
||||
&["show".into(), id.to_string().into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
break;
|
||||
}
|
||||
@@ -261,14 +260,12 @@ pub async fn run(options: Options, ctx: impl Context) -> anyhow::Result<()> {
|
||||
"--edit".into(),
|
||||
comment_id.to_string().into(),
|
||||
],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
_ => {
|
||||
terminal::run_rad(
|
||||
Some("issue"),
|
||||
&["edit".into(), id.to_string().into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
@@ -277,21 +274,18 @@ pub async fn run(options: Options, ctx: impl Context) -> anyhow::Result<()> {
|
||||
terminal::run_rad(
|
||||
Some("issue"),
|
||||
&["state".into(), id.to_string().into(), "--solved".into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
IssueOperation::Close { id } => {
|
||||
terminal::run_rad(
|
||||
Some("issue"),
|
||||
&["state".into(), id.to_string().into(), "--closed".into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
IssueOperation::Reopen { id } => {
|
||||
terminal::run_rad(
|
||||
Some("issue"),
|
||||
&["state".into(), id.to_string().into(), "--open".into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
IssueOperation::Comment {
|
||||
@@ -320,7 +314,7 @@ pub async fn run(options: Options, ctx: impl Context) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Operation::Other { args } => {
|
||||
terminal::run_rad(Some("issue"), &args, Quiet::No)?;
|
||||
terminal::run_rad(Some("issue"), &args)?;
|
||||
}
|
||||
Operation::Unknown { .. } => {
|
||||
anyhow::bail!("unknown operation provided");
|
||||
|
||||
@@ -19,7 +19,6 @@ use radicle_cli::terminal::args;
|
||||
use radicle_cli::terminal::args::{string, Args, Error, Help};
|
||||
|
||||
use crate::terminal;
|
||||
use crate::terminal::Quiet;
|
||||
use crate::ui::items::filter::DidFilter;
|
||||
use crate::ui::items::patch::filter::PatchFilter;
|
||||
|
||||
@@ -332,7 +331,6 @@ pub async fn run(options: Options, ctx: impl radicle_cli::terminal::Context) ->
|
||||
terminal::run_rad(
|
||||
Some("patch"),
|
||||
&["show".into(), id.to_string().into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
PatchOperation::Diff { id } => {
|
||||
@@ -343,13 +341,12 @@ pub async fn run(options: Options, ctx: impl radicle_cli::terminal::Context) ->
|
||||
.ok_or_else(|| anyhow!("unknown patch '{id}'"))?;
|
||||
let range = format!("{}..{}", patch.base(), patch.head());
|
||||
|
||||
terminal::run_git(Some("diff"), &[range.into()], Quiet::No)?;
|
||||
terminal::run_git(Some("diff"), &[range.into()])?;
|
||||
}
|
||||
PatchOperation::Checkout { id } => {
|
||||
terminal::run_rad(
|
||||
Some("patch"),
|
||||
&["checkout".into(), id.to_string().into()],
|
||||
Quiet::No,
|
||||
)?;
|
||||
}
|
||||
PatchOperation::_Review { id } => {
|
||||
@@ -377,7 +374,7 @@ pub async fn run(options: Options, ctx: impl radicle_cli::terminal::Context) ->
|
||||
interface::review(opts.clone(), profile, rid, patch_id).await?;
|
||||
}
|
||||
Operation::Other { args } => {
|
||||
terminal::run_rad(Some("patch"), &args, Quiet::No)?;
|
||||
terminal::run_rad(Some("patch"), &args)?;
|
||||
}
|
||||
Operation::Unknown { .. } => {
|
||||
anyhow::bail!("unknown operation provided");
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ use radicle_cli::terminal as cli_term;
|
||||
use commands::*;
|
||||
use terminal as term;
|
||||
|
||||
use crate::terminal::{ForwardError, Quiet};
|
||||
use crate::terminal::ForwardError;
|
||||
|
||||
pub const NAME: &str = "rad-tui";
|
||||
pub const DESCRIPTION: &str = "Radicle terminal interfaces";
|
||||
@@ -224,7 +224,7 @@ fn run_other(command: Option<&str>, args: &[OsString]) -> Result<(), Error> {
|
||||
args.to_vec(),
|
||||
);
|
||||
}
|
||||
command => term::run_rad(command, args, Quiet::No).map_err(|err| err.into()),
|
||||
command => term::run_rad(command, args).map_err(|err| err.into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-25
@@ -12,11 +12,6 @@ use radicle_cli::terminal::io;
|
||||
use radicle_cli::terminal::patch::Message;
|
||||
use radicle_cli::terminal::{Args, Command, DefaultContext, Error, Help};
|
||||
|
||||
pub enum Quiet {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ForwardError {
|
||||
#[error("an internal error occured while executing 'rad'")]
|
||||
@@ -33,15 +28,8 @@ pub enum GitError {
|
||||
Io(#[from] std::io::Error),
|
||||
}
|
||||
|
||||
fn _run_rad(args: &[OsString], quiet: Quiet) -> Result<(), ForwardError> {
|
||||
let status = match quiet {
|
||||
Quiet::Yes => process::Command::new("rad")
|
||||
.args(args)
|
||||
.stdout(process::Stdio::null())
|
||||
.stderr(process::Stdio::null())
|
||||
.status(),
|
||||
Quiet::No => process::Command::new("rad").args(args).status(),
|
||||
};
|
||||
fn _run_rad(args: &[OsString]) -> Result<(), ForwardError> {
|
||||
let status = process::Command::new("rad").args(args).status();
|
||||
|
||||
match status {
|
||||
Ok(status) => {
|
||||
@@ -54,31 +42,24 @@ fn _run_rad(args: &[OsString], quiet: Quiet) -> Result<(), ForwardError> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_rad(command: Option<&str>, args: &[OsString], quiet: Quiet) -> Result<(), ForwardError> {
|
||||
pub fn run_rad(command: Option<&str>, args: &[OsString]) -> Result<(), ForwardError> {
|
||||
let args = if let Some(command) = command {
|
||||
[vec![command.into()], args.to_vec()].concat()
|
||||
} else {
|
||||
args.to_vec()
|
||||
};
|
||||
|
||||
_run_rad(&args, quiet)
|
||||
_run_rad(&args)
|
||||
}
|
||||
|
||||
pub fn run_git(command: Option<&str>, args: &[OsString], quiet: Quiet) -> Result<(), GitError> {
|
||||
pub fn run_git(command: Option<&str>, args: &[OsString]) -> Result<(), GitError> {
|
||||
let args = if let Some(command) = command {
|
||||
[vec![command.into()], args.to_vec()].concat()
|
||||
} else {
|
||||
args.to_vec()
|
||||
};
|
||||
|
||||
let status = match quiet {
|
||||
Quiet::Yes => process::Command::new("git")
|
||||
.args(args)
|
||||
.stdout(process::Stdio::null())
|
||||
.stderr(process::Stdio::null())
|
||||
.status(),
|
||||
Quiet::No => process::Command::new("git").args(args).status(),
|
||||
};
|
||||
let status = process::Command::new("git").args(args).status();
|
||||
match status {
|
||||
Ok(status) => {
|
||||
if !status.success() {
|
||||
|
||||
Reference in New Issue
Block a user