Skip to content

Commit

Permalink
Update arghelper and help_parser modules.
Browse files Browse the repository at this point in the history
The clink-gizmos repo includes a copy of them, and needed some changes.
  • Loading branch information
chrisant996 committed Aug 14, 2024
1 parent f8ec35e commit 6c261e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/arghelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ end
local exports = {
make_arg_hider_func = make_arg_hider_func,
make_one_letter_concat_classifier_func = make_one_letter_concat_classifier_func,
make_one_letter_concat_onalias_func = make_one_letter_concat_onalias_func,
}

return exports
17 changes: 14 additions & 3 deletions modules/help_parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ if (clink.version_encoded or 0) < 10030010 then -- Requires _argmatcher:setdelay
return
end

local ah = require("arghelper")
local function try_require(module)
local r
pcall(function() r = require(module) end)
return r
end

local ah = try_require("arghelper")

--------------------------------------------------------------------------------
local function sentence_casing(text)
Expand Down Expand Up @@ -681,8 +687,13 @@ local function run(argmatcher, parser, command, config)
argmatcher:adddescriptions(descriptions)
argmatcher:hideflags(hideflags)

if config.concat and argmatcher.setclassifier then
argmatcher:setclassifier(ah.make_one_letter_concat_classifier_func(actual_flags, argmatcher))
if config.concat and argmatcher.setclassifier and ah then
if ah.make_one_letter_concat_classifier_func then
argmatcher:setclassifier(ah.make_one_letter_concat_classifier_func(actual_flags, argmatcher))
if ah.make_one_letter_concat_onalias_func then
argmatcher:addflags({ onalias=ah.make_one_letter_concat_onalias_func(argmatcher) })
end
end
end
end

Expand Down

0 comments on commit 6c261e9

Please sign in to comment.