diff --git a/src/ami/internals/cli.lua b/src/ami/internals/cli.lua index 8b1557f..d7feafe 100644 --- a/src/ami/internals/cli.lua +++ b/src/ami/internals/cli.lua @@ -191,14 +191,14 @@ end local function default_validate_args(optionList, command, cli) local options = type(cli.options) == "table" and cli.options or {} - if cli.commandRequired and not command then + if cli.expects_command == true and not command then return false, "command not specified" end for k, v in pairs(options) do if v and v.required then if not optionList[k] then - return false, "Required option not specified! (" .. k .. ")" + return false, "required option not specified (" .. k .. ")" end end end @@ -285,7 +285,7 @@ local function generate_usage(cli, include_options_in_usage) if cli.type == "namespace" then usage = usage .. "[args...]" .. " " - elseif cli.commandRequired then + elseif cli.expects_command then usage = usage .. "" .. " " else usage = usage .. "[]" .. " " diff --git a/src/ami/internals/interface/base.lua b/src/ami/internals/interface/base.lua index 67fbc0b..cd67152 100644 --- a/src/ami/internals/interface/base.lua +++ b/src/ami/internals/interface/base.lua @@ -19,6 +19,7 @@ local function new() return { id = "ami", title = "AMI", + expects_command = false, include_options_in_usage = true, options = { path = { diff --git a/src/ami/internals/types.lua b/src/ami/internals/types.lua index e63eeaa..6fb3a0c 100644 --- a/src/ami/internals/types.lua +++ b/src/ami/internals/types.lua @@ -11,7 +11,7 @@ ---@class AmiCliBase ---@field id string | nil ---@field title string | nil ----@field commandRequired boolean +---@field expects_command boolean ---@field include_options_in_usage boolean ---@field action fun(_options: any, _command: any, _args: any, _cli: AmiCli)?