Skip to content

Commit

Permalink
Add the chdir option for make
Browse files Browse the repository at this point in the history
Flag --chdir for make command (with help) has been added.
It's add possibility to specify a source directory of the rock when make.
  • Loading branch information
LeonidVas authored and 0x501D committed Sep 15, 2023
1 parent 822aa79 commit ebf0a6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/luarocks/cmd/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function make.cmd_options(parser)
"being built into a luarocks.lock file in the current directory.")
parser:flag("--no-manifest", "Skip creating/updating the manifest")
parser:flag("--only-deps --deps-only", "Install only the dependencies of the rock.")
parser:option("--chdir", "Specify a source directory of the rock."):argname("<path>")
util.deps_mode_option(parser)
end

Expand Down Expand Up @@ -78,6 +79,13 @@ end
-- error message otherwise. exitcode is optionally returned.
function make.command(args)
local rockspec_filename = args.rockspec

if args.chdir then
local ok, err = fs.change_dir(args.chdir)
if not ok then
return nil, err
end
end
if not rockspec_filename then
local err
rockspec_filename, err = util.get_default_rockspec()
Expand Down

0 comments on commit ebf0a6d

Please sign in to comment.