Răsfoiți Sursa

Enable inline commands support

Add nuget support v1.0.0.1
Dalibor Votruba 6 ani în urmă
părinte
comite
a8bb789000

+ 27 - 0
QConsole/QConsole.DevBench/Command/Test2Cmd.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Quadarax.Foundation.QConsole.Attributes;
+using Quadarax.Foundation.QConsole.Command;
+using Quadarax.Foundation.QConsole.Command.Base;
+
+namespace Quadarax.Foundation.QConsole.DevBench.Command
+{
+    [CommandDefinition]
+    public class Test2Cmd : AbstractCommand
+    {
+        public Test2Cmd(Engine engine) : base(engine)
+        {
+        }
+
+        public override string Name => "TEST2";
+        public override string Description => "This is a test no 2.";
+        protected override Result OnExecute()
+        {
+            WriteDebugInfo("Executed Test2 command");
+            return new Result();
+        }
+    }
+}

+ 3 - 0
QConsole/QConsole.DevBench/Program.cs

@@ -18,6 +18,9 @@ namespace Quadarax.Foundation.QConsole.DevBench
 
             var console = new Engine(config, args);
             console.Start();
+
+            Console.WriteLine("Press any key to exit (external wait)...");
+            Console.ReadKey();
         }
 
 

+ 1 - 0
QConsole/QConsole.DevBench/QConsole.DevBench.csproj

@@ -44,6 +44,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Command\Entry.cs" />
+    <Compile Include="Command\Test2Cmd.cs" />
     <Compile Include="Command\TestCmd.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 16 - 3
QConsole/QConsole/Engine.cs

@@ -3,7 +3,6 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
 using Quadarax.Foundation.QConsole.Attributes;
-using Quadarax.Foundation.QConsole.Command;
 using Quadarax.Foundation.QConsole.Command.Base;
 using Quadarax.Foundation.QConsole.Configuration;
 
@@ -61,12 +60,26 @@ namespace Quadarax.Foundation.QConsole
         public void Start()
         {
             WriteDebugInfo("Console starting.");
+            var commandLineArguments = string.Join(" ", RawArguments);
+
             using (var writer = new ConsoleWriter(ConsoleColor.White))
             {
                 while (!_isExitSignal)
                 {
-                    writer.Write(_configuration.CharacterLineIntroduce);
-                    var input = Console.ReadLine();
+                    var input = string.Empty;
+                    if (commandLineArguments.Length == 0)
+                    {
+                        // interactive command entry
+                        writer.Write(_configuration.CharacterLineIntroduce);
+                        input = Console.ReadLine();
+                    }
+                    else
+                    {
+                        // inline command entry
+                        input = commandLineArguments;
+                        _isExitSignal = true;
+                    }
+
                     var args = input.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries);
                     if (args.Length == 0)
                         continue;

+ 2 - 2
QConsole/QConsole/Properties/AssemblyInfo.cs

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.0.0.1")]
+[assembly: AssemblyFileVersion("1.0.0.1")]

+ 26 - 0
QConsole/QConsole/QDR.FND.QConsole.nuspec

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<package>
+  <metadata>
+    <id>Quadarax.Foundation.QConsole</id>
+    <version>1.0.0.1</version>
+    <title>Quadarax.Foundation.QConsole</title>
+    <authors>Dalibor Votruba, Quadarax</authors>
+    <owners>Dalibor Votruba</owners>
+    <projectUrl>https://project.quadarax.com/</projectUrl>
+    <iconUrl>https://project.quadarax.com/logo.png</iconUrl>
+    <requireLicenseAcceptance>false</requireLicenseAcceptance>
+    <description>Implementation base for console applications with commands, lists, selections and easy command handlings.</description>
+    <releaseNotes>Initial 1.0.0.0 release</releaseNotes>
+    <copyright>Copyright (c) 2018 Quadarax</copyright>
+    <tags>quadarax, foundarion, qconsole, qdr, fnd, library, console</tags>
+    <dependencies>
+         </dependencies>
+    <summary>Libraries</summary>
+  </metadata>
+  <files>
+    <file src="ReleaseNote.txt" />
+    <file src="bin\Release\QDR.FND.QConsole.dll" target="lib\net472\QDR.FND.QConsole.dll" />
+	<file src="bin\Release\QDR.FND.QConsole.pdb" target="lib\net472\QDR.FND.QConsole.pdb" />
+	<file src="bin\Release\QDR.FND.QConsole.dll.config" target="lib\net472\QDR.FND.QConsole.dll.config" />
+  </files>
+</package>

+ 17 - 0
QConsole/QConsole/create_package.ps1

@@ -0,0 +1,17 @@
+# Generate Nuget package from this folder (find *.nuspec files at this level)
+
+
+# Set up initial variables, paths, constants
+Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted
+Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
+$nuget = "$env:LOCALAPPDATA\Nuget\Nuget.exe"
+$current = (Get-Location).Path
+Set-Alias nuget $nuget
+
+$nuspecFiles = Get-ChildItem -Path $current | Where-Object {
+    $_.FullName -like "*.nuspec"} | Select-Object
+	
+foreach($file in $nuspecFiles){
+    nuget pack $file.FullName
+	Write-Host ("Generated nuget package from {0}" -f $file.FullName) -ForegroundColor White
+}