1
0
Fork
You've already forked swagshell
1

feat: add basic interactive mode #2

Merged
redzimski merged 5 commits from poz/swagshell:interactive into main 2023年08月27日 22:03:37 +02:00
Owner
Copy link
No description provided.
@ -0,0 +14,4 @@
// TODO use $PS1 for prompt (eval and stuff)
#define PROMPT "$ "
void interactive() {
Contributor
Copy link

this isnt c++ kid!!!!!!!!!!1 we real men put void in the parens

this isnt c++ kid!!!!!!!!!!1 we real men put void in the parens
Author
Owner
Copy link

done, can I get into the real men club now ???

done, can I get into the real men club now ???
poz marked this conversation as resolved
@ -0,0 +18,4 @@
fprintf(stderr, PROMPT);
while ((nread = getline(&line, &buffer_size, stdin)) != -1) {
Contributor
Copy link

is the value of line reset each iteration? what if you first enter "abcdef" and then "123"? will it be "123" or "123def"? (well actually "123\n0円f" i think but thats besides the point)

is the value of line reset each iteration? what if you first enter "abcdef" and then "123"? will it be "123" or "123def"? (well actually "123\n0円f" i think but thats besides the point)
Author
Owner
Copy link

the value does get reset, I love getline()

the value does get reset, I love getline()
poz marked this conversation as resolved
@ -0,0 +1,6 @@
#ifndef SWAGSHELL_INTERACTIVE_H
#define SWAGSHELL_INTERACTIVE_H
void interactive();
Contributor
Copy link

missing void and also does this need to be in a seperate file? maybe rename this to swagshell.h which would be a general header for functions/stuff that dont deserve their own

missing void and also does this need to be in a seperate file? maybe rename this to swagshell.h which would be a general header for functions/stuff that dont deserve their own
Author
Owner
Copy link

thinking about it now, it probably won't grow much so will do, if it does we can move it back to interactive.{c,h}

thinking about it now, it probably won't grow much so will do, if it does we can move it back to interactive.{c,h}
Contributor
Copy link

.h idiot
interactive.c is ok

.h idiot interactive.c is ok
poz marked this conversation as resolved
@ -0,0 +16,4 @@
void interactive(void) {
fprintf(stderr, PROMPT);
Author
Owner
Copy link

we could get rid of this by changing the while into a do while

we could get rid of this by changing the while into a do while
Contributor
Copy link

no because you'd cmd_run(NULL) i think

no because you'd `cmd_run(NULL)` i think
Author
Owner
Copy link

we could add that as a special case in cmd_run but I guess yeah let's leave this for now

we could add that as a special case in cmd_run but I guess yeah let's leave this for now
poz marked this conversation as resolved
poz deleted branch interactive 2023年08月28日 11:11:44 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
japsmr/swagshell!2
Reference in a new issue
japsmr/swagshell
No description provided.
Delete branch "poz/swagshell:interactive"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?