Big project dir refactor

* split into multi member workspace in preparation for a no_std core
* env and posix stuff neatly crammed into a seperate shell project
* some pokes at interactive-devel.f
* updated ci
* removed 'l' shortcut for 'load' and update docs
* remove out of date readme content
* updated tests
* more sensible cond implementation and extra tests
* substr stdlib function with tests

Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2024-07-10 13:22:28 -07:00
parent aa56570d7d
commit 6d2925984f
44 changed files with 967 additions and 779 deletions

View file

@ -10,24 +10,24 @@ This document outlines the ways that Flesh can be used as a shell for daily admi
For the most common uses (executing shell commands) a function is provided to find and load binaries from entries in the ~PATH~ variable. This function may be called either with ~load~ or ~l~.
#+BEGIN_SRC lisp
(load htop) ;; executes the htop binary, if htop is found on the users PATH
(l emacs) ;; executes the emacs binary, if emacs is found on the users PATH
(load emacs) ;; executes the emacs binary, if emacs is found on the users PATH
#+END_SRC
The load command takes an infinite number of arguments and uses the following rules to construct a shell command from them:
+ symbols that are not set are taken as strings
#+BEGIN_SRC lisp
(l emacs -nw) ;; 'emacs' and '-nw' not defined
(load emacs -nw) ;; 'emacs' and '-nw' not defined
#+END_SRC
+ symbols that are set are replaced by their values
#+BEGIN_SRC lisp
(l ls -la HOME)
(load ls -la HOME)
(let ((ping-count 4)
(domain "sunnypup.io"))
(l ping -c ping-count domain)
(load ping -c ping-count domain)
#+END_SRC
+ nested forms are evaluated
#+BEGIN_SRC lisp
(l cat (concat HOME "/notes.txt"))
(load cat (concat HOME "/notes.txt"))
#+END_SRC
Shell command evaluation rules apply to the following functions:
@ -53,9 +53,9 @@ In a shell such as Bash or Zsh, commands can be chained with the ~&&~ operator:
In these chains, if one command fails the next one(s) are not run. Colloquially, the command short-circuits. A similar construct is offered in Flesh called ~circuit~. Circuit will evaluate one or more forms (all expected to evaluate to either an integer (shell command) or a boolean (more general form). If a form returns false (or non-zero) no other forms are evaluated. The printed error message will identify where in the sequence evaluation was halted.
#+BEGIN_EXAMPLE lisp
(circuit
(l apt update) ;; if this fails, no upgrade is made
(l apt upgrade) ;; if this fails, "Success!" is not printed
(l echo "Success!"))
(load apt update) ;; if this fails, no upgrade is made
(load apt upgrade) ;; if this fails, "Success!" is not printed
(load echo "Success!"))
#+END_EXAMPLE
*** Command piping
@ -129,7 +129,7 @@ To launch a background process use the ~bg~ function:
To get all jobs in your shell use the system ~ps~ binary:
#+BEGIN_EXAMPLE lisp
(l ps)
(load ps)
#+END_EXAMPLE
To foreground a background process use the ~fg~ function:
@ -156,7 +156,7 @@ Daily Flesh users will long for first class shell commands that are accounted fo
A simple solution:
#+BEGIN_EXAMPLE lisp
(def lis 'shortcut for ls -la'
(lambda (dir) (l ls -la dir)))
(lambda (dir) (load ls -la dir)))
(lis HOME)
#+END_EXAMPLE
@ -196,8 +196,4 @@ With the ~implicit load~ feature any call to an undefined function will trigger
...... (redacted directory list) .....
#+END_EXAMPLE
Implicit load can be used by building flesh with the following command:
#+BEGIN_EXAMPLE
cargo build -F implicit-load
#+END_EXAMPLE
Implicit load is now enabled by default on any 1.0 build of flesh.