--- a/CLI.h Thu Aug 09 22:58:38 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#pragma once
-
-#include <locale.h>
-#include <string>
-#include <vector>
-#include <sstream>
-#include <locale>
-#include <codecvt>
-
-using namespace std;
-
-namespace relpipe {
-namespace cli {
-
-/**
- * TODO: move to relpipe-lib-cli (a common header-only library)
- */
-class CLI {
-public:
-
- CLI(int argc, char* argv[]) {
- setlocale(LC_ALL, "");
-
- this->argc = &argc;
- this->argv = &argv;
-
- program = convertor.from_bytes(argv[0]);
-
- for (int i = 1; i < argc; i++) {
- args.insert(args.end(), convertor.from_bytes(argv[i]));
- }
-
- }
-
- CLI(const CLI& orig) {
- }
-
- virtual ~CLI() {
- }
-
- const wstring programName() {
- return (const wstring) program;
- }
-
- const vector<wstring> arguments() {
- return (const vector<wstring>)args;
- }
-
- static const int EXIT_CODE_SUCCESS = 0;
- static const int EXIT_CODE_UNEXPECTED_ERROR = 1;
- static const int EXIT_CODE_BAD_SYNTAX = 3;
- static const int EXIT_CODE_UNKNOWN_COMMAND = 4;
- static const int EXIT_CODE_DATA_ERROR = 5;
-
-private:
- int* argc;
- char*** argv;
- wstring program;
- vector<wstring> args;
- wstring_convert<codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings.
-};
-
-}
-}
--- a/RelpipeCLIException.h Thu Aug 09 22:58:38 2018 +0200
+++ b/RelpipeCLIException.h Sun Aug 12 12:56:18 2018 +0200
@@ -2,7 +2,7 @@
#include <string>
-#include "CLI.h"
+#include <relpipe/cli/CLI.h>
using namespace std;
--- a/StdInCommand.h Thu Aug 09 22:58:38 2018 +0200
+++ b/StdInCommand.h Sun Aug 12 12:56:18 2018 +0200
@@ -10,8 +10,9 @@
#include <typedefs.h>
#include <locale>
+#include <relpipe/cli/CLI.h>
+
#include "Command.h"
-#include "CLI.h"
#include "RelpipeCLIException.h"
namespace relpipe {
--- a/nbproject/Makefile-Debug.mk Thu Aug 09 22:58:38 2018 +0200
+++ b/nbproject/Makefile-Debug.mk Sun Aug 12 12:56:18 2018 +0200
@@ -52,7 +52,7 @@
ASFLAGS=
# Link Libraries and Options
-LDLIBSOPTIONS=`pkg-config --libs relpipe-lib-writer.cpp`
+LDLIBSOPTIONS=`pkg-config --libs relpipe-lib-writer.cpp` `pkg-config --libs relpipe-lib-cli.cpp`
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
@@ -65,7 +65,7 @@
${OBJECTDIR}/relpipe-in-cli.o: relpipe-in-cli.cpp
${MKDIR} -p ${OBJECTDIR}
${RM} "$@.d"
- $(COMPILE.cc) -g `pkg-config --cflags relpipe-lib-writer.cpp` -std=c++14 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/relpipe-in-cli.o relpipe-in-cli.cpp
+ $(COMPILE.cc) -g `pkg-config --cflags relpipe-lib-writer.cpp` `pkg-config --cflags relpipe-lib-cli.cpp` -std=c++14 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/relpipe-in-cli.o relpipe-in-cli.cpp
# Subprojects
.build-subprojects:
--- a/nbproject/Makefile-Release.mk Thu Aug 09 22:58:38 2018 +0200
+++ b/nbproject/Makefile-Release.mk Sun Aug 12 12:56:18 2018 +0200
@@ -52,7 +52,7 @@
ASFLAGS=
# Link Libraries and Options
-LDLIBSOPTIONS=`pkg-config --libs relpipe-lib-writer.cpp`
+LDLIBSOPTIONS=`pkg-config --libs relpipe-lib-writer.cpp` `pkg-config --libs relpipe-lib-cli.cpp`
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
@@ -65,7 +65,7 @@
${OBJECTDIR}/relpipe-in-cli.o: relpipe-in-cli.cpp
${MKDIR} -p ${OBJECTDIR}
${RM} "$@.d"
- $(COMPILE.cc) -O2 `pkg-config --cflags relpipe-lib-writer.cpp` -std=c++14 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/relpipe-in-cli.o relpipe-in-cli.cpp
+ $(COMPILE.cc) -O2 `pkg-config --cflags relpipe-lib-writer.cpp` `pkg-config --cflags relpipe-lib-cli.cpp` -std=c++14 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/relpipe-in-cli.o relpipe-in-cli.cpp
# Subprojects
.build-subprojects:
--- a/nbproject/configurations.xml Thu Aug 09 22:58:38 2018 +0200
+++ b/nbproject/configurations.xml Sun Aug 12 12:56:18 2018 +0200
@@ -5,7 +5,6 @@
displayName="Header Files"
projectFiles="true">
<itemPath>ArgumentsCommand.h</itemPath>
- <itemPath>CLI.h</itemPath>
<itemPath>Command.h</itemPath>
<itemPath>DemoCommand.h</itemPath>
<itemPath>RelpipeCLIException.h</itemPath>
@@ -54,13 +53,12 @@
<linkerTool>
<linkerLibItems>
<linkerOptionItem>`pkg-config --libs relpipe-lib-writer.cpp`</linkerOptionItem>
+ <linkerOptionItem>`pkg-config --libs relpipe-lib-cli.cpp`</linkerOptionItem>
</linkerLibItems>
</linkerTool>
</compileType>
<item path="ArgumentsCommand.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="CLI.h" ex="false" tool="3" flavor2="0">
- </item>
<item path="Command.h" ex="false" tool="3" flavor2="0">
</item>
<item path="DemoCommand.h" ex="false" tool="3" flavor2="0">
@@ -95,13 +93,12 @@
<linkerTool>
<linkerLibItems>
<linkerOptionItem>`pkg-config --libs relpipe-lib-writer.cpp`</linkerOptionItem>
+ <linkerOptionItem>`pkg-config --libs relpipe-lib-cli.cpp`</linkerOptionItem>
</linkerLibItems>
</linkerTool>
</compileType>
<item path="ArgumentsCommand.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="CLI.h" ex="false" tool="3" flavor2="0">
- </item>
<item path="Command.h" ex="false" tool="3" flavor2="0">
</item>
<item path="DemoCommand.h" ex="false" tool="3" flavor2="0">
--- a/relpipe-in-cli.cpp Thu Aug 09 22:58:38 2018 +0200
+++ b/relpipe-in-cli.cpp Sun Aug 12 12:56:18 2018 +0200
@@ -6,7 +6,8 @@
#include <Factory.h>
#include <TypeId.h>
-#include "CLI.h"
+#include <relpipe/cli/CLI.h>
+
#include "RelpipeCLIException.h"
#include "Command.h"
#include "ArgumentsCommand.h"