aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/path.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/path.lua')
-rw-r--r--src/luarocks/path.lua40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua
index d7273095..200829d0 100644
--- a/src/luarocks/path.lua
+++ b/src/luarocks/path.lua
@@ -7,7 +7,6 @@ module("luarocks.path", package.seeall)
7local dir = require("luarocks.dir") 7local dir = require("luarocks.dir")
8local cfg = require("luarocks.cfg") 8local cfg = require("luarocks.cfg")
9local util = require("luarocks.util") 9local util = require("luarocks.util")
10local deps = require("luarocks.deps")
11 10
12help_summary = "Return the currently configured package path." 11help_summary = "Return the currently configured package path."
13help_arguments = "" 12help_arguments = ""
@@ -390,42 +389,3 @@ function which(module_name, filename, name, version, tree, manifest)
390 assert(false) 389 assert(false)
391end 390end
392 391
393--- Driver function for "path" command.
394-- @return boolean This function always succeeds.
395function run(...)
396 local flags = util.parse_flags(...)
397 local deps_mode = deps.get_deps_mode(flags)
398
399 local lr_path, lr_cpath = cfg.package_paths()
400 local bin_dirs = map_trees(deps_mode, deploy_bin_dir)
401
402 if flags["lr-path"] then
403 util.printout(util.remove_path_dupes(lr_path, ';'))
404 return true
405 elseif flags["lr-cpath"] then
406 util.printout(util.remove_path_dupes(lr_cpath, ';'))
407 return true
408 elseif flags["lr-bin"] then
409 local lr_bin = util.remove_path_dupes(table.concat(bin_dirs, cfg.export_path_separator), cfg.export_path_separator)
410 util.printout(util.remove_path_dupes(lr_bin, ';'))
411 return true
412 end
413
414 if flags["append"] then
415 lr_path = package.path .. ";" .. lr_path
416 lr_cpath = package.cpath .. ";" .. lr_cpath
417 else
418 lr_path = lr_path.. ";" .. package.path
419 lr_cpath = lr_cpath .. ";" .. package.cpath
420 end
421
422 util.printout(cfg.export_lua_path:format(util.remove_path_dupes(lr_path, ';')))
423 util.printout(cfg.export_lua_cpath:format(util.remove_path_dupes(lr_cpath, ';')))
424 if flags["bin"] then
425 table.insert(bin_dirs, 1, os.getenv("PATH"))
426 local lr_bin = util.remove_path_dupes(table.concat(bin_dirs, cfg.export_path_separator), cfg.export_path_separator)
427 util.printout(cfg.export_path:format(lr_bin))
428 end
429 return true
430end
431