add lil programs to test
This commit is contained in:
parent
e0b5c4b2ea
commit
2abf9b46e5
7 changed files with 4 additions and 32 deletions
1
cat.yarn
Normal file
1
cat.yarn
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"protected":false,"mode":"f","metadata":{"name":"cat","author":"Luna Magdalena :3","version":[1],"dependencies":[],"runner":[],"paths":{"cat.js":"%B/cat.js"}},"content":"{\"cat.js\":{\"protected\":true,\"metadata\":{},\"mode\":\"f\",\"content\":\"program.autoOutput = false\\n\\nfor (let a of args) {\\n let file\\n try {\\n file = io.open(a)\\n } catch (e) {\\n display.print(\\\"Cannot open file\\\", 0x9000)\\n }\\n if (file) {\\n const lines = file.lines()\\n for (let line of lines) {\\n io.output(\\\"%n\\\" + line)\\n display.print(line, itty.baseStyle, false)\\n }\\n }\\n}\\n \\nquit()\"}}"}
|
||||||
1
clear.yarn
Normal file
1
clear.yarn
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"protected":false,"mode":"f","metadata":{"name":"clear","author":"Luna Magdalena :3","version":[1],"dependencies":[],"runner":[],"paths":{"clear.js":"%B/clear.js"}},"content":"{\"clear.js\":{\"protected\":true,\"metadata\":{},\"mode\":\"f\",\"content\":\"display.clear(); quit()\"}}"}
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"protected":false,"mode":"f","metadata":{"name":"info","version":[1],"author":"Luna Magdalena :3","dependencies":[],"paths":{"info.js":"%C/info.js"}},"content":"{\"info.js\":{\"protected\":false,\"metadata\":{},\"mode\":\"f\",\"content\":\"display.buffer(`Itty version: v${itty.version[0]}.${itty.version[1]}${itty.version[2] ? \\\".\\\" + itty.version[2] : \\\"\\\"} ${itty.version[3] || \\\"\\\"}%nRoot FS: ${itty.disk.version}`, 0x4000)\\ndisplay.buffer(\\\"%n%nDisplay dimensions: \\\", 0x7000)\\ndisplay.buffer(itty.width + \\\"x\\\" + itty.height + \\\"%n%n\\\", 0x6000)\\nfor (let i=0; i < 8; i++) {\\n display.buffer(\\\" \\\", 0x0100 * i)\\n}\\nitty.cursorY++\\nitty.cursorX = 0\\nfor (let i=8; i < 16; i++) {\\n display.buffer(\\\" \\\", 0x0100 * i)\\n}\\n\\ndisplay.buffer(\\\"%n%nITTY: Incredibly Tiny Terminal, Yay!\\\", 0x4041)\\ndisplay.buffer(\\\" by \\\", 0x7041)\\ndisplay.buffer(\\\"Magdalunaa\\\", 0x6051)\\nstyle.setAttribute(1, {_link: \\\"https://codeberg.org/Magdalunaa/itty\\\", style: \\\"cursor: pointer; text-decoration-color: var(--itty-c-4)\\\"})\\ndisplay.render()\\nquit()\"}}"}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"name": "programs",
|
|
||||||
"author": "Luna Magdalena :3",
|
|
||||||
"version": [1],
|
|
||||||
"dependencies": ["info"],
|
|
||||||
"paths": {
|
|
||||||
"programs.js": "%B/programs.js"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
19
programs.js
19
programs.js
|
|
@ -1,19 +0,0 @@
|
||||||
for (let path of itty.env.path) {
|
|
||||||
path = fs.listDir(path)
|
|
||||||
for (let p in path) {
|
|
||||||
p = path[p]
|
|
||||||
if (p.ext === "js") {
|
|
||||||
const name = p.name.slice(0, -3)
|
|
||||||
if (itty.cursorX + name.length >= itty.width) {
|
|
||||||
itty.cursorX = 0
|
|
||||||
itty.cursorY++
|
|
||||||
}
|
|
||||||
while (itty.cursorY >= itty.height)
|
|
||||||
display.lift()
|
|
||||||
display.buffer(name + " ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
display.render()
|
|
||||||
quit()
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"protected":false,"mode":"f","metadata":{"name":"programs","author":"Luna Magdalena :3","version":[1],"dependencies":["info"],"paths":{"programs.js":"%B/programs.js"}},"content":"{\"programs.js\":{\"protected\":false,\"metadata\":{},\"mode\":\"f\",\"content\":\"for (let path of itty.env.path) {\\n path = fs.listDir(path)\\n for (let p in path) {\\n p = path[p]\\n if (p.ext === \\\"js\\\") {\\n const name = p.name.slice(0, -3)\\n if (itty.cursorX + name.length >= itty.width) {\\n itty.cursorX = 0\\n itty.cursorY++\\n }\\n while (itty.cursorY >= itty.height)\\n display.lift()\\n display.buffer(name + \\\" \\\")\\n }\\n }\\n}\\n \\ndisplay.render()\\nquit()\"}}"}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "itty",
|
"name": "itty",
|
||||||
"packages": {
|
"packages": {
|
||||||
"info": {"url": "~info.yarn", "version": [1]},
|
"cat": {"url": "~cat.yarn", "version": [1]},
|
||||||
"programs": {"url": "~programs.yarn", "version": [1]}
|
"clear": {"url": "~clear.yarn", "version": [1]}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue