defaultoptions()
local opts = {}
local vals = {}
- -- arguments is a special option containing all additional arguments that
- -- are not parsed. XXX: Remove this if possible.
- opts["arguments"] = vals
userdefaultoptions(opts)
e2option.documentation = string.format(doc,
e2lib.globals.default_projects_server)
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
local rc, e = e2lib.read_global_config()
if not rc then
e2lib.abort(e)
e2lib.globals.local_e2_tag = config.site.e2_tag
end
-if #opts.arguments ~= 1 then
+if #arguments ~= 1 then
e2option.usage(1)
end
-local sl, re = e2lib.parse_server_location(opts.arguments[1],
+local sl, re = e2lib.parse_server_location(arguments[1],
e2lib.globals.default_projects_server)
if not sl then
e2lib.abort(e:cat(re))
e2option.option("branch", "retrieve a specific project branch")
e2option.option("tag", "retrieve a specific project tag")
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
local rc, re = e2lib.read_global_config()
if not rc then
e2lib.abort(e:cat(re))
-- standard global tool setup finished
-if #opts.arguments < 1 then
+if #arguments < 1 then
e2lib.abort("specify path to a project to fetch")
end
-if #opts.arguments > 2 then
+if #arguments > 2 then
e2lib.abort("too many arguments")
end
-local sl, re = e2lib.parse_server_location(opts.arguments[1],
+local sl, re = e2lib.parse_server_location(arguments[1],
e2lib.globals.default_projects_server)
if not sl then
e2lib.abort(e:cat(re))
p.server = sl.server
p.location = sl.location
p.name = e2lib.basename(p.location)
-if opts.arguments[2] then
- p.destdir = opts.arguments[2]
+if arguments[2] then
+ p.destdir = arguments[2]
else
p.destdir = p.name
end
Installs local tools in project environment.
]]
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
local root = e2lib.locate_project_root()
if not root then
-- standard global tool setup finished
-if #opts.arguments > 0 then
+if #arguments > 0 then
e2option.usage(1)
end
e2option.option("enable-writeback", "enable writeback for server", nil,
enable_writeback, "SERVER")
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
-- get build mode from the command line
local build_mode = policy.handle_commandline_options(opts, true)
for r,_ in pairs(info.results) do
table.insert(results, r)
end
-elseif #opts.arguments > 0 then
- for i,r in ipairs(opts.arguments) do
+elseif #arguments > 0 then
+ for i,r in ipairs(arguments) do
table.insert(results, r)
end
end
if opts.all then
e2lib.abort("--all and --playground are mutually exclusive")
end
- if #opts.arguments ~= 1 then
+ if #arguments ~= 1 then
e2lib.abort("please select one single result for the playground")
end
end
modify and create configuration files
]]
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
-- initialize some basics in the info structure without actually loading
-- the project configuration.
local i = 1
local match = {}
-local cmd = opts.arguments[1]
-if #opts.arguments < 1 then
+local cmd = arguments[1]
+if #arguments < 1 then
e2option.usage()
e2lib.finish(1)
end
end
if #match == 1 then
local a = {}
- for _,o in ipairs(opts.arguments) do
+ for _,o in ipairs(arguments) do
table.insert(a, o)
end
local f = commands[match[1]]
]]
e2option.flag("recursive", "show indirect dependencies, too")
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
-if #opts.arguments == 0 then
+if #arguments == 0 then
e2lib.abort("no result given - enter `e2-dlist --help' for usage information")
-elseif #opts.arguments ~= 1 then e2option.usage(1) end
+elseif #arguments ~= 1 then e2option.usage(1) end
-local result = opts.arguments[1]
+local result = arguments[1]
info, re = e2tool.collect_project_info(info)
if not info then
e2lib.abort(re)
e2option.flag("source", "select sources by source names (default)")
e2option.flag("result", "select sources by result names")
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
info, re = e2tool.collect_project_info(info)
if not info then
e2lib.abort(re)
if opts.all then
e2lib.warn("WOTHER", "--all selects all sources, even files sources")
end
-if #opts.arguments > 0 then
+if #arguments > 0 then
opts.selection = true
end
if not (opts.scm or opts.files or opts.chroot or opts.selection
local sel = {} -- selected sources
-if #opts.arguments > 0 then
- for _, x in pairs(opts.arguments) do
+if #arguments > 0 then
+ for _, x in pairs(arguments) do
if info.sources[x] and not opts.result then
e2lib.log(3, "is regarded as source: " .. x)
sel[x] = x
e2option.flag("swap", "swap arrow directions in dot graph")
e2option.flag("all", "show unused results and sources, too")
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
info, re = e2tool.collect_project_info(info)
if not info then
for r, _ in pairs(info.results) do
table.insert(results, r)
end
-elseif #opts.arguments > 0 then
- for _, r in ipairs(opts.arguments) do
+elseif #arguments > 0 then
+ for _, r in ipairs(arguments) do
if info.results[r] then
table.insert(results, r)
else
e2option.flag("files", "create a new file on a files server")
e2option.option("server", "specify server")
e2option.flag("no-checksum", "don't verify checksum")
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
-- read a checksum from a file
-- @param checksum_file string: the file containing the checksums
end
if opts.git then
- if #opts.arguments ~= 1 then
+ if #arguments ~= 1 then
e2lib.abort("<name> argument required")
end
-- remote
if opts["server"] then
rserver = opts["server"]
end
- local name = opts.arguments[1]
+ local name = arguments[1]
local rlocation = string.format("%s/git/%s.git", info.project_location, name)
-- local
local lserver = info.root_server_name
e2lib.log(1,
"See e2-new-source(1) to see how to go on")
elseif opts.files then
- local location = opts.arguments[1]
+ local location = arguments[1]
local sl, e = e2lib.parse_server_location(location, info.default_files_server)
if not sl then
e2lib.abort(e)
end
local server = sl.server
local location = sl.location
- local source_file = opts.arguments[2]
- local checksum_file = opts.arguments[3]
+ local source_file = arguments[2]
+ local checksum_file = arguments[3]
local checksum_file_format = opts["checksum-file"]
local no_checksum = opts["no-checksum"]
if not no_checksum and not checksum_file then
e2option.flag("runinit","run init files automatically")
e2option.flag("showpath", "prints the path of the build directory inside the chroot to stdout" )
-local opts = e2option.parse(arg)
+local opts, arguments = e2option.parse(arg)
-- get build mode from the command line
local build_mode = policy.handle_commandline_options(opts, true)
if not build_mode then
e2lib.abort(re)
end
-if #opts.arguments ~= 1 then
+if #arguments ~= 1 then
e2option.usage(1)
end
-r = opts.arguments[1]
+r = arguments[1]
-- apply the standard build mode to all results
for _,res in pairs(info.results) do