Native shell?

Re:Text-based Scripts

Differencing of binary formats, as well as their application in Git and other text-based dependencies of diff, need to be developed separately in order to make a successful project. There are textual tools like Scintilla that exist for today’s technology levels but as advances in version control improve, as well as a binary alternative to GNU DiffUtils, then we can use that.

I want to keep development in stages so that it will be easier to gauge progress and also to complete smaller tasks as a managible means to the end instead of one big task. It’s as the saying goes: “Rome wasn’t built in a day.”

Re:Hosting on Codeberg

Microsoft uses their ownership of GitHub to train A.I. but doesn’t follow the license terms when applying that A.I. Looking forward to the day that it all collapses like a house of cards, it is just a precaution to excape some notice of Microsoft and their respective cronies in office. Also, Codeberg is a German organization hosted in Germany. The privacy laws there are strong. In America and Australia the data privacy laws are weak if even any are in existence.

Re:StreamWeaver

StreamWeaver is a start but it only abstracts STDIN and STDOUT by improving pipe notations. Posix style pipes are handy for some things but not everything. Also, I wasn’t able to find a link on the StreamWeaver site to source code or a 64-bit version. I’ve seen similar stream routing utilites in other low-code and no-code solutions so maybe that can be arranged.

1 Like

Some ideas about a new format.

Define new numbered file descriptors we use for this protocol.
For example, randomly pick fd 200.

define a format which transfers data, and is presentable with a “fancy” gui.

If needs be this is text based, I guess.

Requirements:

  • Length headers to eliminate escaping
  • a format with named parameters, to allow clients to ignore stuff they don’t understand

possible example: {5stream:5error7content:22An error has occurred!}

Could be displayed in a gui like (in red)

An error has occurred!

Sure, I’ll help you with this if you want.
My account at Codeberg is nipos, too.
I’m not so experienced with coding in C++, however.
I’ll see what I can do, maybe you can give me some easier things to start with.

The data interchange format does not need to be text.

There can be a text representation (with escaping) and a binary format, too.

I don’t see anything new to define here? We have ports. We have BMessage and we can already archive anything we want (including complete BView hierarchies).

Not a great start: how do you make a string that starts with a number? We have a problem here:

{1611 files copied.}

I’m sure there are formats that already solve this problem?

1 Like

Probably?
I don’t know of any, if there is prior art that would be nice to know.
However communicating with BMessage over ports is fine, this was in relation to your comment above that you’d not use any format that isn’t text for sourcecode. Since the way applications pass data, and the shell forwards them is the same I assumed this was related to just that, as you had not specified above.

Are you sure about this? Or are you just way more familiar with bash and other UNIX shells than with powershell? As an interactive shell I have no issues with bash but for scripting I still find it a major pain in the a**, even after 20+ years of using it. Powershell on the other hand was quite easy for me to get into, it’s not perfect but I think Microsoft did a pretty good job with it. Especially being able to pass objects through a pipe instead of plain text (and having to cut or sed to get the parts I want) is a feature I miss on UNIX shells.

This would be very cool to have in a next gen Haiku shell. Image to do an “ls” (or whatever the command to list files in the new shell would be) and get back a list of BEntry objects instead of just plain text. Some along the lines of powershell but with BeAPI instead of .NET objects.

1 Like

StreamWeaver looks quite similar to Commando in A/UX:
image

It’d be great to have something similar for Haiku, as it would help people unfamiliar with terminal utilities with using them. Haiku is already fairly GUI-focused, so a graphical helper for CLI tools would naturally fit in.

4 Likes

Welcome to the documentation team, @nipos .

1 Like

No … not really. My motto is ‘Use the right tool for the job.’

As an IT professional, I cannot afford to be prejudicious when working in heterogeneous IT environments. Since PowerShell has greatly improved since the days of Windows XP and now has garnered and still gaining popularity as a window’s shell. What makes it powerful is its history with VBScript (like MS Access using VBBasic as it programming language) that makes it very useful and adaptable to IT needs. M$'s goal in updating PoSH to better manage all aspects of its M$ products from the command line is good–something they learned from incorporating WSL (IMO), which leads me back to bash.

But every shell has its pro’s and con’s, I choose the best utility to do that job. It could be bash, csh, zsh, Command Prompt, Command Prompt with cygwin using Unixtools, or Powershell.
As compared to early years in my IT career, IT has come a long way and we are enjoying the plentitude of useful utilities to make our work easier!

As for bash, Unix/Linux users can manage their systems very well–textually. Now, there are days that I wish I could skip a step and use a construct like this:

find “$(pwd)” -type f -not -path ‘/.’ | grep “.mp3” | boot/system/apps/StyledEdit > ~filelist.txt

That would be cool

Where bash/shell has system-level extensions to allow interactions for OS objects/utilities in Haiku…and this is what this thread is about. Keep going…some good stuff.

1 Like

After reviewing the current YAML spec, I’m now inclined not to use it or any derivative. It’s presently a shorthand for JSON. If I was going to use a JSON derivative for code I’d just use Node.js and JavaScript. The only reasons to do something like that would be to build it into a web-view or use web technology some other way.

Also, to make a simplified C++ syntax would fall into the purvue of CppFront or Carbon which aren’t finished yet.

This is making me think twice about text parser formatting. Maybe something custom would be better. Some PEG parser generators return string lengths of parsed lexemes which would add transparency to the escaped text.

I just need a working Haiku!

1 Like

Ok, Bruno, how do you make it work? Do you do any scripting or programming? If not, this project may help you.

Have you looked into TOML by any chance?

Toml files are used to send data to build systems such as those used by Rust and Zig, I think. They are used in that respect frequently and well.

The trick would be defining executable function data as a superset. Maybe setting it up as a stand-alone macro-processor with friendlier syntax than M4 but with preprocessor functionality for interpreted executuion and such would be a possibility.

Thanks for the idea. That might work. I’ll look into it farther.

I had an idea similar to this topic, that I was calling a “Server Space”, like user space or kernel space.

What if the whole point of these scripts was to generate interactive, and highly capable web apps?

Bringing applications together, perhaps there could be an API to make it easy to export functionality to a piping-oriented approach.

I am not trying to own this idea… but think that this whole topic transcends my idea. I think what is being imagined is awesome!

While looking into the TOML parser, I was reminded of a similar scripting engine called Lua that could be used to supply the bytecode and runtimes. While browsing the repositories for a C++ friendly Lua derivative, I came across Luau, a C++17 based Lua derivative named after a Hawaiian outdoor feast. (It is also used internally by the Roblox game engine.)

@dorje
I’m not sure what kind of server space is possible without BeFS running on the server because I want filesystem queries integrated into the runtimes. Maybe if the BeFS Fuse filesystem support is complete on Linux or BSD, it’ll be possible. (I don’t think online security is there on Haiku-based servers yet.)

@Androsio
Thanks for your tip in private message!

@Thread
After doing very little searching for a visual programming environment called Drakon, I not only found it but see that it is self-hosted with a TCL backend. Though it originated in the Soviet Union’s space program, it now has a Lua backend that can be modified. This means that once I get the new runtime library written for a Luau based script engine, I can make a generator for it and make Drakon recompile itself. As clunky as it seems, Drakon’s self-hosted environment is based on a SQLite3 binary file format.

The Tentative Plan

  1. Add the Haiku runtime library to Luau.
  2. Modify the Lua generator of Drakon to generate Luau using the new runtime library.
  3. Modify a fork of Drakon to use the new Luou script engine as its backend, recompiling it to use its new editor and runtimes.
  4. Improve and streamline the design. (Make the generator output a cacheable bytecode file based on the Luau bytecode?)

I’m not sure how clunky this may turn out but that old Russian code is very lightweight for what it is. There are instances of it having been modified to run in the browser even. The hardest part will be to change the flowchart renderer to instead use a tree gadget and simpler representation of the code.

Another thing I’m concerned about is that I’m not sure how to use journaling from within SQLite3. Does it act like a live version control system? If not, what would it take to add that?

It’s time to head back to bed for now. I’ll catch up to you later!

1 Like

This is exactly what i’d like to leave behind. This is intuitive only for those who used unixen earlier. I dont want flamewar if the unix philosiphy is right or wrong, i just want to eliminate it or redesign it.

Let me explain how i imagine accomplishing the same task what you have described in Hash:

  • You open the hash / terminal/ whatever.
  • A window shows up which either lists your files and folders in $Home graphically or not.
  • You type “ls” or its analogues, like “list”.
  • A filelist shows up in a spreadsheet format, the output of the command is tokenized and chopped up and displayed in cells, like:
Filename | extension | size | attributes
  • You click on the extension header and select the filter option. A popup window shows up with 2 tabs, basic is the default, where you can filter with string matching (is contains), while advanced lets you use more fancy filtering, like regexes
    -You type the matching string into the box : mp3
    Now the gui shows 2 boxes connected with a line like in cortex:
    [ ls ] ---------- [ filter ]
    And the output of the ls command updated realtime.
    The boxes lets the use modify the filtering all the time and the chained boxes lets add additional modifiers (pipes).
    It is basically a recreation of the unix tools with gui in mind and with a possibility of going back and doing changes ad-hoc.

The chain graph could be saved for later reuse.

2 Likes

UNIX is not a philosophy, it’s just an operating system :slight_smile:

Looking at it this way, we can easily see that there are two levels to what it does:

  • The low level is the idea of “pipes” as way to send things from the output of a program (or let’s say “task”, it’s more generic) into the input of another
  • Then there is the high level, the shell as an user interface

I think the low level side of this is reasonable and works well. It can be improved, maybe by having a way for applications to negotiate a format for the data they’re going to exchange. On UNIX there isn’t really a way to do this, and so, things kind of standardized on the lowest common denominator: text files, maybe with csv or similar simple formats.

The high level user interface is not so great for discoverability and maintenance. But it can easily be removed and replaced, because UNIX is modular.

Now, we can also throw in some of our existing technology: BMessages (a structured way to exchange data in binary form), MIME types (removing the limitation to text only since we know what format each thing can handle), translators (to convert one MIME type to another), scripting/‘hey’ to discover what an application can do.

We already have one example where we do this succesfully: drag and drop and clipboard maangement. These involve MIME types, BMessage, and possibly translators.

Now, looking back at UNIX and its shell based user interface, there is one thing it excels at: that is having a very close relationship between the interactive user interface (the shell) and the automation (shell scripts). However, this comes at the cost of having a less friendly user interface, and a not very structured automation/scripting system. I don’t know if this issue can be solved. If we make things more comfortable to automate, will they be less friendly to use interactively? If we make them easier to use interactively, will they be less convenient to automate? (Windows goes in the latter direction, it is very GUI centric and sometimes you have to do a hundred of repetitive mouse clicks when you could have used a simple script). Or maybe you end up with both an easy to use interface and a great scripting language, but a wide gap between the two, which means users don’t pick up scripting so much.

Can we solve this? Well, certainly we have a lot of interesting tools to try to build something and already some ideas how it could look like :slight_smile:

4 Likes

The Unix philosophy is to have multiple small programs that do only one thing but do them well. This leads to fragmentation and the mess that is today’s Unix/Linux. It is all by design, meaning it was designed to not function. I could support that statement with facts but if I did this comment would instantly be reported since truth is not protected in this forum.

BeOS did the opposite. They designed a cohesive system.

Please do not follow the Unix way. It will destroy what is good about Haiku.

2 Likes