Updated Terminal: Adding Commands (markdown)

Innovation Inc 2020-05-14 19:05:05 -05:00
parent b1d9dd41bd
commit 86eba769dc

@ -1,17 +1,27 @@
# Terminal: Adding Commands # Terminal: Adding Commands
<!-- Todo: update this documentation more -->
## Adding Commands Permanently
The terminal, which runs on JavaScript, can have commands added to it. The terminal, which runs on JavaScript, can have commands added to it.
## Step 1 ### Step 1
Open the terminal file. It is located at `terminal/terminal.js`
![](https://lh3.googleusercontent.com/hqlqMsGf2UuaRQeIidJRsM-ZCDETK_3cSkldMxATYkQHmUE86gL8GEbCGDjWdjsrryWeC06uTdXL5LZ2gSaqUxYOIJnb0yVOo43ygFowEFs1AnXGXjqqaYkdudcuj9VhTjKYjcKuhw=w2400) ![](https://lh3.googleusercontent.com/hqlqMsGf2UuaRQeIidJRsM-ZCDETK_3cSkldMxATYkQHmUE86gL8GEbCGDjWdjsrryWeC06uTdXL5LZ2gSaqUxYOIJnb0yVOo43ygFowEFs1AnXGXjqqaYkdudcuj9VhTjKYjcKuhw=w2400)
Add the name of your command to the list (around line 25).
## Step 2 Add the name of your command to the list.
![](https://lh3.googleusercontent.com/t3ABR85g_j_bwyEsqvqjTH4UaBoH55NqvDALNDyma_7-1IPPfImN6JANKv7oGSS0BT1gyb9yTrbOzknTD8eoCCm3r-oyJTV6ruroD5t0gcxImZEHWIr2z0lGCvM3e1GvV4tQsQpaVg=w2400)
Add your code using the basic framework above (around line 152). It should look like this: ### Step 2
`case 'mycommand': <!-- Todo: Readd a new image without the "brake;" issue that I somehow didn't notice. -->
Add your code using the basic framework below. It should look like this:
`
case 'mycommand':
//Your code goes here //Your code goes here
brake;` break;
`
Make your modifications and save the file.
## Step 3 ### Step 3
Load up the terminal and run the command by typing its name. You should also be able to see it when running "help" Open the terminal and run the command by typing its name. You should also be able to see it when running "help".
## Adding Commands Temporarily With Modules
<!-- Maybe todo: Combine modules with this documentation. -->
Modules are a way of temporarily adding functions to DremJS. Documentation on it can be found [here](https://github.com/sparrdrem/DremJS/wiki/Modules).