From 9b974c94f065ca7867c69c768e6394bbef80ab53 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sat, 6 Apr 2013 15:15:39 -0300 Subject: Accept rocks and rockspecs in the remove command: interpret rock name and version from their names. --- src/luarocks/remove.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 126cfdc8..8c899a0a 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua @@ -87,6 +87,13 @@ function run(...) local ok, err = fs.check_command_permissions(flags) if not ok then return nil, err end + + local rock_type = name:match("%.(rock)$") or name:match("%.(rockspec)$") + local filename = name + if rock_type then + name, version = path.parse_name(filename) + if not name then return nil, "Invalid "..rock_type.." filename: "..filename end + end local results = {} search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) -- cgit v1.2.3-55-g6feb