update readme

This commit is contained in:
vrd
2024-05-27 16:53:27 +03:00
parent 861a0bd1e4
commit 9c86301953
2 changed files with 14 additions and 20 deletions
+7 -13
View File
@@ -1,27 +1,21 @@
cppipe - C Plus Pipe cppipe - C Plus Pipe
==================== ====================
cppipe is a utility that allows you to use C++ programs as scripts. cppipe is a utility that allows you to use C/C++ programs as scripts.
it also offers a shell like syntax for seamless command execution it also offers a shell like syntax for seamless command execution
In this way your scripts can benefit from increased control and speed, while In this way your scripts can benefit from increased control and speed, while
maintaining a lot of the potential for simple command call syntax. maintaining a lot of the potential for simple command call syntax.
Webpage
-------
https://vene.volconst.com/en/cppipe
Installation Installation
------------ ------------
git clone https://gitlab.com/venelin98/cppipe.git git clone https://gitlab.com/venelin98/cppipe.git
cd cppipe cd cppipe
sudo ./install.sh sudo ./install.sh
How to write a cppipe program How to execute a C/C++ source file
----------------------------- ----------------------------------
Just include <cppipe/commands.hpp> cppipe PATH_TO_SRC [ARGUMENTS_FOR_YOUR_PROGRAM]...
How to execute a cppipe program
-------------------------------
cppipe my_cppipe_program.cpp ${ANY_ARGUMENTS_FOR_YOUR_PROGRAM}
Webpage
-------
https://vene.volconst.com/en/cppipe
+7 -7
View File
@@ -36,8 +36,8 @@ struct MappedFile // todo: move to utils
// process the args until the src file arg is found, return its index // process the args until the src file arg is found, return its index
int parse_args_until_src(int argc, char* argv[]); int parse_args_until_src(int argc, char* argv[]);
// find the cpp to run, if it doesn't exist, exit program // find the source file to run, if it doesn't exist, exit program
fs::path find_path_to_cpp(string_view src_file); fs::path find_path_to_src(string_view src_file);
// find the path of the cache for the given src_file path // find the path of the cache for the given src_file path
fs::path get_cache_dir_path(const fs::path& src_file); fs::path get_cache_dir_path(const fs::path& src_file);
@@ -72,7 +72,7 @@ int main(int argc, char* argv[])
int src_arg = parse_args_until_src(argc, argv); int src_arg = parse_args_until_src(argc, argv);
// Init context // Init context
src_file = find_path_to_cpp( argv[src_arg] ); src_file = find_path_to_src( argv[src_arg] );
src_type = find_src_type( argv[src_arg] ); src_type = find_src_type( argv[src_arg] );
cache_dir = get_cache_dir_path(src_file); cache_dir = get_cache_dir_path(src_file);
bin = cache_dir / (debug ? DEBUG_PREFIX : "") += src_file.filename(); bin = cache_dir / (debug ? DEBUG_PREFIX : "") += src_file.filename();
@@ -112,7 +112,7 @@ int parse_args_until_src(int argc, char* argv[])
if( arg == "--help" ) if( arg == "--help" )
{ {
print_usage(); print_usage();
cout << "Compile and run C++ source CPP_FILE that uses the cppipe library.\n" cout << "Compile and run C/C++ source FILE.\n"
"Pass the ARGUMENTS to the compiled binary.\n" "Pass the ARGUMENTS to the compiled binary.\n"
"The binaries are cached and recompiled only if the source or it's headers have changed.\n" "The binaries are cached and recompiled only if the source or it's headers have changed.\n"
"-g debug the binary, asserts are also enabled\n"; "-g debug the binary, asserts are also enabled\n";
@@ -139,7 +139,7 @@ int parse_args_until_src(int argc, char* argv[])
return src_arg; return src_arg;
} }
fs::path find_path_to_cpp(string_view src_file) fs::path find_path_to_src(string_view src_file)
{ {
if(fs::exists(src_file)) // found relative to CWD if(fs::exists(src_file)) // found relative to CWD
{ {
@@ -172,7 +172,7 @@ fs::path find_path_to_cpp(string_view src_file)
} }
} }
// Couln't find the cpp // Couln't find the src
cerr << "File: " << src_file << " doesn't exist\n"; cerr << "File: " << src_file << " doesn't exist\n";
exit(1); exit(1);
} }
@@ -315,7 +315,7 @@ void compile_src_file()
void print_usage() void print_usage()
{ {
cout << "Usage: cppipe [-g] CPP_FILE [ARGUMENTS]...\n"; cout << "Usage: cppipe [-g] FILE [ARGUMENTS]...\n";
} }
SrcType find_src_type(const string_view p) SrcType find_src_type(const string_view p)