-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·78 lines (70 loc) · 1.68 KB
/
main.cpp
File metadata and controls
executable file
·78 lines (70 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <string>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <filesystem>
#include "gitmanager.hpp"
#include "decorator.hpp"
// uncomment to show message of debug leevl
// #define DEBUG_OUT
int main(int argc, char *argv[])
{
#ifdef __linux__
/*objects*/
GitManager git;
decorator doc;
if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "--help") == 0)
{
std::cout << "pusher_git <repo name>" << std::endl;
return 0;
}
if (argv[1] != 0)
{
GitManager::REPO_DEFUALT = std::string(argv[1]);
}
if (git.CheckExistance() != true)
{
doc.DisplaySpliiter("Error");
return 0;
}
/*start*/
doc.DisplaySpliiter("Start");
std::cout << "[+] this status before running our script" << std::endl;
git.status();
/* add */
doc.DisplaySpliiter("add phase");
if (git.add() == 0)
{
std::cout << "[+] added is done successfully" << std::endl;
}
else
{
std::cout << "[X] added is failed " << std::endl;
return -1;
}
/* commit */
doc.DisplaySpliiter("commit phase");
if (git.commit() == 0)
{
std::cout << "[+] commit is done successfully" << std::endl;
}
else
{
std::cout << "[X] commit is failed " << std::endl;
return -1;
}
/* push */
std::cout << "[+] this status after running our script" << std::endl;
git.status();
doc.DisplaySpliiter("push phase");
git.push();
#else
std::cout << " This program support Linux only " << std::endl;
#endif
#if DEBUG_OUT
// std::cout << argv[0] << std::endl;
// std::cout << argv[1] << std::endl;
#endif
return 0;
}