Skip to content

Commit

Permalink
cd added
Browse files Browse the repository at this point in the history
  • Loading branch information
SpGerg committed May 18, 2024
1 parent 9c06f3f commit 86559bc
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion PaganismCustomConsole/Commands/ChangeDirectoryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using PaganismCustomConsole.API.Features.Commands;
using System;
using System.Collections.Generic;
using System.IO;

namespace PaganismCustomConsole.Commands
{
Expand All @@ -17,9 +18,25 @@ public ChangeDirectoryCommand(CustomConsole customConsole) : base(customConsole)

public override string[] Aliases => new string[] { "cd" };

public override CommandParameter[] Parameters { get; } = new CommandParameter[]
{
new CommandParameter("path", "path", true)
};

public override bool Execute(Dictionary<string, string> arguments, out string response)
{
throw new NotImplementedException();
var path = arguments["path"];

if (!Directory.Exists(path))
{
response = $"Directory {path} doesnt exists";
return false;
}

CustomConsole.CurrentDirectory = arguments["path"];

response = string.Empty;
return true;
}
}
}

0 comments on commit 86559bc

Please sign in to comment.