Skip to content

Commit

Permalink
update for the new API
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcoder04 committed Jul 9, 2022
1 parent 908ba71 commit 43704ce
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bin
Debug
obj
*.lcpkg
*.lcp
11 changes: 6 additions & 5 deletions basename.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ 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 CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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 (_InputProperties.Length < 2) {
if (_Arguments.Length < 2) {
Console.WriteLine("you need to provide an argument");
return;
}
Console.WriteLine(Path.GetFileName(_InputProperties[1]));
Console.WriteLine(Path.GetFileName(_Arguments[1]));
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions cat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ namespace LeoConsole_ExamplePlugin {
public class Cat : ICommand {
public string Name { get { return "cat"; } }
public string Description { get { return "print contents of a file"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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 (_InputProperties.Length < 2) {
if (_Arguments.Length < 2) {
Console.WriteLine("you need to provide an argument");
return;
}
try {
Console.WriteLine(File.ReadAllText(_InputProperties[1]));
Console.WriteLine(File.ReadAllText(_Arguments[1]));
} catch (Exception e) {
Console.WriteLine("error: " + e.Message);
}
Expand Down
7 changes: 4 additions & 3 deletions clear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ namespace LeoConsole_ExamplePlugin {
public class Clear : ICommand {
public string Name { get { return "clear"; } }
public string Description { get { return "clear the screen"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
Console.Clear();
}
Expand Down
7 changes: 4 additions & 3 deletions date.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ namespace LeoConsole_ExamplePlugin {
public class Date : ICommand {
public string Name { get { return "date"; } }
public string Description { get { return "print current date and time"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
Console.WriteLine(DateTime.Now.ToString());
Expand Down
11 changes: 6 additions & 5 deletions echo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ namespace LeoConsole_ExamplePlugin {
public class Echo : ICommand {
public string Name { get { return "echo"; } }
public string Description { get { return "print the given parameters to the screen"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
for (int i = 1; i < _InputProperties.Length; i++) {
Console.Write(InputProperties[i] + " ");
for (int i = 1; i < _Arguments.Length; i++) {
Console.Write(Arguments[i] + " ");
}
Console.Write("\n");
}
Expand Down
7 changes: 4 additions & 3 deletions hostname.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ namespace LeoConsole_ExamplePlugin {
public class Hostname : ICommand {
public string Name { get { return "hostname"; } }
public string Description { get { return "print computer's hostname"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
Console.WriteLine(Dns.GetHostName());
Expand Down
6 changes: 4 additions & 2 deletions manifest.apkg.json → manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"manifestVersion": 2.1,
"manifestVersion": 3.0,
"packageName": "coreutils",
"packageVersion": "0.2.0",
"packageVersion": "0.3.0",
"depends": [],
"compatibleVersions": ["2.0.0"],
"build": {
"command": "dotnet",
"args": ["build", "--nologo"],
Expand Down
7 changes: 4 additions & 3 deletions printenv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ namespace LeoConsole_ExamplePlugin {
public class Printenv : ICommand {
public string Name { get { return "printenv"; } }
public string Description { get { return "print the environment"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
foreach (DictionaryEntry de in Environment.GetEnvironmentVariables()) {
Console.WriteLine("{0}={1}", de.Key, de.Value);
Expand Down
11 changes: 6 additions & 5 deletions sleep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ namespace LeoConsole_ExamplePlugin {
public class Sleep : ICommand {
public string Name { get { return "sleep"; } }
public string Description { get { return "do nothing for given number of seconds"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
int dur;
if (_InputProperties.Length < 2) {
if (_Arguments.Length < 2) {
dur = 1;
} else {
try {
dur = Int32.Parse(_InputProperties[1]);
dur = Int32.Parse(_Arguments[1]);
} catch (Exception e) {
Console.WriteLine("invalid number provided");
return;
Expand Down
11 changes: 6 additions & 5 deletions yes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ namespace LeoConsole_ExamplePlugin {
public class Yes : ICommand {
public string Name { get { return "yes"; } }
public string Description { get { return "output a string repeatedly until killed"; } }
public Action CommandFunktion { get { return () => Command(); } }
private string[] _InputProperties;
public string[] InputProperties { get { return _InputProperties; } set { _InputProperties = value; } }
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() {
string str;
if (_InputProperties.Length < 2) {
if (_Arguments.Length < 2) {
str = "y";
} else {
str = _InputProperties[1];
str = _Arguments[1];
}
while (true) {
Console.WriteLine(str);
Expand Down

0 comments on commit 43704ce

Please sign in to comment.