first commit

This commit is contained in:
lucaspalomodevelop 2023-03-07 20:20:01 +01:00
parent 7d551a77c2
commit f5e5eb9098
7 changed files with 739 additions and 707 deletions

View File

@ -1 +1,5 @@
# autom # autom
__IN DEVELOPMENT, NOT READY FOR USE__
autom is a command line tool for executing shell scripts, independent of the working directory

3
makefile Normal file
View File

@ -0,0 +1,3 @@
all:
g++ -std=c++11 ./src/main.cpp -o ./src/autom
./src/autom test

BIN
src/autom Normal file

Binary file not shown.

BIN
src/main Normal file

Binary file not shown.

25
src/main.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <iostream>
#include <string>
#include <sys/stat.h>
int main(int argc, char *argv[])
{
// make dir in /etc/autom
std::string home = getenv("HOME");
std::string dir = home + "/.autom";
// std::cout << "dir: " << dir << std::endl;
mkdir(dir.c_str(), 0777);
if (argc > 1 && argv[1][0] != '-')
{
std::string pre_script = "cd " + dir + " && ";
std::string script = pre_script + dir + "/" + argv[1] + ".sh";
system(script.c_str());
}
// else{
// std::cout << "Usage: autom <script>" << std::endl;
// }
return 0;
}