toad.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server operated by David Troy, a tech pioneer and investigative journalist addressing threats to democracy. Thoughtful participation and discussion welcome.

Administered by:

Server stats:

206
active users

#nushell

0 posts0 participants0 posts today

Can we please have one standard way to define shell completions, that is compatible with all shells?

I'm moving from zsh to nushell, and it's relatively new, and you have to configure completions by writing a lot of code, including a lot of files, it's a nightmare.

It's easier for older shells like zsh or fish only because other people already done it, and some packages include per-shell completions.

There is @carapace_sh which attempts to do the right thing, but having completions in the other place than actual app is not very good idea.

usage.jdx.dev/ is trying to do the same but differently, and it has a way for an app to provide a schema for completions. This is step in the right direction, but not many tools support this.

Has anyone tried to put this somehow on the shell level? E.q. app includes a file like `myapp.completions` , and shell have a module which reads the file and generates a list of completions based on user input.

The right way to do this, is probably by defining a standard cross-platform/cross-shell schema. And it can be read by the shell, or by the tool like carapace or usage...

usage.jdx.devUsageSchema for CLIs
#Linux#zsh#bash

Experimenting with #Nushell (nushell.sh) a bit, inspired by @mitchellh, especially that I

I always liked #PowerShell concept. Sticking to a 50 year old textual shell concept seems quite ridiculous today. But well, that's the power of long-time conventions & potential compatibility issues.

#Nushell seems to be a little bit "lighter" version of #PowerShell concept, but cross platform. I'm nerdy curious about it 🤓

www.nushell.shNushellA new type of shell.

I have most of a decent blog post written, but the final bits aren't satisfying. So of course I'm puttering with #Nushell, which is not part of the blog post. Keeps me entertained while the rest of my brain works out the important stuff.

Hello world! This is a human-maintained account for Nushell. Thanks Hachyderm for hosting us.

One way to introduce Nushell is using three "pillars" that form the core of the project:
1. Shell
2. Programming Language
3. Structured Data

1/N #nushell

I really enjoy #powershell in many ways. Its #objectpipelies are powerful and expressive, it seamlessly interfaces with a plethora of platform APIs, and its syntax is discoverable with incredibly rich tab completion and help on the command line or web.

I would love to find some way to bring these concepts to *nix for folks who might not be able or willing to switch to specialized shells like #nushell or #elvish. Both projects are amazing but I honestly can't afford the time to rewrite the rich functionality I get from zsh /oh my zsh/plugins.

Maybe when I retire :) Come to think of it, building similar functionality in nushell/elvish to what I have now would be a delightful rabbit hole to dive down. I think I shall put it in my "Shower Ideas" @obsidian note for future inspiration :)

(For example, the #tmux plugin in oh my zsh has a setting to ensure that only one instance of tmux runs no matter how many shells I open.)

Continued thread

And then I had to let #Nushell drive the #Pandoc batch processing because of course I did.

(tell pandoc to process every JSON file in the cache folder to a corresponding Org file in the out folder)

let $format = "org"
ls cache/*.json | insert target {
$in.name | path parse | upsert extension $format | upsert parent "out" | path join
} | each { pandoc $in.name -o $in.target }

Parsing some structured text (because I decided it's easier than untangling the code which generated this text) and getting an idea of the complexity and what granularity I should be thinking about by counting lines in each section.

A little #Nushell one-liner to examine the JSON output of my Perl script.

(
perl main.pl
| from json
| insert line_count { |it| $it.lines | length }
| get line_count
)

Hm.

I may want to do finer granularity than "section."