aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vars.hh1
-rw-r--r--src/cla_parse.cc2
-rw-r--r--src/create_pkg.cc6
-rw-r--r--src/install_pkg.cc8
4 files changed, 10 insertions, 7 deletions
diff --git a/include/vars.hh b/include/vars.hh
index 8c82155..1d516ea 100644
--- a/include/vars.hh
+++ b/include/vars.hh
@@ -18,6 +18,7 @@ struct Pkg {
const char* target;
std::string ver;
std::filesystem::path src;
+ bool is_local;
};
extern const std::string home_dir;
diff --git a/src/cla_parse.cc b/src/cla_parse.cc
index 24b572f..76500fd 100644
--- a/src/cla_parse.cc
+++ b/src/cla_parse.cc
@@ -21,7 +21,7 @@
code
#define NOT_ENOUGH_ARGS(arg, next) \
std::cout << print_error << "Not enough arguments! Try: `pkgit " << arg \
- << " [" << next << "]`"
+ << " [" << next << "]`" << std::endl
void cla_parse(int argc, char **argv) {
Pkg pkg;
diff --git a/src/create_pkg.cc b/src/create_pkg.cc
index 58e077f..4208208 100644
--- a/src/create_pkg.cc
+++ b/src/create_pkg.cc
@@ -11,8 +11,8 @@ Pkg create_pkg(std::string arg, const char* target) {
Pkg pkg;
pkg.target = target;
pkg.ver = "HEAD";
+ pkg.is_local = false;
bool is_in_repos = false;
- bool is_local = false;
init_lua_state();
cache_repos();
@@ -27,7 +27,7 @@ Pkg create_pkg(std::string arg, const char* target) {
pkg.url = "";
pkg.src = std::filesystem::current_path().string();
pkg.name = name_from_url(std::filesystem::current_path().string());
- is_local = true;
+ pkg.is_local = true;
} else if (is_in_repos) {
pkg.url = cached_repos[arg].source.value;
pkg.name = arg;
@@ -37,7 +37,7 @@ Pkg create_pkg(std::string arg, const char* target) {
}
cache_install_directories();
- if (!is_local) {
+ if (!pkg.is_local) {
pkg.src = install_directories["src"] + "/" + pkg.name + "/" + pkg.ver;
}
diff --git a/src/install_pkg.cc b/src/install_pkg.cc
index 0753606..208c397 100644
--- a/src/install_pkg.cc
+++ b/src/install_pkg.cc
@@ -11,9 +11,11 @@
#include "vars.hh"
void install_pkg(Pkg pkg) {
- std::cout << print_pkgit << "fetching source..." << std::endl;
- fetch_src(pkg);
- std::cout << print_pkgit << "source fetched!" << std::endl;
+ if (!pkg.is_local) {
+ std::cout << print_pkgit << "fetching source..." << std::endl;
+ fetch_src(pkg);
+ std::cout << print_pkgit << "source fetched!" << std::endl;
+ }
std::cout << print_pkgit << "building..." << std::endl;
build(pkg);