allow only one positional param to be specified

develop
myk002 2021-07-09 22:16:30 -07:00
parent c1665f35b4
commit 8fb456313f
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 14 additions and 9 deletions

@ -2855,11 +2855,12 @@ smoothing and track carving) are handled.
Usage::
dig-now [<pos> <pos>] [<options>]
dig-now [<pos> [<pos>]] [<options>]
Where the optional ``<pos>`` pair can be used to specify the coordinate bounds
within which ``dig-now`` will operate. If they are not specified, ``dig-now``
will scan the entire map.
will scan the entire map. If only one ``<pos>`` is specified, only the tile at
that coordinate is processed.
Any ``<pos>`` parameters can either be an ``<x>,<y>,<z>`` triple (e.g.
``35,12,150``) or the string ``here``, which means the position of the active

@ -16,12 +16,12 @@ standard game rules, but the behavior is configurable.
Usage:
dig-now [<pos> <pos>] [<options>]
dig-now [<pos> [<pos>]] [<options>]
Examples:
dig-now
Dig designated tiles according to standard game rules.
Dig all designated tiles according to standard game rules.
dig-now --clean
Dig designated tiles, but don't generate any boulders, ores, or gems.
@ -85,12 +85,16 @@ function parse_commandline(opts, ...)
df.global.window_z
parse_coords(opts, 'start', ('0,0,%d'):format(z))
parse_coords(opts, 'end', ('%d,%d,%d'):format(x, y, z))
elseif #positionals >= 2 then
elseif #positionals >= 1 then
parse_coords(opts, 'start', positionals[1])
parse_coords(opts, 'end', positionals[2])
opts.start.x, opts['end'].x = min_to_max(opts.start.x, opts['end'].x)
opts.start.y, opts['end'].y = min_to_max(opts.start.y, opts['end'].y)
opts.start.z, opts['end'].z = min_to_max(opts.start.z, opts['end'].z)
if #positionals >= 2 then
parse_coords(opts, 'end', positionals[2])
opts.start.x, opts['end'].x = min_to_max(opts.start.x,opts['end'].x)
opts.start.y, opts['end'].y = min_to_max(opts.start.y,opts['end'].y)
opts.start.z, opts['end'].z = min_to_max(opts.start.z,opts['end'].z)
else
utils.assign(opts['end'], opts.start)
end
end
end