Skip to content

Commit aabc8cc

Browse files
Merge pull request #10 from SpaciousCoder78/testing
Testing Merge for v2.0.0
2 parents b7e263c + ff83afe commit aabc8cc

File tree

4 files changed

+58
-15
lines changed

4 files changed

+58
-15
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1+
test.py
22
bin

headers/commands.h

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ int quickoverflow_search(char **args); //open search
2626
int quickoverflow_help(char **args); //help command
2727
int quickoverflow_quit(char **args); //exit command
2828
int quickoverflow_about(char **args); //about command
29+
int quickoverflow_cd(char **args);
2930

3031
/*
3132
List of builtin commands, followed by their corresponding functions.
@@ -35,13 +36,15 @@ char *builtin_str[] = {
3536
"help", //help command
3637
"quit", //exit command
3738
"about",
39+
"cd",
3840
};
3941

4042
int (*builtin_func[]) (char **) = {
4143
&quickoverflow_search, //search directory
4244
&quickoverflow_help, //help command
4345
&quickoverflow_quit, //exit command
44-
&quickoverflow_about,
46+
&quickoverflow_about, //about
47+
&quickoverflow_cd, //change dir
4548
};
4649

4750
int quickoverflow_num_builtins() {
@@ -52,6 +55,21 @@ int quickoverflow_num_builtins() {
5255
***********************************Builtin function implementations*************************************
5356
*/
5457

58+
//Update 2.0.0 - Added cd for directory traversal
59+
60+
//***************************************chdir*********************************************** */
61+
int quickoverflow_cd(char **args)
62+
{
63+
if (args[1] == NULL) {
64+
fprintf(stderr, "QuickOverflow : expected argument to \"cd\"\n");
65+
} else {
66+
if (chdir(args[1]) != 0) {
67+
perror("QuickOverflow");
68+
}
69+
}
70+
return 1;
71+
}
72+
5573
//***************************************sofsearch*********************************************** */
5674
//function for calling the python files for searching
5775
int quickoverflow_search(char **args)
@@ -72,8 +90,7 @@ int quickoverflow_search(char **args)
7290
PyRun_SimpleFile(fp, "search.py");
7391
fclose(fp);
7492

75-
// Finalize the Python interpreter.
76-
Py_Finalize();
93+
//Update 2.0.0 removed Py_Finalise to avoid segmentation faults
7794

7895
return 1;
7996
}
@@ -84,8 +101,15 @@ int quickoverflow_search(char **args)
84101
//*****************************************sos*********************************************** */
85102
int quickoverflow_help(char **args){
86103
int i;
87-
printf("--------------------------------QuickOverflow-----------------------------\n");
88-
printf("---------------------------------Version 1.0.1----------------------------\n");
104+
printf(" \n"
105+
" _____ _ _ _____ __ _ \n"
106+
"| _ | (_) | | | _ | / _| | \n"
107+
"| | | |_ _ _ ___| | _| | | |_ _____ _ __| |_/| | _____ __\n"
108+
"| | | | | | | |/ __| |/ / | | \\ \\ / / _ \\ '__| _| |/ _ \\ \\ /\\ / /\n"
109+
"\\ \\/' / |_| | | (__| <\\ \\_/ /\\ V / __/ | | | | | (_) \\ V V / \n"
110+
" \\_/\\_\\\\__,_|_|\\___|_|\\_\\\\___/ \\_/ \\___|_| |_| |_|\\___/ \\_/\\_ \n"
111+
" \n");
112+
printf("---------------------------------Version 2.0.0----------------------------\n");
89113
printf("Type program names and arguments, and hit enter.\n");
90114
printf("The following are built in:\n");
91115

@@ -105,9 +129,16 @@ int quickoverflow_quit(char **args){
105129
//**************************************about (ofc credits)************************************* */
106130

107131
int quickoverflow_about(char **args){
108-
printf("-------------------------------QuickOverflow-----------------------------------\n");
109-
printf("Version: 1.0.1\n");
110-
printf("License: MIT License\n");
132+
printf(" \n"
133+
" _____ _ _ _____ __ _ \n"
134+
"| _ | (_) | | | _ | / _| | \n"
135+
"| | | |_ _ _ ___| | _| | | |_ _____ _ __| |_/| | _____ __\n"
136+
"| | | | | | | |/ __| |/ / | | \\ \\ / / _ \\ '__| _| |/ _ \\ \\ /\\ / /\n"
137+
"\\ \\/' / |_| | | (__| <\\ \\_/ /\\ V / __/ | | | | | (_) \\ V V / \n"
138+
" \\_/\\_\\\\__,_|_|\\___|_|\\_\\\\___/ \\_/ \\___|_| |_| |_|\\___/ \\_/\\_ \n"
139+
" \n");
140+
printf("Version: 2.0.0\n");
141+
printf("License: GNU GPL-3 License\n");
111142
printf("Author: Aryan Karamtoth (SpaciousCoder78)\n");
112143
printf("Author Email: [email protected]\n");
113144
printf("Supported Operating Systems: Linux\n");

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
pip3 install -r requirements.txt --break-system-packages
44

55
mkdir -p bin
6-
gcc -I/usr/include/python3.12 main.c -lpython3.12 -o bin/QuickOverflow
76

7+
gcc -I/usr/include/python3.12 main.c -lpython3.12 -o bin/QuickOverflow
88

99

1010

search.py

100644100755
Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22

33
from pyoverflow3.pyoverflow3 import pyoverflow3
44

5-
error = input("Input the Python error here: ")
6-
5+
# Update: 2.0.0 - Added automatic error searching from terminal
6+
import subprocess,shlex
77

8-
pyoverflow3.submit_error(str(error),2)
9-
10-
#Wait for the magic :)
8+
#pysearch is a tool to debug incoming errors from python scripts
9+
cmd = input("py-search > ")
10+
try:
11+
process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE,
12+
stderr=subprocess.PIPE, cwd=".")
13+
14+
stdout, stderr = process.communicate()
15+
16+
print(stdout.decode('utf-8'))
17+
print(stderr.decode('utf-8'))
18+
19+
pyoverflow3.submit_error(str(stderr),2)
20+
21+
except Exception as e:
22+
print("QuickOverflow Error: " + e)

0 commit comments

Comments
 (0)