@@ -189,8 +189,6 @@ fn install_remote_plugin(name: &str, repo_url: &str) -> Result<(), String> {
189189 . args ( [
190190 "clone" ,
191191 "--depth" , "1" ,
192- "--filter=blob:none" ,
193- "--sparse" ,
194192 repo_url,
195193 ] )
196194 . arg ( & temp_dir)
@@ -204,15 +202,7 @@ fn install_remote_plugin(name: &str, repo_url: &str) -> Result<(), String> {
204202 return Err ( "Failed to clone repository" . to_string ( ) ) ;
205203 }
206204
207- let sparse_checkout = Command :: new ( "git" )
208- . args ( [ "sparse-checkout" , "set" , & format ! ( "plugins/{}" , name) ] )
209- . current_dir ( & temp_dir)
210- . stdout ( Stdio :: inherit ( ) )
211- . stderr ( Stdio :: inherit ( ) )
212- . status ( )
213- . map_err ( |_| "Failed to set sparse checkout" . to_string ( ) ) ?;
214-
215- if !sparse_checkout. success ( ) || !plugin_path. is_dir ( ) {
205+ if !plugin_path. is_dir ( ) {
216206 let _ = fs:: remove_dir_all ( & temp_dir) ;
217207 return Err ( format ! (
218208 "Plugin '{}' not found in repository '{}'.\n \
@@ -227,6 +217,25 @@ fn install_remote_plugin(name: &str, repo_url: &str) -> Result<(), String> {
227217 result
228218}
229219
220+ pub fn remove_plugin ( name : & str ) -> Result < ( ) , String > {
221+ let binary_name = plugin_binary_name ( name) ;
222+ let plugin_dir = default_plugin_dir ( ) ;
223+ let binary_path = plugin_dir. join ( & binary_name) ;
224+
225+ if binary_path. is_file ( ) {
226+ fs:: remove_file ( & binary_path)
227+ . map_err ( |err| format ! ( "Failed to remove plugin '{}': {}" , name, err) ) ?;
228+ println ! ( "Removed plugin '{}'" , name) ;
229+ Ok ( ( ) )
230+ } else {
231+ Err ( format ! (
232+ "Plugin '{}' is not installed (not found at {})" ,
233+ name,
234+ binary_path. display( )
235+ ) )
236+ }
237+ }
238+
230239pub fn list_plugins ( ) -> Result < Vec < ( String , PathBuf ) > , String > {
231240 let mut plugins = Vec :: new ( ) ;
232241
0 commit comments