forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsingsCommand.cs
More file actions
30 lines (24 loc) · 816 Bytes
/
UsingsCommand.cs
File metadata and controls
30 lines (24 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Linq;
using ScriptCs.Contracts;
namespace ScriptCs.ReplCommands
{
public class UsingsCommand : IReplCommand
{
public string Description
{
get { return "Displays a list of namespaces imported into REPL context."; }
}
public string CommandName
{
get { return "usings"; }
}
public object Execute(IRepl repl, object[] args)
{
Guard.AgainstNullArgument("repl", repl);
var namespaces = repl.Namespaces;
if (repl.ScriptPackSession == null || repl.ScriptPackSession.Namespaces == null || !repl.ScriptPackSession.Namespaces.Any())
return namespaces;
return namespaces.Union(repl.ScriptPackSession.Namespaces).OrderBy(x => x);
}
}
}