ronantakizawa/codereview-bench huggingface dataset:
Repository: swc-project/swc
File: crates/swc_ecma_minifier/tests/exec.rs (Rust)

Code before:

printError()

        ",
    );
}

#[test]
fn issue_11517() {
    // Test that the minifier does not incorrectly merge if statements with
    // similar structures but different string literal values in local variables.
    run_default_exec_test(
        "
const buildErrorLog = ({
  errorType,
  mode,
}) => {
  const isModeA = mode === 'modeA';
  const isModeB = mode === 'modeB';

  if (errorType === 'A_ERROR') {
    const message = 'A error occured';
    return { fieldX: true, fieldY: true, message };
  }
  if (errorType === 'B_ERROR') {
    const message = 'B error occured';
    return { fieldX: true, fieldY: true, message };
  }
  return { fieldX: true, fieldY: true, message: 'Invalid configuration' };
};

const resultA = buildErrorLog({ errorType: 'A_ERROR', mode: 'modeA' });
const resultB = buildErrorLog({ errorType: 'B_ERROR', mode: 'modeB' });
console.log('A:', resultA.message);
console.log('B:', resultB.message);
        ",
    );
}


Review comment (suggestion):
Typo in the test string literal: "occured" → "occurred". If the exact wording is not required for reproduction, consider fixing the spelling to avoid cementing typos in test fixtures/output.
```suggestion
    const message = 'A error occurred';
    return { fieldX: true, fieldY: true, message };
  }
  if (errorType === 'B_ERROR') {
    const message = 'B error occurred';
```

Code after:

printError()

        ",
    );
}

#[test]
fn issue_11517() {
    // Test that the minifier does not incorrectly merge if statements with
    // similar structures but different string literal values in local variables.
    run_default_exec_test(
        "
const buildErrorLog = ({
  errorType,
  mode,
}) => {
  const isModeA = mode === 'modeA';
  const isModeB = mode === 'modeB';

  if (errorType === 'A_ERROR') {
    const message = 'A error occured';
    return { fieldX: true, fieldY: true, message };
  }
  if (errorType === 'B_ERROR') {
    const message = 'B error occured';
    return { fieldX: true, fieldY: true, message };
  }
  return { fieldX: true, fieldY: true, message: 'Invalid configuration' };
};

const resultA = buildErrorLog({ errorType: 'A_ERROR', mode: 'modeA' });
const resultB = buildErrorLog({ errorType: 'B_ERROR', mode: 'modeB' });
console.log('A:', resultA.message);
console.log('B:', resultB.message);
        ",
    );
}

/// Test that `unsafe_hoist_static_method_alias` properly handles variable name
/// collisions. When a variable already exists with the same name as the alias
/// would have, the hoisting should either use a different name or skip
/// hoisting.
#[test]
fn issue_9741_collision() {
    let src = r#"
const _Object_assign = [];
_Object_assign.push(1);
_Object_assign.push(2);
_Object_assign.push(3);
Repository: swc-project/swc
File: crates/swc_es_parser/tests/parity_suite.rs (Rust)

Code before:
    }

    assert!(
        mismatches.is_empty(),
        "{name}: {}/{} mismatches\n{}",
        mismatches.len(),
        checked,
        mismatches.join("\n\n")
    );
}

#[test]
fn parity_core_corpus() {
    let mut cases = Vec::new();
    for category in CORE_CATEGORIES {
        for path in collect_files_for_category(category) {
            cases.push(Case {
                path,
                category: (*category).to_string(),
            });
        }
    }

    let cases = filter_ignored_cases(cases);
    run_cases("core-corpus", cases);
}

#[test]
fn parity_large_samples() {
    let tsc_cases = collect_files_for_category("tsc")
        .into_iter()
        .map(|path| Case {
            path,
            category: "tsc".to_string(),
        })
        .collect::<Vec<_>>();
    let tsc_cases = sample_cases(filter_ignored_cases(tsc_cases), 200);

    let test262_cases = collect_files_for_category("test262-parser")
        .into_iter()
        .filter(|path| {
            let normalized = normalized(path);
            normalized.contains("/test262-parser/pass/")
                || normalized.contains("/test262-parser/fail/")
        })
        .map(|path| Case {
            path,
            category: "test262-parser".to_string(),
        })
        .collect::<Vec<_>>();
    let test262_cases = filter_ignored_cases(test262_cases);

Review comment (performance):
`parity_large_samples` no longer samples the `tsc` and `test262-parser` corpora. Given the size of `crates/swc_ecma_parser/tests/tsc` and `test262-parser`, this can make `cargo test -p swc_es_parser --test parity_suite` extremely slow and potentially non-viable for CI/local runs. Consider gating the full run behind an env var/feature (keeping the default as a representative sample), splitting into a separate ignored/extended test, or parallelizing/sharding the corpus.

Code after:
        .collect::<Vec<_>>();
    let tsc_cases = filter_ignored_cases(tsc_cases);

    let test262_cases = collect_files_for_category("test262-parser")
        .into_iter()
        .filter(|path| {
            let normalized = normalized(path);
            normalized.contains("/test262-parser/pass/")
                || normalized.contains("/test262-parser/fail/")
        })
        .map(|path| Case {
            path,
            category: "test262-parser".to_string(),
        })
        .collect::<Vec<_>>();
    let test262_cases = filter_ignored_cases(test262_cases);
    let test262_pass = test262_cases
        .iter()
        .filter(|case| normalized(&case.path).contains("/test262-parser/pass/"))
        .cloned()
        .collect::<Vec<_>>();
    let test262_fail = test262_cases
        .iter()
        .filter(|case| normalized(&case.path).contains("/test262-parser/fail/"))
        .cloned()
        .collect::<Vec<_>>();

    let mut cases = Vec::new();
    cases.extend(tsc_cases);
    cases.extend(test262_pass);
    cases.extend(test262_fail);

    run_cases("large-samples", cases);
}
Repository: sxyazi/yazi
File: core/src/manager/tab.rs (Rust)

Code before:
			}
			Ok::<(), Error>(())
		});
		false
	}

	pub fn select(&mut self, state: Option<bool>) -> bool {
		let idx = Some(self.current.cursor());
		self.current.select(idx, state)
	}

	pub fn select_all(&mut self, state: Option<bool>) -> bool { self.current.select(None, state) }

	pub fn visual_mode(&mut self, unset: bool) -> bool {
		let idx = self.current.cursor();

		if unset {
			self.mode = Mode::Unset(idx, BTreeSet::from([idx]));
		} else {
			self.mode = Mode::Select(idx, BTreeSet::from([idx]));
		};
		true
	}

	pub fn current_name(&self) -> &str {
		self.current.cwd.file_name().and_then(|name| name.to_str()).unwrap_or_default()
	}
}

impl Tab {
	#[inline]
	pub fn mode(&self) -> &Mode { &self.mode }

	#[inline]
	pub fn history(&self, path: &Path) -> Option<&Folder> { self.history.get(path) }

	#[inline]
	pub fn history_new(&mut self, path: &Path) -> Folder {
		self.history.remove(path).unwrap_or_else(|| Folder::new(path))
	}

	#[inline]
	pub fn preview(&self) -> &Preview { &self.preview }

	#[inline]
	pub fn preview_reset_image(&mut self) -> bool { self.preview.reset_image() }
}


Review comment (suggestion):
Using the `cwd` itself instead of the default might be better when can't get the filename.

Code after:
		let cwd = self.current.cwd.clone();

		tokio::spawn(async move {
			let _guard = BLOCKER.acquire().await.unwrap();
			let _defer = Defer::new(|| Event::Stop(false, None).emit());
			emit!(Stop(true)).await;

			let rx =
				if global { external::fzf(FzfOpt { cwd }) } else { external::zoxide(ZoxideOpt { cwd }) }?;

			if let Ok(target) = rx.await? {
				emit!(Cd(target));
			}
			Ok::<(), Error>(())
		});
		false
	}

	pub fn select(&mut self, state: Option<bool>) -> bool {
		let idx = Some(self.current.cursor());
		self.current.select(idx, state)
	}

	pub fn select_all(&mut self, state: Option<bool>) -> bool { self.current.select(None, state) }

	pub fn visual_mode(&mut self, unset: bool) -> bool {
		let idx = self.current.cursor();

		if unset {
			self.mode = Mode::Unset(idx, BTreeSet::from([idx]));
		} else {
			self.mode = Mode::Select(idx, BTreeSet::from([idx]));
		};
		true
	}

	pub fn current_name(&self) -> Option<&str> {
		self
			.current
			.cwd
			.file_name()
			.and_then(|name| name.to_str())
			.or_else(|| self.current.cwd.to_str())
	}
}

impl Tab {
	#[inline]
	pub fn mode(&self) -> &Mode { &self.mode }

	#[inline]
Repository: sxyazi/yazi
File: app/src/header/tabs.rs (Rust)

Code before:
use config::THEME;
use ratatui::{buffer::Buffer, layout::{Alignment, Rect}, text::{Line, Span}, widgets::{Paragraph, Widget}};

use crate::Ctx;

pub(super) struct Tabs<'a> {
	cx: &'a Ctx,
}

impl<'a> Tabs<'a> {
	pub(super) fn new(cx: &'a Ctx) -> Self { Self { cx } }
}

impl<'a> Widget for Tabs<'a> {
	fn render(self, area: Rect, buf: &mut Buffer) {
		let tabs = self.cx.manager.tabs();

		let line = Line::from(
			tabs
				.iter()
				.enumerate()
				.map(|(i, tab)| {
					let mut text = format!(" {} ", i + 1);
					if THEME.tab.max_width > 0 {
						text
							.push_str(&tab.current_name().chars().take(THEME.tab.max_width).collect::<String>());
						text.push(' ');
					}

					if i == tabs.idx() {
						Span::styled(text, THEME.tab.active.get())
					} else {
						Span::styled(text, THEME.tab.inactive.get())
					}
				})
				.collect::<Vec<_>>(),
		);

		Paragraph::new(line).alignment(Alignment::Right).render(area, buf);
	}
}


Review comment (suggestion):
The number of chars and the display width are different, one Unicode char may take up 2 cells. it's better to use the `unicode-width` crate here.

Code after:
use std::ops::ControlFlow;

use config::THEME;
use ratatui::{buffer::Buffer, layout::{Alignment, Rect}, text::{Line, Span}, widgets::{Paragraph, Widget}};
use unicode_width::UnicodeWidthStr;

use crate::Ctx;

pub(super) struct Tabs<'a> {
	cx: &'a Ctx,
}

impl<'a> Tabs<'a> {
	pub(super) fn new(cx: &'a Ctx) -> Self { Self { cx } }
}

impl<'a> Widget for Tabs<'a> {
	fn render(self, area: Rect, buf: &mut Buffer) {
		let tabs = self.cx.manager.tabs();

		let line = Line::from(
			tabs
				.iter()
				.enumerate()
				.map(|(i, tab)| {
					let mut text = format!("{}", i + 1);
					if let Some(dir_name) = tab.current_name() {
						text.push(' ');
						text.push_str(dir_name);
					}

					let threshold = THEME.tab.max_width.max(1);
					let truncated = text.chars().try_fold(String::with_capacity(threshold), |mut text, c| {
						if text.width() > threshold {
							ControlFlow::Break(text)
						} else {
							text.push(c);
							ControlFlow::Continue(text)
						}
					});
					let text = match truncated {
						ControlFlow::Break(text) => text,
						ControlFlow::Continue(text) => text,
					};

					if i == tabs.idx() {
						Span::styled(format!(" {text} "), THEME.tab.active.get())
					} else {
						Span::styled(format!(" {text} "), THEME.tab.inactive.get())
					}
				})
Repository: sxyazi/yazi
File: app/src/header/tabs.rs (Rust)

Code before:

use crate::Ctx;

pub(super) struct Tabs<'a> {
	cx: &'a Ctx,
}

impl<'a> Tabs<'a> {
	pub(super) fn new(cx: &'a Ctx) -> Self { Self { cx } }
}

impl<'a> Widget for Tabs<'a> {
	fn render(self, area: Rect, buf: &mut Buffer) {
		let tabs = self.cx.manager.tabs();

		let line = Line::from(
			tabs
				.iter()
				.enumerate()
				.map(|(i, tab)| {
					let mut text = format!(" {} ", i + 1);
					if let Some(dir_name) = tab.current_name() {
						text.push_str(dir_name);
					}

					let threshold = THEME.tab.max_width.max(3) - 1;
					let truncated = text.chars().try_fold(String::with_capacity(threshold), |mut text, c| {
						if text.width() > threshold {
							ControlFlow::Break(text)
						} else {
							text.push(c);
							ControlFlow::Continue(text)
						}
					});
					let mut text = match truncated {
						ControlFlow::Break(text) => text,
						ControlFlow::Continue(text) => text,
					};
					if !text.ends_with(' ') {
						text.push(' ');
					}

					if i == tabs.idx() {
						Span::styled(text, THEME.tab.active.get())
					} else {
						Span::styled(text, THEME.tab.inactive.get())
					}
				})
				.collect::<Vec<_>>(),
		);


Review comment (suggestion):
It seems that `threshold` doesn't need to contain 2 spaces, as the spaces are `padding`, not `content`.

Currently, the spaces should always be present, and the user can be allowed to configure their own padding characters later on.

Code after:

use crate::Ctx;

pub(super) struct Tabs<'a> {
	cx: &'a Ctx,
}

impl<'a> Tabs<'a> {
	pub(super) fn new(cx: &'a Ctx) -> Self { Self { cx } }
}

impl<'a> Widget for Tabs<'a> {
	fn render(self, area: Rect, buf: &mut Buffer) {
		let tabs = self.cx.manager.tabs();

		let line = Line::from(
			tabs
				.iter()
				.enumerate()
				.map(|(i, tab)| {
					let mut text = format!("{}", i + 1);
					if let Some(dir_name) = tab.current_name() {
						text.push(' ');
						text.push_str(dir_name);
					}

					let threshold = THEME.tab.max_width.max(1);
					let truncated = text.chars().try_fold(String::with_capacity(threshold), |mut text, c| {
						if text.width() > threshold {
							ControlFlow::Break(text)
						} else {
							text.push(c);
							ControlFlow::Continue(text)
						}
					});
					let text = match truncated {
						ControlFlow::Break(text) => text,
						ControlFlow::Continue(text) => text,
					};

					if i == tabs.idx() {
						Span::styled(format!(" {text} "), THEME.tab.active.get())
					} else {
						Span::styled(format!(" {text} "), THEME.tab.inactive.get())
					}
				})
				.collect::<Vec<_>>(),
		);

		Paragraph::new(line).alignment(Alignment::Right).render(area, buf);
	}
Repository: sxyazi/yazi
File: yazi-core/src/manager/commands/paste.rs (Rust)

Code before:
use yazi_dds::Pubsub;
use yazi_shared::event::Cmd;

use crate::{manager::Manager, tasks::Tasks};

pub struct Opt {
	force: bool,
	follow: bool,
}

impl From<Cmd> for Opt {
	fn from(c: Cmd) -> Self {
		Self { force: c.named.contains_key("force"), follow: c.named.contains_key("follow") }
	}
}

impl Manager {
	pub fn paste(&mut self, opt: impl Into<Opt>, tasks: &Tasks) {
		let opt = opt.into() as Opt;
		let (src, dest) = (self.yanked.iter().collect::<Vec<_>>(), self.cwd());

		if self.yanked.cut {
			tasks.file_cut(&src, dest, opt.force);

			src.iter().for_each(|source_file| {
				if let Some(name) = source_file.file_name().map(|s| dest.join(s)) {
					Pubsub::pub_from_move(self.tabs.cursor, source_file, &name);
				}
			});

			self.tabs.iter_mut().for_each(|t| _ = t.selected.remove_many(&src, false));
			self.unyank(());
		} else {
			tasks.file_copy(&src, dest, opt.force, opt.follow);
		}
	}
}


Review comment (bug):
I think it should be moved to the scheduler, https://github.com/sxyazi/yazi/blob/357f87aecbe52f1f36efff69af67558f7cf730a2/yazi-scheduler/src/file/file.rs#L28, as moving is not immediately completed (for example, when it involves moving across mount points). Some files may fail to move due to permissions or because the mount point is full, and I think such cases should not be reported as events.

Code after:
use yazi_shared::event::Cmd;

use crate::{manager::Manager, tasks::Tasks};

pub struct Opt {
	force:  bool,
	follow: bool,
}

impl From<Cmd> for Opt {
	fn from(c: Cmd) -> Self {
		Self { force: c.named.contains_key("force"), follow: c.named.contains_key("follow") }
	}
}

impl Manager {
	pub fn paste(&mut self, opt: impl Into<Opt>, tasks: &Tasks) {
		let opt = opt.into() as Opt;
		let (src, dest) = (self.yanked.iter().collect::<Vec<_>>(), self.cwd());

		if self.yanked.cut {
			tasks.file_cut(&src, dest, opt.force);

			self.tabs.iter_mut().for_each(|t| _ = t.selected.remove_many(&src, false));
			self.unyank(());
		} else {
			tasks.file_copy(&src, dest, opt.force, opt.follow);
		}
	}
}
Repository: sxyazi/yazi
File: yazi-dds/src/payload.rs (Rust)

Code before:

		let sender =
			parts.next().and_then(|s| s.parse().ok()).ok_or_else(|| anyhow!("invalid sender"))?;

		let body = parts.next().ok_or_else(|| anyhow!("empty body"))?;

		Ok(Self { receiver, sender, body: Body::from_str(kind, body)? })
	}
}

impl<'a> From<Body<'a>> for Payload<'a> {
	fn from(value: Body<'a>) -> Self {
		Self::new(value)
	}
}

impl Display for Payload<'_> {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let result = match &self.body {
			Body::Hi(b) => serde_json::to_string(b),
			Body::Hey(b) => serde_json::to_string(b),
			Body::Cd(b) => serde_json::to_string(b),
			Body::Hover(b) => serde_json::to_string(b),
			Body::Rename(b) => serde_json::to_string(b),
			Body::Move(b) => serde_json::to_string(b),
			Body::Bulk(b) => serde_json::to_string(b),
			Body::Yank(b) => serde_json::to_string(b),
			Body::Custom(b) => serde_json::to_string(b),
		};

		if let Ok(s) = result {
			write!(f, "{},{},{},{s}", self.body.kind(), self.receiver, self.sender)
		} else {
			Err(std::fmt::Error)
		}
	}
}


Review comment (suggestion):
```suggestion
			Body::Bulk(b) => serde_json::to_string(b),
			Body::Yank(b) => serde_json::to_string(b),
			Body::Move(b) => serde_json::to_string(b),
```

Code after:
		let body = parts.next().ok_or_else(|| anyhow!("empty body"))?;

		Ok(Self { receiver, sender, body: Body::from_str(kind, body)? })
	}
}

impl<'a> From<Body<'a>> for Payload<'a> {
	fn from(value: Body<'a>) -> Self { Self::new(value) }
}

impl Display for Payload<'_> {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let result = match &self.body {
			Body::Hi(b) => serde_json::to_string(b),
			Body::Hey(b) => serde_json::to_string(b),
			Body::Cd(b) => serde_json::to_string(b),
			Body::Hover(b) => serde_json::to_string(b),
			Body::Rename(b) => serde_json::to_string(b),
			Body::Bulk(b) => serde_json::to_string(b),
			Body::Yank(b) => serde_json::to_string(b),
			Body::Move(b) => serde_json::to_string(b),
			Body::Trash(b) => serde_json::to_string(b),
			Body::Delete(b) => serde_json::to_string(b),
			Body::Custom(b) => serde_json::to_string(b),
		};

		if let Ok(s) = result {
			write!(f, "{},{},{},{s}", self.body.kind(), self.receiver, self.sender)
		} else {
			Err(std::fmt::Error)
		}
	}
}
Repository: sxyazi/yazi
File: yazi-scheduler/src/scheduler.rs (Rust)

Code before:
					}
					ongoing.lock().try_remove(id, TaskStage::Hooked);
				}
				.boxed()
			})
		});

		let file = self.file.clone();
		_ = self.micro.try_send(
			async move {
				file.delete(FileOpDelete { id, target, length: 0 }).await.ok();
			}
			.boxed(),
			LOW,
		);
	}

	pub fn file_trash(&self, target: Url) {
		let name = format!("Trash {:?}", target);
		let id = self.ongoing.lock().add(TaskKind::User, name);

		let file = self.file.clone();
		_ = self.micro.try_send(
			async move {
				file.trash(FileOpTrash { id, target: target.clone(), length: 0 }).await.ok();
				Pump::push_delete(target);
			}
			.boxed(),
			LOW,
		);
	}

	pub fn plugin_micro(&self, name: String, args: Vec<ValueSendable>) {
		let id = self.ongoing.lock().add(TaskKind::User, format!("Run micro plugin `{name}`"));

		let plugin = self.plugin.clone();
		_ = self.micro.try_send(
			async move {
				plugin.micro(PluginOpEntry { id, name, args }).await.ok();
			}
			.boxed(),
			NORMAL,
		);
	}

	pub fn plugin_macro(&self, name: String, args: Vec<ValueSendable>) {
		let id = self.ongoing.lock().add(TaskKind::User, format!("Run macro plugin `{name}`"));

		self.plugin.macro_(PluginOpEntry { id, name, args }).ok();
	}


Review comment (suggestion):
I don't really like adding `trash` to `delete` because they're two different concepts, I think it deserves a new `trash` event kind.

Code after:
					}
					ongoing.lock().try_remove(id, TaskStage::Hooked);
				}
				.boxed()
			})
		});

		let file = self.file.clone();
		_ = self.micro.try_send(
			async move {
				file.delete(FileOpDelete { id, target, length: 0 }).await.ok();
			}
			.boxed(),
			LOW,
		);
	}

	pub fn file_trash(&self, target: Url) {
		let name = format!("Trash {:?}", target);
		let id = self.ongoing.lock().add(TaskKind::User, name);

		let file = self.file.clone();
		_ = self.micro.try_send(
			async move {
				file.trash(FileOpTrash { id, target: target.clone(), length: 0 }).await.ok();
				Pump::push_trash(target);
			}
			.boxed(),
			LOW,
		);
	}

	pub fn plugin_micro(&self, name: String, args: Vec<ValueSendable>) {
		let id = self.ongoing.lock().add(TaskKind::User, format!("Run micro plugin `{name}`"));

		let plugin = self.plugin.clone();
		_ = self.micro.try_send(
			async move {
				plugin.micro(PluginOpEntry { id, name, args }).await.ok();
			}
			.boxed(),
			NORMAL,
		);
	}

	pub fn plugin_macro(&self, name: String, args: Vec<ValueSendable>) {
		let id = self.ongoing.lock().add(TaskKind::User, format!("Run macro plugin `{name}`"));

		self.plugin.macro_(PluginOpEntry { id, name, args }).ok();
	}
Repository: sxyazi/yazi
File: yazi-cli/src/main.rs (Rust)

Code before:
		Command::PubStatic(cmd) => {
			yazi_dds::init();
			if let Err(e) = yazi_dds::Client::shot(&cmd.kind, 0, Some(cmd.severity), &cmd.body()?).await {
				eprintln!("Cannot send message: {e}");
				std::process::exit(1);
			}
		}
		Command::Pack(cmd) => {
			package::init();
			if cmd.install {
				package::Package::install_from_config("plugin", false).await?;
				package::Package::install_from_config("flavor", false).await?;
			} else if cmd.list {
				package::Package::list_from_config("plugin").await?;
				package::Package::list_from_config("flavor").await?;
			} else if cmd.upgrade {
				package::Package::install_from_config("plugin", true).await?;
				package::Package::install_from_config("flavor", true).await?;
			} else if let Some(repo) = &cmd.add {
				package::Package::add_to_config(repo).await?;
			}
		}

		Command::Sub(cmd) => {
			yazi_dds::init();
			let kinds = cmd.kinds.split(',').map(|s| s.to_owned()).collect::<HashSet<_>>();

			yazi_dds::Client::echo_events_to_stdout(kinds).await?;

			tokio::signal::ctrl_c().await?;
		}
	}

	Ok(())
}


Review comment (suggestion):
```suggestion
			let kinds: HashSet<_> = cmd.kinds.split(',').collect();
```

This avoids reallocating memory.

Code after:
			if let Err(e) = yazi_dds::Client::shot(&cmd.kind, 0, Some(cmd.severity), &cmd.body()?).await {
				eprintln!("Cannot send message: {e}");
				std::process::exit(1);
			}
		}
		Command::Pack(cmd) => {
			package::init();
			if cmd.install {
				package::Package::install_from_config("plugin", false).await?;
				package::Package::install_from_config("flavor", false).await?;
			} else if cmd.list {
				package::Package::list_from_config("plugin").await?;
				package::Package::list_from_config("flavor").await?;
			} else if cmd.upgrade {
				package::Package::install_from_config("plugin", true).await?;
				package::Package::install_from_config("flavor", true).await?;
			} else if let Some(repo) = &cmd.add {
				package::Package::add_to_config(repo).await?;
			}
		}

		Command::Sub(cmd) => {
			yazi_dds::init();
			yazi_dds::Client::draw(cmd.kinds.split(',').collect()).await?;

			tokio::signal::ctrl_c().await?;
		}
	}

	Ok(())
}