Little overall changes
- Changed 'dir' cmd to 'ls' - Added a version check skip - Changed the logo color - Updated README.md
This commit is contained in:
parent
94c62f3d6b
commit
023dcf2d3e
4 changed files with 41 additions and 24 deletions
|
|
@ -8,7 +8,7 @@ Tested on: *Ubuntu, Debian, Arch*
|
|||
|
||||
Used libs for Linux: *gtk+3.0, libmysqlclient*
|
||||
|
||||
Version: *0.2.2*
|
||||
Version: *0.2.3*
|
||||
|
||||
## Features:
|
||||
- A help page (OMG!!!)
|
||||
|
|
@ -22,7 +22,7 @@ Install packages:
|
|||
|
||||
- Ubuntu: ```sudo apt-get install make gcc git libgtk-3-dev libmysqlclient-dev```
|
||||
- Debian: ```sudo apt-get install make gcc git libgtk-3-dev libmariadbclient-dev libmariadb-dev-compat```
|
||||
- Arch: ```sudo pacman -S make gcc git gtk3 mariadb-libs```
|
||||
- Arch: ```sudo pacman -S make gcc git gtk3 mariadb-libs pkgconf```
|
||||
|
||||
Clone repository: ```git clone https://github.com/netbenix/netbenixCMD.git```
|
||||
|
||||
|
|
@ -40,6 +40,7 @@ If you want to use the testing arguments use ```./netbenixCMD <argument>```
|
|||
- ```--gtk-test``` => Opens the GTK Test Window
|
||||
- ```--sql-test``` => Makes a test connection to a mysql server
|
||||
- ```--sys-info``` => Gives you information about your system
|
||||
- ```--no-version-check``` => Skips the client version check
|
||||
|
||||
## Known Bugs
|
||||
- ```sql-test``` sha-256 passwords not working on Debian
|
||||
|
|
@ -35,6 +35,7 @@ void showDirectory(char *arg[]){
|
|||
realpath(arg[1], path); //Get the absolute path of the directory
|
||||
if(d){
|
||||
while((dir = readdir(d))){
|
||||
if(strcmp(dir->d_name, ".") && strcmp(dir->d_name, "..")){
|
||||
if(dir->d_type == 8){ //IF IS FILE
|
||||
printf("\033[1;34m%s\033[0m\n", dir->d_name);
|
||||
} else if(dir->d_type == 4){ //IF IS DIR
|
||||
|
|
@ -43,6 +44,7 @@ void showDirectory(char *arg[]){
|
|||
printf("%s\n", dir->d_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(d); //Close directory
|
||||
}
|
||||
}
|
||||
10
etc/logo.c
10
etc/logo.c
|
|
@ -8,9 +8,9 @@ char logo_row5[59] = "|_| |_|\\___|\\__|_.__/ \\___|_| |_|_/_/\\_\\\\____|_| |_
|
|||
|
||||
//Prints the logo
|
||||
void showLogo(){
|
||||
printf("\033[0;34m%s\033[0m\n", logo_row1);
|
||||
printf("\033[0;34m%s\033[0m\n", logo_row2);
|
||||
printf("\033[0;34m%s\033[0m\n", logo_row3);
|
||||
printf("\033[0;34m%s\033[0m\n", logo_row4);
|
||||
printf("\033[0;34m%s\033[0m\n\n", logo_row5);
|
||||
printf("\033[1;34m%s\033[0m\n", logo_row1);
|
||||
printf("\033[1;34m%s\033[0m\n", logo_row2);
|
||||
printf("\033[1;34m%s\033[0m\n", logo_row3);
|
||||
printf("\033[1;34m%s\033[0m\n", logo_row4);
|
||||
printf("\033[1;34m%s\033[0m\n\n", logo_row5);
|
||||
}
|
||||
34
main.c
34
main.c
|
|
@ -17,11 +17,14 @@
|
|||
#include "utils/logger.h"
|
||||
#include "utils/sys_info.h"
|
||||
#include "utils/update_check.h"
|
||||
#include "etc/man/man.h"
|
||||
|
||||
|
||||
#define VERSION "0.2.2"
|
||||
#define VERSION "0.2.3"
|
||||
#define AUTHOR "netbenix"
|
||||
|
||||
bool VER_CHECK_ON_START = true;
|
||||
|
||||
// Color Codes:
|
||||
// Reset: \033[0m
|
||||
// Red: \033[0;31m
|
||||
|
|
@ -62,10 +65,11 @@ int commandHandler(char *cmd){
|
|||
arg[i] = p;
|
||||
|
||||
//Start to compare the command
|
||||
if(!strcmp(arg[0], "list")){
|
||||
printf("\033[1;34mcd\033[0m : change directory\n");
|
||||
printf("\033[1;34mdir\033[0m : show contents of directory\n");
|
||||
printf("\033[1;34mlist\033[0m : this list\n");
|
||||
if(!strcmp(arg[0], "help")){
|
||||
printf("\033[1;34mcd \033[0;35m[dir]\033[0m : change directory\n");
|
||||
printf("\033[1;34mls \033[0;35m[dir]\033[0m : show contents of directory\n");
|
||||
printf("\033[1;34mhelp\033[0m : this help list\n");
|
||||
printf("\033[1;34mman \033[0;35m[cmd]\033[0m : manual for the commands\n");
|
||||
printf("\033[1;34mversion\033[0m : shows the version\n");
|
||||
printf("\033[1;34mexit\033[0m : exit the program\n");
|
||||
return 0;
|
||||
|
|
@ -77,14 +81,17 @@ int commandHandler(char *cmd){
|
|||
return 0;
|
||||
} else if(!strcmp(arg[0], "exit")){
|
||||
return 1;
|
||||
} else if(!strcmp(arg[0], "dir")){
|
||||
} else if(!strcmp(arg[0], "ls")){
|
||||
showDirectory(arg);
|
||||
return 0;
|
||||
} else if(!strcmp(arg[0], "cd")){
|
||||
changeCurrentWorkDir(arg);
|
||||
return 0;
|
||||
} else if(!strcmp(arg[0], "man")){
|
||||
showManEntry(arg);
|
||||
return 0;
|
||||
} else {
|
||||
printf("Unknown command. Please use 'list' for more information.\n");
|
||||
printf("Unknown command. Please use 'help' for more information.\n");
|
||||
logger("User entered unknown command.");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -101,7 +108,6 @@ int main(int argc, char *argv[]){
|
|||
log_Specs(); //Log system specs
|
||||
showLogo(); //Show the logo
|
||||
logger("Logo Displayed.");
|
||||
checkForUpdate(VERSION); //Check for newer version of client
|
||||
if(argc > 2){
|
||||
printf("Too many arguments. Please use --help for more information.\n");
|
||||
snprintf(buffer, sizeof(buffer), "[ERROR] Too many arguments. Argument count: %i", argc-1);
|
||||
|
|
@ -113,24 +119,33 @@ int main(int argc, char *argv[]){
|
|||
if(!strcmp(argv[1], "--help")){
|
||||
logger("Showing Help.");
|
||||
outputHelp();
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[1], "--gtk-test")){
|
||||
logger("Stating GTK Test.");
|
||||
createGTKTestWindow();
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[1], "--sys-info")){
|
||||
logger("Showing System Information.");
|
||||
print_Specs();
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[1], "--sql-test")){
|
||||
logger("Starting SQL Test.");
|
||||
testSQLConnection();
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[1], "--no-version-check")){
|
||||
VER_CHECK_ON_START = false;
|
||||
logger("[INFO] Argument 'no-version-check' used.");
|
||||
} else {
|
||||
printf("Argument unknown. Please use --help for more information.\n");
|
||||
snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]);
|
||||
logger(buffer);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if(VER_CHECK_ON_START){checkForUpdate(VERSION);}//Check for newer version of client
|
||||
|
||||
//If no startup arg is given, start command handler
|
||||
if(argc == 1){
|
||||
int exit = 0;
|
||||
char cmd[128];
|
||||
logger("Starting Command Handler.");
|
||||
|
|
@ -141,7 +156,6 @@ int main(int argc, char *argv[]){
|
|||
exit = commandHandler(cmd);
|
||||
}
|
||||
logger("Exiting Command Handler.");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
exit_app();
|
||||
|
|
|
|||
Reference in a new issue