You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+11-17
Original file line number
Diff line number
Diff line change
@@ -23,42 +23,36 @@ var settings = {
23
23
name:"echo", //Command name
24
24
description:"a test command with one echo arg", //Help text to be displayed when `help` command is called
25
25
parameters: ["a string to be echoed in console"], //An optional array of successive parameter descriptions, used when the command that needs args is being called without any args
26
-
func:function(params){println(params[0])} //Function to be called when the command is executed. Accepts an array of parameters, ordered in the same way as in the previous property
26
+
func:function(params){plainterm.print(params[0])} //Function to be called when the command is executed. Accepts an array of parameters, ordered in the same way as in the previous property
`help` - Display a list of all commands with descriptions
48
+
48
49
`command` - Execute a command. Will display "Usage: command [parameter 1 description][parameter 2 description], etc.", when needs args but called without them.
49
50
50
51
## API:
51
52
52
-
`println(text, command)` - Print a text in terminal starting from a new line. Command - optional, count given string as a command (prepend prompt, syntax highlight).
53
-
54
-
`bash.version` - plainterm.js version
55
-
`bash.commands` - an object containing all available commands available
`bash.commands.[command].func` - retrieve a function. call with `bash.commands.[command].func()`
53
+
| Method | Description | Parameters |
54
+
| ------------- | ------------- | ------------- |
55
+
|`init(settings)`| Initialize a terminal in a DOM with given ID | Object. See the example above |
56
+
|`print(text, c)`| Prints a given text in the terminal |`text` - String, `c` - Boolean, optional, defaults to false. Count given string as a command (displays prompt, syntax highlight and appears in history) |
57
+
|`run(text)`| Emulates a command execution in a terminal (acts the same way as a use would have typed and pressed Enter) |`text` - String |
58
+
|`hist(up)`| Search in command history. Returns string. |`up` - Boolean, optional. Defaults to true. Upward/downward search. |
Copy file name to clipboardexpand all lines: index.html
+22-14
Original file line number
Diff line number
Diff line change
@@ -2,47 +2,55 @@
2
2
<htmllang="en">
3
3
<head>
4
4
<metacharset="utf-8">
5
-
<title>mkrl.xyz</title>
6
-
<metaname="description" content="A personal website of mine. Why are you here?">
7
-
<metaname="author" content="mkrl">
8
-
<linkrel="stylesheet" href="s.css">
5
+
<title>plainterm.js</title>
6
+
<linkrel="stylesheet" href="style.css">
7
+
<style>
8
+
.container>div {
9
+
margin:0 auto;
10
+
}
11
+
</style>
9
12
</head>
10
13
<body>
11
14
12
-
<center><h3>Hello</h3></center>
15
+
<center><h3>Terminal</h3></center>
13
16
17
+
<divclass="container">
14
18
<divid="terminal">
15
19
</div>
20
+
</div>
16
21
17
22
<scriptsrc="./plainterm.js"></script>
18
23
<script>
19
24
varsettings={
20
25
id: "terminal",
21
-
welcome: "Welcome to plainterm.js terminal emulator",
22
26
prompt: "user@mkrl.xyz:~$ ",
23
27
commands: {
24
-
test: {
25
-
name: "test",
26
-
description: "a test command with no args",
27
-
func: function(){println("testing things")}
28
+
about: {
29
+
name: "about",
30
+
description: "about the module",
31
+
func: function(){plainterm.print('A dead simple lightweight pure Javascript terminal "emulator" that is intended to be used for entertainment purposes. Written in one night.')}
0 commit comments