Skip to content

Commit

Permalink
naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Dec 31, 2024
1 parent 9c02b36 commit 28392d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ami/internals/cli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 .. "<command>" .. " "
else
usage = usage .. "[<command>]" .. " "
Expand Down
1 change: 1 addition & 0 deletions src/ami/internals/interface/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local function new()
return {
id = "ami",
title = "AMI",
expects_command = false,
include_options_in_usage = true,
options = {
path = {
Expand Down
2 changes: 1 addition & 1 deletion src/ami/internals/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)?

Expand Down

0 comments on commit 28392d6

Please sign in to comment.