-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx_shell.hpp
76 lines (68 loc) · 1.91 KB
/
x_shell.hpp
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
//
// x_shell.hpp
// x
//
// Created by Daher Alfawares on 12/13/17.
// Copyright © 2017 Daher Alfawares. All rights reserved.
//
#ifndef x_shell_hpp
#define x_shell_hpp
#include <string>
#include <iostream>
#include <sstream>
namespace x {
namespace shell {
using std::string;
inline string remove(string file){
std::stringstream command;
command
<< "rm "
<< "-f "
<< "-r "
<< "-v "
<< "\"" << file << "\" ";
return command.str();
}
inline string mkdir(string dir){
std::stringstream command;
command
<< "mkdir "
<< "\"" << dir << "\" ";
return command.str();
}
inline string copy(string src, string dst){
std::stringstream command;
command
<< "cp " // copy
<< "-f " // force
<< "-r " // recursive
<< "-v " // verbose
<< "\"" << src << "\" "
<< "\"" << dst << "\" ";
// std::cout << command.str() << std::endl;
return command.str();
}
inline string diff(string src, string dst){
std::stringstream command;
command
<< "diff " // diff
<< "-q " // quiet
<< "\"" << src << "\" "
<< "\"" << dst << "\" ";
// std::cout << command.str() << std::endl;
return command.str();
}
inline string move(string src, string dst){
std::stringstream command;
command
<< "mv "
<< "-f "
<< "-v "
<< "\"" << src << "\" "
<< "\"" << dst << "\" ";
return command.str();
// std::cout << command.str() << std::endl;
}
}
}
#endif /* x_shell_hpp */