Compare commits

...

10 Commits

Author SHA1 Message Date
d72681c999 update for the new config 2025-01-19 18:43:53 -05:00
ab68569ef6 rename to libpse and flag nosandbox 2025-01-19 01:29:08 -05:00
80c6feac42 no async 2025-01-14 16:20:01 -05:00
018859d979 move types to lsp 2025-01-06 20:54:33 -05:00
8223537cb7 examples/system_info 2025-01-05 22:26:02 -05:00
a596386d7b TERMINAL.WRITE: <T...>(T...) -> () 2025-01-05 22:25:47 -05:00
e59cefa041 rainbowify tweak 2025-01-05 22:25:47 -05:00
542f0533e5 lock 2025-01-05 22:25:47 -05:00
9500a6dc6f bug 2025-01-05 22:25:47 -05:00
b14eac07de LICENSE 2025-01-05 15:06:29 -05:00
8 changed files with 209 additions and 79 deletions

167
Cargo.lock generated
View File

@ -43,11 +43,12 @@ dependencies = [
[[package]]
name = "anstyle-wincon"
version = "3.0.6"
version = "3.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
dependencies = [
"anstyle",
"once_cell",
"windows-sys 0.59.0",
]
@ -59,15 +60,15 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bitflags"
version = "2.6.0"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
[[package]]
name = "bstr"
version = "1.11.1"
version = "1.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8"
checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0"
dependencies = [
"memchr",
"serde",
@ -81,9 +82,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "cc"
version = "1.2.6"
version = "1.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333"
checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229"
dependencies = [
"shlex",
]
@ -96,9 +97,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.5.23"
version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
dependencies = [
"clap_builder",
"clap_derive",
@ -106,9 +107,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.23"
version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838"
checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
dependencies = [
"anstream",
"anstyle",
@ -118,9 +119,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.18"
version = "4.5.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
dependencies = [
"heck",
"proc-macro2",
@ -168,6 +169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd"
dependencies = [
"const_format_proc_macros",
"konst",
]
[[package]]
@ -245,20 +247,35 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "js-sys"
version = "0.3.76"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "konst"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330f0e13e6483b8c34885f7e6c9f19b1a7bd449c673fbb948a51c99d66ef74f4"
dependencies = [
"konst_macro_rules",
]
[[package]]
name = "konst_macro_rules"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
[[package]]
name = "lambdashell"
version = "0.1.0"
dependencies = [
"clap",
"liblambdashell",
"libpse",
]
[[package]]
@ -268,7 +285,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]]
name = "liblambdashell"
name = "libloading"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [
"cfg-if",
"windows-targets",
]
[[package]]
name = "libpse"
version = "0.1.0"
dependencies = [
"color-print",
@ -281,21 +308,11 @@ dependencies = [
"whoami",
]
[[package]]
name = "libloading"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [
"cfg-if",
"windows-targets",
]
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]]
name = "lock_api"
@ -309,9 +326,28 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.22"
version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
[[package]]
name = "lua-src"
version = "547.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edaf29e3517b49b8b746701e5648ccb5785cde1c119062cbabbc5d5cd115e42"
dependencies = [
"cc",
]
[[package]]
name = "luajit-src"
version = "210.5.11+97813fb"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3015551c284515db7c30c559fc1080f9cb9ee990d1f6fca315451a107c7540bb"
dependencies = [
"cc",
"which",
]
[[package]]
name = "luau0-src"
@ -369,6 +405,8 @@ checksum = "63a11d485edf0f3f04a508615d36c7d50d299cf61a7ee6d3e2530651e0a31771"
dependencies = [
"cc",
"cfg-if",
"lua-src",
"luajit-src",
"luau0-src",
"pkg-config",
]
@ -429,9 +467,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "proc-macro2"
version = "1.0.92"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
dependencies = [
"unicode-ident",
]
@ -462,9 +500,9 @@ checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
[[package]]
name = "rustix"
version = "0.38.42"
version = "0.38.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
dependencies = [
"bitflags",
"errno",
@ -549,9 +587,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.93"
version = "2.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058"
checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
dependencies = [
"proc-macro2",
"quote",
@ -560,18 +598,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.9"
version = "2.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc"
checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "2.0.9"
version = "2.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4"
checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
dependencies = [
"proc-macro2",
"quote",
@ -620,9 +658,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
@ -631,9 +669,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
@ -645,9 +683,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -655,9 +693,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
@ -668,20 +706,35 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
version = "0.3.76"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "which"
version = "6.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f"
dependencies = [
"either",
"home",
"rustix",
"winsafe",
]
[[package]]
name = "whoami"
version = "1.5.2"
@ -796,3 +849,9 @@ name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winsafe"
version = "0.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"

View File

@ -5,7 +5,7 @@ edition = "2021"
[dependencies]
clap = { version = "4.5.20", features = ["derive"] }
liblambdashell = { path = "../liblambdashell" }
libpse = { path = "../libpse" }
[profile.release]
strip = true

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 rhpidfyre
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,39 +1,39 @@
--!strict
type term_color_func = (string) -> string
local function rainbowify(str: string, color_map: {term_color_func}): string
local chars = str:split('')
for i, char in chars do
chars[i] = char ~= ' ' and color_map[i%5+1](char) or char
end
return table.concat(chars)
end
local function rainbowify_foreground(message: string): string
local parsed_terminal_message: {string} = {}
local color_map = {
return rainbowify(message, {
TERMINAL.OUT.FOREGROUND.RED,
TERMINAL.OUT.FOREGROUND.YELLOW,
TERMINAL.OUT.FOREGROUND.GREEN,
TERMINAL.OUT.FOREGROUND.BLUE,
TERMINAL.OUT.FOREGROUND.MAGENTA,
}
for i, char in message:split('') do
table.insert(parsed_terminal_message, char ~= ' ' and color_map[i%5+1](char) or char)
end
return table.concat(parsed_terminal_message)
})
end
local function rainbowify_background(message: string): string
local parsed_terminal_message: {string} = {}
local color_map = {
return rainbowify(message, {
TERMINAL.OUT.BACKGROUND.RED,
TERMINAL.OUT.BACKGROUND.YELLOW,
TERMINAL.OUT.BACKGROUND.GREEN,
TERMINAL.OUT.BACKGROUND.BLUE,
TERMINAL.OUT.BACKGROUND.MAGENTA,
}
for i, char in message:split('') do
table.insert(parsed_terminal_message, char ~= ' ' and color_map[i%5+1](char) or char)
end
return table.concat(parsed_terminal_message)
})
end
print(rainbowify_foreground("Rainbow foreground"))
print(rainbowify_background("Rainbow background"))
print(
TERMINAL.OUT.FOREGROUND.BLACK(rainbowify_background("Rainbow background with black text"))
)
print(
TERMINAL.OUT.BACKGROUND.DARK_GREY(rainbowify_foreground("Rainbow foreground on a dark grey background"))
)

View File

@ -0,0 +1,40 @@
--!strict
--scuffed fastfetch
--"rapidfetch"
local arch_ascii_art = [[
-`
.o+`
`ooo/
`+oooo:
`+oooooo:
-+oooooo+:
`/:-:++oooo+:
`/++++/+++++++:
`/++++++++++++++:
`/+++ooooooooooooo/`
./ooosssso++osssssso+`
.oossssso-````/ossssss+`
-osssssso. :ssssssso.
:osssssss/ osssso+++.
/ossssssss/ +ssssooo/-
`/ossssso+/:- -:/+osssso+-
`+sso+:-` `.-/+oso:
`++:. `-/+/
.` `/
]]
local BOLD, CYAN = TERMINAL.OUT.FOREGROUND.BOLD, TERMINAL.OUT.FOREGROUND.CYAN
local USER, HOST = BOLD(SHELL.SYSTEM.USERNAME), BOLD(SHELL.SYSTEM.HOSTNAME)
local IsArch = SHELL.SYSTEM.DISTRO == "Arch Linux"
if IsArch then
print(BOLD(CYAN(arch_ascii_art)))
end
print(IsArch and `{CYAN(USER)}@{CYAN(HOST)}` or `{USER}@{HOST}`)
print("-----------------------")
for name, val in SHELL.SYSTEM do
print(`{IsArch and BOLD(CYAN(name)) or BOLD(name)}: {val}`)
end

View File

@ -31,7 +31,7 @@ type SHELL = {
VARS: {string},
SET_VAR: (K: string, V: string) -> (),
CURRENT_DIR: {
FILE_NAME: string,
NAME: string,
},
},
PROCESS: {
@ -103,10 +103,13 @@ type foreground_styles = {
DARK_BLUE: (string) -> string,
}
type TERMINAL = {
WRITE: (string) -> (),
WRITE_ERROR: (string) -> (),
WRITE_ERROR_LN: (string) -> (),
OUT: {
BACKGROUND: background_styles,
FOREGROUND: foreground_styles
}
},
}
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------

View File

@ -13,7 +13,7 @@ pub struct Cli {
///Download and install plugin(s)
#[arg(long)]
pub add_plugins: Vec<String>,
//Remove plugin(s)
///Remove plugin(s)
#[arg(long)]
pub remove_plugins: Vec<String>,
///Start the shell with no rc configurations
@ -22,13 +22,16 @@ pub struct Cli {
///Disable the Luau JIT backend
#[arg(long)]
pub nojit: bool,
///Disable the Luau sandbox
#[arg(long)]
pub nosandbox: bool,
}
pub fn parser() -> Option<Cli> {
let cli_parser = Cli::parse();
if cli_parser.version {
println!("lambdashell, version: {}.", VERSION);
println!("liblambdashell, version: {}.", liblambdashell::VERSION);
println!("liblambdashell, version: {}.", libpse::VERSION);
return None //stop here
}
Some(cli_parser)

View File

@ -1,13 +1,17 @@
use liblambdashell::shell;
use libpse::session;
mod cli;
fn main() {
if let Some(args) = cli::parser() {
let shell_config = shell::Config {
let shell_config = session::Config {
norc: args.norc,
vm: session::VmConfig {
sandbox: args.nosandbox,
jit: args.nosandbox
},
};
let mut shell_instance = shell::LambdaShell::create(shell_config);
let mut shell_instance = session::Pse::create(shell_config);
shell_instance.start();
};
}