From e0799e77b9d047319b54e31727633d9c02be10cd Mon Sep 17 00:00:00 2001 From: believer Date: Mon, 20 Nov 2023 13:42:32 +0100 Subject: [PATCH] fix(uninstall): filter flags from packages --- src/commands/uninstall.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/commands/uninstall.rs b/src/commands/uninstall.rs index 1436146..c9a6772 100644 --- a/src/commands/uninstall.rs +++ b/src/commands/uninstall.rs @@ -1,8 +1,17 @@ use crate::utils::{helpers, node}; use helpers::Result; -pub fn run(name: Vec, global: bool) -> Result<()> { - node::uninstall(&name, global); +pub fn run(packages: Vec, global: bool) -> Result<()> { + let packages = packages + .iter() + // Filter out any flags + // This can happen when passing args using `--` + // For example: `supreme install is-even -- -W` + .filter(|p| !p.starts_with('-')) + .map(|p| p.to_string()) + .collect::>(); + + node::uninstall(&packages, global); Ok(()) }