@rbxts/centurion-ui 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,6 +122,7 @@ local function getArgumentSuggestion(arg, textPart)
122
122
  _object.error = errorText
123
123
  return _object
124
124
  end
125
+ local getCommandName
125
126
  local function getCommandSuggestion(registry, parentPath, text)
126
127
  local paths = if parentPath ~= nil then registry:getChildPaths(parentPath) else registry:getRootPaths()
127
128
  if #paths == 0 then
@@ -143,41 +144,60 @@ local function getCommandSuggestion(registry, parentPath, text)
143
144
  return nil
144
145
  end
145
146
  local firstPath = paths[firstMatch[1] + 1]
146
- local _result = registry:getCommand(firstPath)
147
- if _result ~= nil then
148
- _result = _result.options
149
- end
150
- local _condition = _result
151
- if _condition == nil then
152
- local _result_1 = registry:getGroup(firstPath)
153
- if _result_1 ~= nil then
154
- _result_1 = _result_1.options
147
+ local command = registry:getCommand(firstPath)
148
+ if command ~= nil then
149
+ local _object = {
150
+ type = "command",
151
+ title = getCommandName(command.options, firstPath:tail()),
152
+ description = command.options.description,
153
+ }
154
+ local _left = "others"
155
+ -- ▼ ReadonlyArray.map ▼
156
+ local _newValue_1 = table.create(#sortedPaths)
157
+ local _callback_1 = function(_param)
158
+ local str = _param[2]
159
+ return str
155
160
  end
156
- _condition = _result_1
157
- end
158
- local mainData = _condition
159
- if mainData == nil then
160
- return nil
161
+ for _k, _v in sortedPaths do
162
+ _newValue_1[_k] = _callback_1(_v, _k - 1, sortedPaths)
163
+ end
164
+ -- ▲ ReadonlyArray.map ▲
165
+ _object[_left] = _newValue_1
166
+ _object.shortcuts = (command.options).shortcuts
167
+ return _object
168
+ end
169
+ local group = registry:getGroup(firstPath)
170
+ if group ~= nil then
171
+ local _object = {
172
+ type = "command",
173
+ title = group.options.name,
174
+ description = group.options.description,
175
+ }
176
+ local _left = "others"
177
+ -- ▼ ReadonlyArray.map ▼
178
+ local _newValue_1 = table.create(#sortedPaths)
179
+ local _callback_1 = function(_param)
180
+ local str = _param[2]
181
+ return str
182
+ end
183
+ for _k, _v in sortedPaths do
184
+ _newValue_1[_k] = _callback_1(_v, _k - 1, sortedPaths)
185
+ end
186
+ -- ▲ ReadonlyArray.map ▲
187
+ _object[_left] = _newValue_1
188
+ return _object
161
189
  end
162
- local _object = {
163
- type = "command",
164
- title = mainData.name,
165
- }
166
- local _left = "others"
167
- -- ▼ ReadonlyArray.map ▼
168
- local _newValue_1 = table.create(#sortedPaths)
169
- local _callback_1 = function(_param)
170
- local str = _param[2]
171
- return str
190
+ end
191
+ function getCommandName(options, input)
192
+ if input == string.lower(options.name) then
193
+ return options.name
172
194
  end
173
- for _k, _v in sortedPaths do
174
- _newValue_1[_k] = _callback_1(_v, _k - 1, sortedPaths)
195
+ for _, alias in options.aliases or {} do
196
+ if input == string.lower(alias) then
197
+ return alias
198
+ end
175
199
  end
176
- -- ▲ ReadonlyArray.map ▲
177
- _object[_left] = _newValue_1
178
- _object.description = mainData.description
179
- _object.shortcuts = mainData.shortcuts
180
- return _object
200
+ return input
181
201
  end
182
202
  return {
183
203
  getArgumentSuggestion = getArgumentSuggestion,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rbxts/centurion-ui",
3
3
  "description": "Terminal UI for the Centurion command framework",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "author": "paradoxuum",
6
6
  "license": "MIT",
7
7
  "main": "out/init.lua",