mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 02:27:08 +02:00
* Saving work * Move shit to engine * lord * merg * awa * bql is kill * forgot the fucking bike rack * bql is kill for real * pjb will kill me * aughfhbdj * yo ho here we go on my way to the MINES * a * adgddf * gdsgvfvxshngfgh * b * hfsjhghj * hbfdjjh * tf you mean i have to document it * follow C# standards * Assorted cleanup and documentation pass, minor bugfix in ValueRefParser. * Start porting old commands, remove that pesky prefix in favor of integrating with the shell. * Fix valueref up a bit, improve autocomplete for it. * e * Toolshed type system adventure. * a log * a * a e i o u * awa * fix tests * Arithmetic commands. * a * parse improvements --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Network;
|
|
|
|
namespace Robust.Shared.ViewVariables.Commands;
|
|
|
|
public abstract class ViewVariablesBaseCommand : LocalizedCommands
|
|
{
|
|
[Dependency] protected readonly INetManager _netMan = default!;
|
|
[Dependency] protected readonly IViewVariablesManager _vvm = default!;
|
|
|
|
public override async ValueTask<CompletionResult> GetCompletionAsync(IConsoleShell shell, string[] args, string argStr, CancellationToken cancel)
|
|
{
|
|
if (args.Length is 0 or > 1)
|
|
return CompletionResult.Empty;
|
|
|
|
var path = args[0];
|
|
|
|
if(_netMan.IsClient)
|
|
{
|
|
if(path.StartsWith("/c"))
|
|
return CompletionResult.FromOptions(
|
|
_vvm.ListPath(path[2..], new())
|
|
.Select(p => new CompletionOption($"/c{p}", null, CompletionOptionFlags.PartialCompletion)));
|
|
|
|
return CompletionResult.FromOptions((await _vvm.ListRemotePath(path, new()))
|
|
.Select(p => new CompletionOption(p, null, CompletionOptionFlags.PartialCompletion))
|
|
.Append(new CompletionOption("/c", "Client-side paths", CompletionOptionFlags.PartialCompletion)));
|
|
}
|
|
|
|
return CompletionResult.FromOptions(
|
|
_vvm.ListPath(path, new())
|
|
.Select(p => new CompletionOption(p, null, CompletionOptionFlags.PartialCompletion)));
|
|
}
|
|
}
|