This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
valithor's profile picture

Shell Prompt

Started by valithor, 11 November 2015 - 12:39 AM
valithor #1
Posted 11 November 2015 - 01:39 AM
I got bored, and someone suggested I do this, so I present to you shell prompt (very creative name I know). It is basically just a combination of the lua program and the shell program, so you can run lua code like you can in the lua prompt and still run programs. The main point of this script is to look and feel like the default shell program, so other than the fact that I made sure the autocomplete worked for lua code, and if you type a file name wrong it will tell you, you made a lua error, you won't be able to notice you are not running the default shell.

Since it is made to look and feel like the default shell I am not going to post screen shots.

Pastebin code: RQ0PLkT6

One thing to note is that since this program is likely to be run as the startup if used, it will automatically run any program with the name "pstart" when it first starts.

If you have any suggestions feel free to suggest them. I would be happy to add almost any feature.

Disclaimer: This is just a modification of the default shell program, where I copied and pasted the lua program into it. Very little of the code here is actually mine, and due to how I did it, there very well might be some bugs. If you find a bug post it here and I will fix it.
Edited on 11 November 2015 - 01:39 AM
OS_MAN_10! #2
Posted 11 November 2015 - 03:02 AM
Does this do anything special (like add custom commands or api's)?
valithor #3
Posted 11 November 2015 - 03:10 AM
Does this do anything special (like add custom commands or api's)?

No. It does exactly what it says it does. It combines the lua program and the default shell program.
OS_MAN_10! #4
Posted 11 November 2015 - 03:12 AM
Well you should have at least a custom command(like deleting multiple files at once).
valithor #5
Posted 11 November 2015 - 03:21 AM
Well you should have at least a custom command(like deleting multiple files at once).

That is not part of the thing that I was asked to create by my friend. He simply asked me to combine the shell and lua program, which I did, and since it was created I posted it.

I see no point in adding a custom command, unless if you have a specific one in mind. Either way, I am fairly certain that the default delete program already supports multiple files.

edit:

This is more or less a "OS" (Hate calling it that), which makes it to where I do not have to launch the lua prompt every time I want to test something.
Edited on 11 November 2015 - 02:22 AM
OS_MAN_10! #6
Posted 11 November 2015 - 03:27 AM
Well you should have at least a custom command(like deleting multiple files at once).

That is not part of the thing that I was asked to create by my friend. He simply asked me to combine the shell and lua program, which I did, and since it was created I posted it.

I see no point in adding a custom command, unless if you have a specific one in mind. Either way, I am fairly certain that the default delete program already supports multiple files.

edit:

This is more or less a "OS" (Hate calling it that), which makes it to where I do not have to launch the lua prompt every time I want to test something.
You could make a custom pastebin command where you put the codes in quotation separated by commas to download multiple files(surprisingly this is not a feature in the normal pasetbin, as you think it would) i think this would be a useful command. Also this might be super hard for you so i won't be surprised if you say no, just giving you a challenge.
valithor #7
Posted 11 November 2015 - 03:30 AM
-snip

You could make a custom pastebin command where you put the codes in quotation separated by commas to download multiple files(surprisingly this is not a feature in the normal pasetbin, as you think it would) i think this would be a useful command. Also this might be super hard for you so i won't be surprised if you say no, just giving you a challenge.

There is already other programs on the forums that do that, either way it is a fairly simple thing to do. Essentially just copy and paste the relevant code from the pastebin program, and loop through it.

edit:

I generally have a different philosophy when it comes to shells from most people. I enjoy having the bare minimum when working on things, and usually find all the extra things that most of the shells on the forums provide just get in the way.
Edited on 11 November 2015 - 02:32 AM
OS_MAN_10! #8
Posted 11 November 2015 - 03:34 AM
-snip

You could make a custom pastebin command where you put the codes in quotation separated by commas to download multiple files(surprisingly this is not a feature in the normal pasetbin, as you think it would) i think this would be a useful command. Also this might be super hard for you so i won't be surprised if you say no, just giving you a challenge.

There is already other programs on the forums that do that, either way it is a fairly simple thing to do. Essentially just copy and paste the relevant code from the pastebin program, and loop through it.

edit:

I generally have a different philosophy when it comes to shells from most people. I enjoy having the bare minimum when working on things, and usually find all the extra things that most of the shells on the forums provide just get in the way.
ok i just wanted to see if you were up for a challenge -_-/>
valithor #9
Posted 11 November 2015 - 03:35 AM
-snip
ok i just wanted to see if you were up for a challenge -_-/>

Then try to find something that is a challenge. :P/>
edit:
Actually… Now that you have mentioned adding features, I guess I will finally go finish my edit rewrite and include that as a part of this.
Edited on 11 November 2015 - 02:39 AM
OS_MAN_10! #10
Posted 11 November 2015 - 03:46 AM
-snip
ok i just wanted to see if you were up for a challenge -_-/>

Then try to find something that is a challenge. :P/>
edit:
Actually… Now that you have mentioned adding features, I guess I will finally go finish my edit rewrite and include that as a part of this.
Ok here's a real challenge, create a Gui designer that is able to make buttons and add functions to those buttons. O.o
Edited on 11 November 2015 - 02:47 AM
valithor #11
Posted 11 November 2015 - 03:49 AM
-snip
Ok here's a real challenge, create a Gui designer that is able to make buttons and add functions to those buttons. O.o

Hmm… I wonder if I still have my old one that I made laying around. Think I lost it when the other server I was running shut down. :(/>

Might be worth remaking though. :P/>
OS_MAN_10! #12
Posted 11 November 2015 - 03:50 AM
-snip
Ok here's a real challenge, create a Gui designer that is able to make buttons and add functions to those buttons. O.o

Hmm… I wonder if I still have my old one that I made laying around. Think I lost it when the other server I was running shut down. :(/>

Might be worth remaking though. :P/>
WHAT YOU'VE MADE ONE BEFORE. HOW DID YOU DEW IT?! I TOTALLY THOUGHT IT WAS IMPOSSIBRU!
Edited on 11 November 2015 - 02:51 AM
valithor #13
Posted 11 November 2015 - 03:58 AM
-snip
WHAT YOU'VE MADE ONE BEFORE. HOW DID YOU DEW IT?! I TOTALLY THOUGHT IT WAS IMPOSSIBRU!

I made something similar to what you are talking about. If you want to see an amazing GUI api you should check out bedrock, it is great, however, mine was not quite as extensive.

Unless if you were talking about a program to design GUI's, and the program would create code that is exportable for another program to use. That would be fairly simple to create using a decent button api.
OS_MAN_10! #14
Posted 11 November 2015 - 04:02 AM
-snip
WHAT YOU'VE MADE ONE BEFORE. HOW DID YOU DEW IT?! I TOTALLY THOUGHT IT WAS IMPOSSIBRU!

I made something similar to what you are talking about. If you want to see an amazing GUI api you should check out bedrock, it is great, however, mine was not quite as extensive.

Unless if you were talking about a program to design GUI's, and the program would create code that is exportable for another program to use. That would be fairly simple to create using a decent button api.
Well actually i mean not just buttons have, menus, input boxes, and window creators.

edit:
also, text color switchers, background color switchers, custom color maker (for the text and background color switcher), nested menus, nested windows. SUPER COMPLICATED. also api's basically just add functions and are not what i'm talking about. i'm saying a gui that creates gui's(yes inception i know).
Edited on 11 November 2015 - 03:17 AM
valithor #15
Posted 11 November 2015 - 04:07 AM
-snip
Well actually i mean not just buttons have, menus, input boxes, and window creators.

Those are all just extensions to buttons honestly. :P/>

Essentially… You make a good button api, and then add built in functions, which do things such as accept input when clicked, or switch windows using the windows api… etc. A GUI api is really just a beefed out button api.

Now that I mentioned it, a GUI creation program would be fun to make. I might make that as well.
Edited on 11 November 2015 - 03:10 AM
OS_MAN_10! #16
Posted 11 November 2015 - 04:12 AM
-snip
Well actually i mean not just buttons have, menus, input boxes, and window creators.

Those are all just extensions to buttons honestly. :P/>

Essentially… You make a good button api, and then add built in functions, which do things such as accept input when clicked, or switch windows using the windows api… etc. A GUI api is really just a beefed out button api.

Now that I mentioned it, a GUI creation program would be fun to make. I might make that as well.
Did you even see my edit?
valithor #17
Posted 11 November 2015 - 04:18 AM

I didn't, but it is still the same concept. A good button api is capable of doing all of those things. I still suggest you go look at bedrock. It is a HUGE api, but it does all of things you have said and much much more. I have not actually seen the code for it nor used it, but I have seen the results, and know roughly of what it is capable of.

edit:

I am getting off for the night. If you want to continue the conversation feel free to send me a private message. :P/>

edit2:

bedrock api link: http://www.computercraft.info/forums2/index.php?/topic/19702-bedrock-the-complete-gui-framework/
Edited on 11 November 2015 - 03:21 AM
Lyqyd #18
Posted 11 November 2015 - 07:58 AM
This could be moved over to Programs if you'd prefer it be there instead. Report it if you'd like it moved.
Konlab #19
Posted 11 November 2015 - 02:25 PM
I really love it but I suggest that all shell things have to begin with a special character so I can view what's in var a even if there's a file called a.
Blue #20
Posted 11 November 2015 - 02:27 PM
I really love it but I suggest that all shell things have to begin with a special character so I can view what's in var a even if there's a file called a.
Konlab's right,maybe you could add a "/" before lua commands.
Creator #21
Posted 11 November 2015 - 02:29 PM
How exactly does it know something is code or a shell command?
Konlab #22
Posted 11 November 2015 - 02:30 PM
I really love it but I suggest that all shell things have to begin with a special character so I can view what's in var a even if there's a file called a.
Konlab's right,maybe you could add a "/" before lua commands.
Prioritizing lua commands or configurable prioritizing is better.
Creator #23
Posted 11 November 2015 - 02:30 PM
Don't add "/" because this is so path like. Rather add $ or &.
Konlab #24
Posted 11 November 2015 - 02:31 PM
How exactly does it know something is code or a shell command?
(Ninja war)
It prioritizes shell commands, only does lua when shell fails.
valithor #25
Posted 11 November 2015 - 06:49 PM
I am thinking about making it to where there is a function, which will make it switch between prioritizing lua and shell. If anything I will make it to where it uses something like = to signify lua code, but to where it is easily customizable.

Good to see people are actually using this. :P/>/> If you have anymore suggestions please go ahead and suggest.

edit:

I have a working version with the "=", but I forgot to upload it to pastebin when I was on the server. So, when I get on the server again I will upload it and post it here.
Edited on 12 November 2015 - 02:17 AM
WWIman #26
Posted 12 November 2015 - 01:11 AM
This is like the most active thread in the OS section.