CI action update. Some example directory refactoring. No code changes. (0.39.15)
This commit is contained in:
parent
86a9e74617
commit
9e6cb9fea4
10 changed files with 2 additions and 2 deletions
|
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-11-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Demonstrates curl_download saving a file to disk.
|
||||
*/
|
||||
|
||||
url = "https://httpbin.org/image/png"
|
||||
path = "./downloaded.png"
|
||||
ok = curl_download(url, path)
|
||||
if ok == 1
|
||||
print("Downloaded to " + path)
|
||||
else
|
||||
print("Download failed")
|
||||
|
||||
/* Expected output:
|
||||
Downloaded to ./downloaded.png
|
||||
*/
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-11-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Demonstrates curl_get and JSON.parse working together.
|
||||
*/
|
||||
|
||||
url = "https://httpbin.org/json"
|
||||
resp = curl_get(url)
|
||||
print("Raw length: " + to_string(len(resp)))
|
||||
|
||||
// If JSON support is enabled, parse it
|
||||
obj = json_parse(resp)
|
||||
if obj != nil
|
||||
print("Title: " + obj["slideshow"]["title"])
|
||||
|
||||
/* Expected output:
|
||||
Raw length: 429
|
||||
Title: Sample Slide Show
|
||||
*/
|
||||
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-11-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Demonstrates curl_post sending form data and printing response.
|
||||
*/
|
||||
|
||||
url = "https://httpbin.org/post"
|
||||
data = "name=Fun&lang=fun"
|
||||
resp = curl_post(url, data)
|
||||
print("Response: " + resp)
|
||||
|
||||
// If JSON support is enabled, parse it
|
||||
obj = json_parse(resp)
|
||||
if obj != nil
|
||||
print("Content-Type: " + to_string(obj["headers"]["Content-Type"]))
|
||||
|
||||
if obj != nil
|
||||
print("Host: " + to_string(obj["headers"]["Host"]))
|
||||
|
||||
if obj != nil
|
||||
print("Origin: " + to_string(obj["origin"]))
|
||||
|
||||
// Possible output:
|
||||
// Response: {
|
||||
// "args": {},
|
||||
// "data": "",
|
||||
// "files": {},
|
||||
// "form": {
|
||||
// "lang": "fun",
|
||||
// "name": "Fun"
|
||||
// },
|
||||
// "headers": {
|
||||
// "Accept": "*/*",
|
||||
// "Content-Length": "17",
|
||||
// "Content-Type": "application/x-www-form-urlencoded",
|
||||
// "Host": "httpbin.org",
|
||||
// "X-Amzn-Trace-Id": "Root=1-6944834b-74f499e251c322713e7dd9a8"
|
||||
// },
|
||||
// "json": nil,
|
||||
// "origin": "5.252.226.107",
|
||||
// "url": "https://httpbin.org/post"
|
||||
// }
|
||||
//
|
||||
// Content-Type: application/x-www-form-urlencoded
|
||||
// Host: httpbin.org
|
||||
// Origin: 5.252.226.107
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2026-01-03
|
||||
*/
|
||||
|
||||
/*
|
||||
* Minimal Notcurses hello example.
|
||||
*/
|
||||
|
||||
include <ui/notcurses.fun>
|
||||
|
||||
n = Notcurses()
|
||||
|
||||
if n.init() == 0
|
||||
print("Notcurses not available. Rebuild with -DFUN_WITH_NOTCURSES=ON.")
|
||||
exit(0)
|
||||
|
||||
n.clear()
|
||||
n.draw_text(2, 0, "Fun + Notcurses")
|
||||
n.draw_text(4, 0, "Press any key to exit...")
|
||||
|
||||
// blocking until key
|
||||
_ = n.getch(0)
|
||||
n.shutdown()
|
||||
|
||||
/* Possible output:
|
||||
A TUI.
|
||||
|
||||
After exit:
|
||||
3 renders, 991,14µs (223,57µs min, 330,38µs avg, 531,91µs max)
|
||||
3 rasters, 320,76µs (106,45µs min, 106,92µs avg, 107,72µs max)
|
||||
3 writes, 198,26µs (62,54µs min, 66,09µs avg, 69,94µs max)
|
||||
59B (0B min, 19B avg, 30B max) 1 input Ghpa: 0
|
||||
0 failed renders, 0 failed rasters, 0 refreshes, 0 input errors
|
||||
RGB emits:elides: def 1:38 fg 0:0 bg 0:0
|
||||
Cell emits:elides: 39:74805 (99,95%) 97,44% 0,00% 0,00%
|
||||
Bmap emits:elides: 0:0 (0,00%) 0B (0,00%) SuM: 0 (0,00%)
|
||||
*/
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
include <ui/notcurses.fun>
|
||||
|
||||
n = Notcurses()
|
||||
if n.init() == 0
|
||||
print("Notcurses not available. Build with -DFUN_WITH_NOTCURSES=ON.")
|
||||
exit(1)
|
||||
|
||||
items = ["First", "Second", "Third", "Fourth"]
|
||||
sel = 0
|
||||
while true
|
||||
n.clear()
|
||||
// Title
|
||||
n.set_style(0xFFFF00, 0x000000, 1) // bold yellow
|
||||
n.draw_text(1, 2, "Demo Menu (j/k to move, Enter to select, ESC to quit)")
|
||||
|
||||
// Render menu list
|
||||
n.menu(3, 4, items, sel, 30, 0, 32)
|
||||
|
||||
key = n.getch(0)
|
||||
if key == 27 // ESC
|
||||
break
|
||||
if key == 106 // 'j'
|
||||
sel = (sel + 1) % len(items)
|
||||
if key == 107 // 'k'
|
||||
sel = (sel - 1 + len(items)) % len(items)
|
||||
if key == 10 // Enter
|
||||
n.status_bar("Selected: " + items[sel], 32)
|
||||
// brief wait
|
||||
sleep_ms(300)
|
||||
|
||||
n.shutdown()
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
include <ui/notcurses.fun>
|
||||
|
||||
n = Notcurses()
|
||||
if n.init() == 0
|
||||
print("Notcurses not available. Build with -DFUN_WITH_NOTCURSES=ON.")
|
||||
exit(1)
|
||||
|
||||
n.clear()
|
||||
sz = n.size()
|
||||
rows = 24
|
||||
cols = 80
|
||||
if typeof(sz) == "array"
|
||||
if len(sz) >= 2
|
||||
rows = sz[0]
|
||||
cols = sz[1]
|
||||
|
||||
y = to_number(rows) / 2
|
||||
w = cols - 10
|
||||
if w < 20
|
||||
w = 20
|
||||
|
||||
i = 0
|
||||
while i <= 100
|
||||
// styles handled inside progress(); keep plane sane
|
||||
rc = n.set_style(0x00FF00, 0x000000, 1)
|
||||
frac = to_number(i) / 100
|
||||
rc = n.progress(y, 5, w, frac, 0)
|
||||
k = n.getch(10)
|
||||
i = i + 1
|
||||
|
||||
// final message
|
||||
rc = n.set_style(0xFFFFFF, 0x000000, 1)
|
||||
rc = n.draw_text(y + 2, 5, "Done!")
|
||||
rc = n.render()
|
||||
|
||||
rc = n.shutdown()
|
||||
Loading…
Add table
Add a link
Reference in a new issue