aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-04-06 15:15:39 -0300
committerHisham Muhammad <hisham@gobolinux.org>2013-04-06 15:15:39 -0300
commit9b974c94f065ca7867c69c768e6394bbef80ab53 (patch)
tree57483449b474095111f6228b0b90aab4a13eecb8 /src
parent32f8234b8bb9f42978d73fd3efb5c5a1d6037565 (diff)
downloadluarocks-9b974c94f065ca7867c69c768e6394bbef80ab53.tar.gz
luarocks-9b974c94f065ca7867c69c768e6394bbef80ab53.tar.bz2
luarocks-9b974c94f065ca7867c69c768e6394bbef80ab53.zip
Accept rocks and rockspecs in the remove command: interpret rock name and version from their names.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/remove.lua7
1 files changed, 7 insertions, 0 deletions
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(...)
87 87
88 local ok, err = fs.check_command_permissions(flags) 88 local ok, err = fs.check_command_permissions(flags)
89 if not ok then return nil, err end 89 if not ok then return nil, err end
90
91 local rock_type = name:match("%.(rock)$") or name:match("%.(rockspec)$")
92 local filename = name
93 if rock_type then
94 name, version = path.parse_name(filename)
95 if not name then return nil, "Invalid "..rock_type.." filename: "..filename end
96 end
90 97
91 local results = {} 98 local results = {}
92 search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) 99 search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version))