help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

request for feedback, xbl fs2bash thing


From: Alex fxmbsw7 Ratchev
Subject: request for feedback, xbl fs2bash thing
Date: Sat, 11 Dec 2021 01:20:04 +0100

im currently recoding it, i need input, its reverse of properitary

xbl v7, xmb bashlink, aka fs2bash
embeds file content by its path and name, as functional bash code
all one-letter shorts represent the first letter of their function, im not
interested in their 'longer' form


xbl7/xbl
xbl7/xbl.gawk
xbl7e/

xbl [<project dirs>]
./xbl [<project dirs>]
bash xbl [<project dirs>]
. xbl [<project dirs>]

./xbl and bash xbl ( or path to xbl, like xbl7/xbl ) should do the same,
run in a new bash
. xbl or source xbl do run my code in the current ( hopefully new and
present ) bash session
if its already been loaded, by ., or by adding its xbl7/b to $PATH it can
also be accessed directly just like 'xbl' without ./ or . or so

there are few variables that tell xbl something instead of none
xblp= sets to not execute but cat the code, the content of this var isnt
checked, only its presence
xblo=<file> sets file to outout the code to specified code, rather than run
or alike to terminal cat

variables, to bash, in sense if the above, can be done by specifying
either(s) before the . or bash command

for example
make out of the small files in xbl7/** the xbl7/xbl script as xblnew there
xblo=xbl7/xblnew bash xbl7/xbl

or show the code of the simple demo ( from the xbl7e extras dir )
xblp= . xbl7/xbl xbl7e/xbldemo


big_project_consists_of/many_small_things

it creates, either executes or prints ( optionally to a file ), code
defined as single element parts from files in <supported> dirs regarding
few internal and few external bash ( https://www.gnu.org/software/bash/ , i
suggest herewith bash.gnu.org plz ) features
actually it uses gawk code that formats the bash code, for speed purposes

in variable dirs, dirs alone without files mean nothing excepts for declare
-opts/ nothing, in -opt/ they get stacked up for
as-less-executions-as-possible, then later passed along ( naybe existing )
other args as one assignment command
empty functions are enhanced as ':' being its only command

remember when editing var files to remove the trailing end of line newline,
i have for this b/rmneol <files> , excepts you want all your aliases and
variables and who knows what more to (invalidly) end with a newline instead
of <nothing>
the background know is, some stupid outdated invalid text definition
requires alike all editors to end every file with a non user typed newline,
.. which makes 1:1 data passing impossible
i had a .vimrc fix for me, ill include it in the extras dir ( xbl7e ) if i
find it

example
f/atest         reults in defining a function 'atest' with the files
content as function body
a/'a test'      results in an alias named 'a test'

slashes in betwwen, after all functional definition dirs, are coded as part
of the current objects name ( till end of filename )

f/a/test        will result in function named 'a/test''

generally, the dir structure parsing is <type>/[optional available
mods]/name_of_specific_thing

sometimes the name appears somewhere in the resulted code, as object name,
or in cases it doesnt get used, like with ~/ eval dir, where just the
content is used
sorting is done with sort -n'ing finds found files
hashing is done for later faster executement, in form of a cksum hash per
detailed find results, if found, it cats ( to either '.' , cat ( to
terminal, swy ) or an output file  the corresponding to the hash
already-code-printed text, rather than trying to make it up first


xbl's runtime is around simple
1. find args 2. to hash 3. if found cat or 4. process find results with the
gawk code


supported is
d8r/    explaintion

b/      gets linked to $PATH, stands for 'bin' dir

r/      if present, cd into this dir before all other code ( excepts o/-/ )
as root meant

~/      exec/print code
~/-     prefix
~/+     sruffix

-/      'set' options
-/-/    enable
-/+/    disable

--/     shopts
--/-/   enable
--/+/   disable

=/      define vars, default is in single quotes ( ' )
inside the vars dir there a few, optional, max once to use, parsing
subdirectives ( as comolete dir name only, and not after not-so )
  ~     defines var without quotes
  '     in single quotes ( default )
  "     in double quotes
  `     im backticks ( exec )
  $(    in $( and ), as `, execute
 [0-9]* for sorting, lower number gets firstly coded, then the non numbered
are
-[a-Z]* pass to declare as arg, eg mark name assoc ( -A )

variables, for speed purposes are first ( if defined ) `declare`d, then as
one other assignment-only command stacked up, and passed

f/      function

a/      alias

k/      keywords eval system ( 'xblkws' function , 'keywords of devision
xbl' )
keywords are then the args each, given to xblkws, and if one matches a
defined one it executes its corresponding code
there are few possibilities possible with it.. for one 'every data excepts
the \0 byte' can be defined different codes, the kw, 'kwskw'
then there is the 'takes', that defines how many following args this kw arg
consumes, defaults to 0 ( :null: ) excepts redefined as same keyword inside
K/t/<kw> ( kw override / takes / that specific keyword ) or same in that
it sounds more complicated than it has to be, due to my english
it makes it easy for short passthru options code.. de

n/      namespace to keywords, first dir is namespace name, rest is keyword
for use with xblkwsns=name xblkws
soery i try to separate all for any fresh coding by prefixing xbl to my
stuff to make the stuff transparent

t/      define traps ( trap signal as filename )

o/      output to file used only
o/-     prefix
o/+     stuffix


reply via email to

[Prev in Thread] Current Thread [Next in Thread]