rphln 3 days ago

There's already `ls --hyperlink` for clickable results, but that depends on your terminal supporting the URL escape sequence.

2
db48x 3 days ago

This is nice, but a poor substitute for what Genera was doing.

You see, Genera knows the actual type of everything that is clickable. When a program needs an input, objects of the wrong type _lose their interactivity_ for the duration. So if you list the files in some directory, the names of those files are indeed links that you can click on. Clicking on one would bring up a context menu of relevant actions (view, edit, print, delete, etc). If a program asks for a filename as input then clicking on a file instead supplies the file object to the program. Clicking on objects of other types does nothing.

petesergeant 2 days ago

> Genera knows the actual type of everything

I have this side-project fantasy of a very simple terminal pipe-types project. The basic idea is a set of very basic standardized types, demarcated using escape sequences. Dates, filenames, URLs, numbers, possibly one or two number units as well (time periods, file sizes only).

Tools that already produce columnar data (ls) get a flag that lets them output this format, and tools that work with piped data (cut, sort, uniq) get equivalents or modes that let them easily work with this.

Essentially, simple typed tables held in text, with enhancements for existing tooling to know how to deal with it. Would make my day-to-day on the command line much easier.

leafmeal 2 days ago

I think PowerShell works this way essentially. As I understand, all data is structured which makes formatting and piping to other programs much simpler.

db48x 2 days ago

Could be fun :)

But note that on the Lisp Machine/Genera, every type has a presentation and can be “printed” to the REPL. This includes any new classes that you create as part of your own programs. It’s not just a small list of standard types, but every type.

The standard tutorial for the system is to implement Conway’s Game of Life. It has you create a class to hold the game board and then guides you through the process of defining a presentation for it so that the it can be displayed easily.

svieira 2 days ago

Arcan is experimenting with something like this (among others): https://arcan-fe.com/2024/09/16/a-spreadsheet-and-a-debugger...

See also:

* NuShell (https://www.nushell.sh/)

two_handfuls 2 days ago

nushell goes in that direction. Programs can output tables, and the shell (or other tools) know how to work with this structured data.

loa_in_ 2 days ago

I always thought to do that by having a virtual file system that tags my files and so they are available at specific location if they fit the bill.

ramses0 2 days ago

https://kellyjonbrazil.github.io/jc/docs/parsers/ls.html

...glom on to this: "+JSONSchema" with some sort of UNIX-ish taxonomy. Everything from `man test`, add in `man du`, `date`, `... ago` (relative time) as you'd mentioned.

`jc ls | add_schema...` => `jq ...`

...or `jc ls --with-schema | jq ...`

(it appears as though `jc` already supports schema's, so perhaps it'd be `jc ls --with-types` or something, but there's your starting point!)

petesergeant 2 days ago

That's neat and a similar idea. I think JSON probably ends up being too expressive (not just an array of identically-shaped shallow objects), too restrictive (too few useful primitives), and also too verbose of a format, but the idea of a wrapping command like that as a starting point is neat

ramses0 2 days ago

I'll share this comment from 7 months ago with you:

https://news.ycombinator.com/item?id=40100069

"prefer shallow arrays of 'records', possibly with a deeply nested 'uri'-style identifier"

...the clutch result is: "it can be loaded into a database and treated as a table".

The origin of this technique for me was someone saying back in 2000'ish timeframe (and effectively modernized here):

    sqlite-utils insert example.db ls_part <( jc ls -lart )
    sqlite3 example.db --json \
      "SELECT COUNT(*) AS c, flags FROM ls_lart GROUP BY flags" 
    [
      {
        "c": 9,
        "flags": "-rw-r--r--"
      },
      {
        "c": 2,
        "flags": "drwxr-xr-x"
      }
    ]
...this is a 'trivial' example, but it puts a really fine point on the capabilities it unlocks. You're not restricted to building a single pipeline, you can use full relational queries (eg: `... WHERE date > ...`, `... LEFT JOIN files ON git_status...`), you can refer to things by column names rather than weird regexes or `awk` scripts.

This particular example is "dumb" (but ayyyy, I didn't get a UUOC cat award!) in that you can easily muddle through it in different (existing pipeline) ways, but SQL crushes the primitive POSIX relationship tooling (so old, ugly, and unused they're tough to find!), eg: `comm`, `paste`, `uniq`, `awk`

thaumasiotes 2 days ago

Tab completion has developed some similar features. I've seen shells that will only autocomplete what seem to be appropriate choices.

ptspts 2 days ago

I typically turn this off. Many times it's too slow, and many times it hides local filenames, and I do want local filenames.

Rendello 3 days ago

That's one aspect I prefer in playing with TempleOS over Linux. The rest of the command line is a bit of a pain, with no history, C-as-a-shell, etc.

westurner 3 days ago

  $ man ls | grep '\--hyperlink' -A 1
  --hyperlink[=WHEN]
         hyperlink file names WHEN