Lurker News
I built this terminal native runtime for Fig's autocomplete to support Windows and Linux. Would appreciate any feedback on it!

Comments (148) 33 threads

suavesito#
It doesn't work on Windows either... at least by a comment in the issue. I don't have Windows.
monkellipse3 replies#
Great idea! Also terrifying :) Given how often I accidentally commit the wrong text in vscode, I shudder to think of the damage I could do with this on my shell, hah! What safety measures are there/could there be?
biellls3 replies#
A simple approach might be that if the resulting exit code is not 0 it won't be used to complete in the future.
Eavolution#
That'd have the problem of tools like grep returning nothing, having an exit code of 1, but being a perfectly valid thing to suggest in the future.
starttoaster#
When you're writing, building, and executing code, I would not expect a 0 exit code every time.
KRAKRISMOTT#
The fish approach
owlstuffing2 replies#
Generally, a destructive shell command prompts for approval. But I suppose overfumbly fingers could still cause grief.

Type/command aware tooling is a night and day difference.

mksybr1 reply#
Generally? Do you have examples in mind? The ones I think of are destroy first and ask questions only if told to do so: mv cp rm redirection tee
owlstuffing#
Yeah, you’re right. I was thinking of overly destructive commands eg. reformat etc.
tombert2 replies#
I feel like I've trashed millions of files I shouldn't have with `rm` and trying to be clever with regular expressions.
doubled11221 replies#
I've done this enough times I use `ls` first, then `rm`

Continue this thread — 21 replies

teddyh5 replies#
Note: Normal shells use glob(7) expressions, not regular expressions.

Continue this thread — 5 replies

graypegg#
I don't know how painful it would be, but I think I could adapt to a short delay of maybe 50-100ms where the shell won't respond to Return presses, only after accepting a completion. Just long enough ideally to make me re-read what I entered.
Too4 replies#
This is cool.

What is sad is that it has to rely on a library of completion specs. It shows what kind of stone age foundations we are building on top of. The world would have been a much better place if CLIs themselves defined strict interfaces using standard data structures. Not only for auto completion, also gives much more accurate error checking of bash scripts. Same goes for data piped in and out of command.

runeks2 replies#
> The world would have been a much better place if CLIs themselves defined strict interfaces using standard data structures.

Well it's not too late just yet.
How about if all CLI exes had an option, say --dump-cli-options, that wrote out a spec of the supported commands/flags/options?
Something like e.g. Python's argparse should be able to effortlessly spit out this info (and the same for other similar argument parsing libraries).

runeks#
And we would also need an options that does CLI argument parsing only, and either returns an error related to parsing one or more options or "ok".

This could be used to do "form validation" of CLI args as they're typed in the shell.

hahn-kev#
Lots do it's called help. But then they would all have to use the same spec, which we know would never happen.
erezsh1 reply#
It's sad. If the world of software had better coordination and cooperation, we would be able to get so much more done. Instead we're constantly dumping and re-parsing the same data, re-implementing the same protocols and algorithms in dozens of different languages, each time with different quirks. Fixing the same bugs again and again.
Eisenstein#
All we need is something that will tell us who is right and then impose that vision on everyone.
pests#
Like PowerShell?
delta_p_delta_x#
To do this, you'd have to have some sort of common runtime, and nearly all command-line utilities would have to be compiled with said runtime, so that the parameters, names, and types of parameters for said utilities could be returned, parsed, and verified as a data structure, without having to manually parse the output of some `command --help` invocation.

It would thoroughly dispense with the whole argument parsing routine in the first place, which could now be done in a standardised manner; arguments could be defined as strict types with possible values limited to a set, and best of all, they wouldn't just be a dictionary/hash-map of strings to strings—the arguments could actually be named variables with values, in the context of the called utility.
It would certainly be quite a powerful shell, and I'm sure something similar has already been done. I just can't think of an example..... A Powerful shell, running on some Common Language Runtime; I wonder what it could be.

Load more comments