@@ -149,7 +149,9 @@ internal static Command Create(DevConsoleCommandAttribute commandAttribute, Meth
149149
150150 #region Constructors
151151
152- private Command ( ) { }
152+ private Command ( )
153+ {
154+ }
153155
154156 #endregion
155157
@@ -158,17 +160,22 @@ private Command() { }
158160 /// <summary>
159161 /// Name of the command.
160162 /// </summary>
161- internal string Name { get ; private set ; }
163+ public string Name { get ; private set ; }
162164
163165 /// <summary>
164- /// Optional command names .
166+ /// Description of the command .
165167 /// </summary>
166- internal string [ ] Aliases { get ; private set ; }
168+ public string HelpText { get ; private set ; }
167169
168170 /// <summary>
169- /// Description of the command.
171+ /// Whether the command is a custom command (not a built-in command) .
170172 /// </summary>
171- internal string HelpText { get ; private set ; }
173+ public bool IsCustomCommand { get ; private set ; }
174+
175+ /// <summary>
176+ /// Optional command names.
177+ /// </summary>
178+ internal string [ ] Aliases { get ; private set ; }
172179
173180 /// <summary>
174181 /// Array of parameters required to execute the command.
@@ -186,11 +193,6 @@ private Command() { }
186193 /// </summary>
187194 internal Action DefaultCallback { get ; private set ; }
188195
189- /// <summary>
190- /// Whether the command is a custom command.
191- /// </summary>
192- internal bool IsCustomCommand { get ; private set ; }
193-
194196 #endregion
195197
196198 #region Methods
@@ -200,6 +202,62 @@ public override string ToString()
200202 return Name ;
201203 }
202204
205+ /// <summary>
206+ /// Get the command syntax as a formatted string.
207+ /// </summary>
208+ /// <returns></returns>
209+ public string ToFormattedString ( )
210+ {
211+ string result = GetFormattedName ( ) ;
212+ for ( int i = 0 ; i < Parameters . Length ; i ++ )
213+ {
214+ if ( i < Parameters . Length )
215+ {
216+ result += " " ;
217+ }
218+
219+ result += GetFormattedParameter ( i ) ;
220+ }
221+ return result ;
222+ }
223+
224+ /// <summary>
225+ /// Get the command name as a formatted string.
226+ /// </summary>
227+ /// <returns></returns>
228+ public string GetFormattedName ( )
229+ {
230+ return $ "<b>{ Name } </b>";
231+ }
232+
233+ /// <summary>
234+ /// Get a parameter as a formatted string.
235+ /// </summary>
236+ /// <param name="parameterIndex"></param>
237+ /// <returns></returns>
238+ public string GetFormattedParameter ( int parameterIndex )
239+ {
240+ return Parameters [ parameterIndex ] . ToFormattedString ( ) ;
241+ }
242+
243+ /// <summary>
244+ /// Get the command aliases.
245+ /// </summary>
246+ /// <returns></returns>
247+ public IReadOnlyList < string > GetAliases ( )
248+ {
249+ return Aliases ;
250+ }
251+
252+ /// <summary>
253+ /// Get the command parameters.
254+ /// </summary>
255+ /// <returns></returns>
256+ public IReadOnlyList < Parameter > GetParameters ( )
257+ {
258+ return Parameters ;
259+ }
260+
203261 /// <summary>
204262 /// Ensure the command name is valid.
205263 /// </summary>
@@ -247,44 +305,6 @@ internal void SetAsCustomCommand()
247305 IsCustomCommand = true ;
248306 }
249307
250- /// <summary>
251- /// Get the command name as a formatted string.
252- /// </summary>
253- /// <returns></returns>
254- internal string GetFormattedName ( )
255- {
256- return $ "<b>{ Name } </b>";
257- }
258-
259- /// <summary>
260- /// Get a parameter as a formatted string.
261- /// </summary>
262- /// <param name="parameterIndex"></param>
263- /// <returns></returns>
264- internal string GetFormattedParameter ( int parameterIndex )
265- {
266- return Parameters [ parameterIndex ] . ToFormattedString ( ) ;
267- }
268-
269- /// <summary>
270- /// Get the command syntax as a formatted string.
271- /// </summary>
272- /// <returns></returns>
273- internal string ToFormattedString ( )
274- {
275- string result = GetFormattedName ( ) ;
276- for ( int i = 0 ; i < Parameters . Length ; i ++ )
277- {
278- if ( i < Parameters . Length )
279- {
280- result += " " ;
281- }
282-
283- result += GetFormattedParameter ( i ) ;
284- }
285- return result ;
286- }
287-
288308 #endregion
289309 }
290310}
0 commit comments