mirror of
https://github.com/lucaspalomodevelop/autom.git
synced 2026-03-12 23:27:21 +00:00
change makefile and cleanup code
This commit is contained in:
parent
ac141ec143
commit
cc5235838a
118
.vscode/settings.json
vendored
118
.vscode/settings.json
vendored
@ -1,53 +1,67 @@
|
|||||||
{
|
{
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.html": "html",
|
"*.html": "html",
|
||||||
"*.jsste": "plaintext",
|
"*.jsste": "plaintext",
|
||||||
"string": "cpp",
|
"string": "cpp",
|
||||||
"array": "cpp",
|
"array": "cpp",
|
||||||
"atomic": "cpp",
|
"atomic": "cpp",
|
||||||
"bit": "cpp",
|
"bit": "cpp",
|
||||||
"*.tcc": "cpp",
|
"*.tcc": "cpp",
|
||||||
"cctype": "cpp",
|
"cctype": "cpp",
|
||||||
"clocale": "cpp",
|
"clocale": "cpp",
|
||||||
"cmath": "cpp",
|
"cmath": "cpp",
|
||||||
"cstdarg": "cpp",
|
"cstdarg": "cpp",
|
||||||
"cstddef": "cpp",
|
"cstddef": "cpp",
|
||||||
"cstdint": "cpp",
|
"cstdint": "cpp",
|
||||||
"cstdio": "cpp",
|
"cstdio": "cpp",
|
||||||
"cstdlib": "cpp",
|
"cstdlib": "cpp",
|
||||||
"cstring": "cpp",
|
"cstring": "cpp",
|
||||||
"ctime": "cpp",
|
"ctime": "cpp",
|
||||||
"cwchar": "cpp",
|
"cwchar": "cpp",
|
||||||
"cwctype": "cpp",
|
"cwctype": "cpp",
|
||||||
"deque": "cpp",
|
"deque": "cpp",
|
||||||
"map": "cpp",
|
"map": "cpp",
|
||||||
"unordered_map": "cpp",
|
"unordered_map": "cpp",
|
||||||
"vector": "cpp",
|
"vector": "cpp",
|
||||||
"exception": "cpp",
|
"exception": "cpp",
|
||||||
"algorithm": "cpp",
|
"algorithm": "cpp",
|
||||||
"functional": "cpp",
|
"functional": "cpp",
|
||||||
"iterator": "cpp",
|
"iterator": "cpp",
|
||||||
"memory": "cpp",
|
"memory": "cpp",
|
||||||
"memory_resource": "cpp",
|
"memory_resource": "cpp",
|
||||||
"numeric": "cpp",
|
"numeric": "cpp",
|
||||||
"optional": "cpp",
|
"optional": "cpp",
|
||||||
"random": "cpp",
|
"random": "cpp",
|
||||||
"string_view": "cpp",
|
"string_view": "cpp",
|
||||||
"system_error": "cpp",
|
"system_error": "cpp",
|
||||||
"tuple": "cpp",
|
"tuple": "cpp",
|
||||||
"type_traits": "cpp",
|
"type_traits": "cpp",
|
||||||
"utility": "cpp",
|
"utility": "cpp",
|
||||||
"fstream": "cpp",
|
"fstream": "cpp",
|
||||||
"initializer_list": "cpp",
|
"initializer_list": "cpp",
|
||||||
"iosfwd": "cpp",
|
"iosfwd": "cpp",
|
||||||
"iostream": "cpp",
|
"iostream": "cpp",
|
||||||
"istream": "cpp",
|
"istream": "cpp",
|
||||||
"limits": "cpp",
|
"limits": "cpp",
|
||||||
"new": "cpp",
|
"new": "cpp",
|
||||||
"ostream": "cpp",
|
"ostream": "cpp",
|
||||||
"sstream": "cpp",
|
"sstream": "cpp",
|
||||||
"stdexcept": "cpp",
|
"stdexcept": "cpp",
|
||||||
"streambuf": "cpp",
|
"streambuf": "cpp",
|
||||||
"typeinfo": "cpp"
|
"typeinfo": "cpp",
|
||||||
}
|
"compare": "cpp",
|
||||||
}
|
"concepts": "cpp",
|
||||||
|
"ios": "cpp",
|
||||||
|
"xfacet": "cpp",
|
||||||
|
"xiosbase": "cpp",
|
||||||
|
"xlocale": "cpp",
|
||||||
|
"xlocinfo": "cpp",
|
||||||
|
"xlocnum": "cpp",
|
||||||
|
"xmemory": "cpp",
|
||||||
|
"xstddef": "cpp",
|
||||||
|
"xstring": "cpp",
|
||||||
|
"xtr1common": "cpp",
|
||||||
|
"xtree": "cpp",
|
||||||
|
"xutility": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
16
makefile
16
makefile
@ -1,5 +1,11 @@
|
|||||||
all:
|
CC = g++
|
||||||
g++ -c ./src/main.cpp
|
CFLAGS = -std=c++11 -Wall
|
||||||
g++ -c ./src/command.cpp
|
SRCDIR = ./src
|
||||||
g++ -std=c++11 main.o command.o -o ./bin/autom
|
BINDIR = ./bin
|
||||||
./bin/autom help
|
|
||||||
|
$(BINDIR)/main: $(SRCDIR)/main.cpp $(SRCDIR)/command.cpp $(SRCDIR)/inputparser.cpp
|
||||||
|
$(CC) $(CFLAGS) $^ -o $@
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f $(BINDIR)/autom
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
Command::Command() {}
|
Command::Command() {}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
class Command
|
class Command
|
||||||
{
|
{
|
||||||
|
|||||||
38
src/inputparser.cpp
Normal file
38
src/inputparser.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "./inputparser.h"
|
||||||
|
|
||||||
|
InputParser::InputParser(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
for (int i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
std::string arg(argv[i]);
|
||||||
|
if (arg.find("-") == 0)
|
||||||
|
{
|
||||||
|
std::string key = arg.substr(1);
|
||||||
|
if (i + 1 < argc)
|
||||||
|
{
|
||||||
|
std::string value(argv[i + 1]);
|
||||||
|
if (value.find("-") != 0)
|
||||||
|
{
|
||||||
|
args[key] = value;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args[key] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args[key] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string InputParser::getValue(std::string key)
|
||||||
|
{
|
||||||
|
return args[key];
|
||||||
|
}
|
||||||
|
bool InputParser::hasKey(std::string key)
|
||||||
|
{
|
||||||
|
return args.count(key) > 0;
|
||||||
|
}
|
||||||
@ -1,37 +1,20 @@
|
|||||||
|
#ifndef INPUTPARSER_H
|
||||||
|
#define INPUTPARSER_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
class InputParser
|
class InputParser
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> args;
|
std::map<std::string, std::string> args;
|
||||||
public:
|
|
||||||
InputParser(int argc, char *argv[]) {
|
public:
|
||||||
for (int i = 1; i < argc; i++) {
|
InputParser(int argc, char *argv[]);
|
||||||
std::string arg(argv[i]);
|
std::string getValue(std::string key);
|
||||||
if (arg.find("-") == 0) {
|
bool hasKey(std::string key);
|
||||||
std::string key = arg.substr(1);
|
|
||||||
if (i + 1 < argc) {
|
|
||||||
std::string value(argv[i + 1]);
|
|
||||||
if (value.find("-") != 0) {
|
|
||||||
args[key] = value;
|
|
||||||
i++;
|
|
||||||
} else {
|
|
||||||
args[key] = "";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
args[key] = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::string getValue(std::string key) {
|
|
||||||
return args[key];
|
|
||||||
}
|
|
||||||
bool hasKey(std::string key) {
|
|
||||||
return args.count(key) > 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // INPUTPARSER_H
|
||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <direct.h>
|
|
||||||
_mkdir(dir.c_str());
|
_mkdir(dir.c_str());
|
||||||
#else
|
#else
|
||||||
mkdir(dir.c_str(), 0777);
|
mkdir(dir.c_str(), 0777);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user