Skip to content

Commit

Permalink
tests about -S options
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni500github committed Mar 7, 2024
1 parent f6aa268 commit 8c51110
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Operation_t {
std::vector<std::string> args;
};

extern struct Operation_t* operation;
extern struct Operation_t operation;

int parseargs(int argc, char* argv[]);
int parsearg_op(int opt);
Expand Down
23 changes: 12 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using std::string;
using std::cerr;

Config config;
struct Operation_t* operation;
struct Operation_t operation;

// Verifies the argument count and validity.
bool verify_arguments(int c, char** args) {
Expand Down Expand Up @@ -118,7 +118,7 @@ bool updateAll(TaurBackend *backend) {
int parsearg_op(int opt){
switch(opt){
case 'S':
operation->op = OP_SYNC; break;
operation.op = OP_SYNC; break;
case 'h':
usage(); break;
case 'V':
Expand Down Expand Up @@ -147,13 +147,14 @@ int parseargs(int argc, char* argv[]){
if(opt == 0) {
continue;
} else if(opt == '?') {
for (int i = 0; i < argc; i++){
operation->args.push_back(argv[i]);
cout << operation->args[i];
}
return 1;
}
parsearg_op(opt);
for (int i = 0; i < argc; i++)
operation.args.push_back(argv[i]);
for (const auto& str : operation.args)
cout << str << " ";

}
return 0;
}
Expand All @@ -168,14 +169,14 @@ int main(int argc, char* argv[]) {
TaurBackend backend(config, config.getConfigDir());

parseargs(argc, argv);
/*switch (operation.op) {
case OP_INSTALL:
switch (operation.op) {
case OP_SYNC:
return (installPkg(operation.args[0], &backend)) ? 0 : 1;
case OP_REMOVE:
/*case OP_REMOVE:
return (removePkg(operation.args[0], &backend)) ? 0 : 1;
case OP_UPDATE_ALL:
return (updateAll(&backend)) ? 0 : 1;
}*/
return (updateAll(&backend)) ? 0 : 1;*/
}

return 3;
}

0 comments on commit 8c51110

Please sign in to comment.