From 22c8993ebe5f509ee55b8af6b7a8be147b3884e6 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Wed, 25 May 2016 11:17:14 +0300 Subject: luarocks new-version: make rockspec arg optional Infer it same way `luarocks make` does. --- src/luarocks/new_version.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index 6969d4b2..3382b85c 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua @@ -11,13 +11,14 @@ local fs = require("luarocks.fs") local type_check = require("luarocks.type_check") new_version.help_summary = "Auto-write a rockspec for a new version of a rock." -new_version.help_arguments = "[--tag=] {|} [] []" +new_version.help_arguments = "[--tag=] [|] [] []" new_version.help = [[ This is a utility function that writes a new rockspec, updating data from a previous one. If a package name is given, it downloads the latest rockspec from the -default server. If a rockspec is given, it uses it instead. +default server. If a rockspec is given, it uses it instead. If no argument +is given, it looks for a rockspec same way 'luarocks make' does. If the version number is not given and tag is passed using --tag, it is used as the version, with 'v' removed from beginning. @@ -125,12 +126,16 @@ end function new_version.run(...) local flags, input, version, url = util.parse_flags(...) if not input then - return nil, "Missing argument: expected package or rockspec. "..util.see_help("new_version") + local err + input, err = util.get_default_rockspec() + if not input then + return nil, err + end end assert(type(input) == "string") local filename = input - if not input:match(".rockspec$") then + if not input:match("rockspec$") then local err filename, err = download.download("rockspec", input) if not filename then -- cgit v1.2.3-55-g6feb