-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasename.cs
More file actions
24 lines (22 loc) · 883 Bytes
/
basename.cs
File metadata and controls
24 lines (22 loc) · 883 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
using System.IO;
using ILeoConsole;
using ILeoConsole.Plugin;
using ILeoConsole.Core;
namespace LeoConsole_ExamplePlugin {
public class Basename : ICommand {
public string Name { get { return "basename"; } }
public string Description { get { return "print name with any leading directory components removed"; } }
public Action CommandFunction { get { return () => Command(); } }
public Action HelpFunction { get { return () => Console.WriteLine("not available"); } }
private string[] _Arguments;
public string[] Arguments { get { return _Arguments; } set { _Arguments = value; } }
public void Command() {
if (_Arguments.Length < 2) {
Console.WriteLine("you need to provide an argument");
return;
}
Console.WriteLine(Path.GetFileName(_Arguments[1]));
}
}
}
// vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab