Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Peter Ammon
@ridiculousfish
Yeah, it feels backwards, huh. The syntax >file looks like "redirect the stdout stream to a file", but under the hood it's "throw away whatever stream is associated with stdout, and replace it with this file."
Streams don't have descriptors; a descriptor has a stream.
Aaron Gyes
@floam
hm
all streams have a descriptor, fileno() will tell it.
Peter Ammon
@ridiculousfish
By "stream" I don't mean FILE * which is just a libc thing, I mean the underlying kernel resource.
Aaron Gyes
@floam
maybe we could do something to make pipes and redirections more obvious, like highlighting the extent when the cursor is on the operator.
David Adam
@zanchey
ridiculousfish, that's a really interesting conceptualisation, had never occurred to me (but the backwardsness certainly had)
Subsentient
@Subsentient
How open is Fish to additional commands via a PR? In particular, I have some additions to the string subcommand in mind.
David Adam
@zanchey
we'd certainly consider them
if there's a lot of work involved you might want to open an issue to discuss the proposed design
Emily Grace Seville
@EmilySeville7cfg
How to scroll completion descriptions left/right?
David Adam
@zanchey
I don't think you can, you have to resize your window to see more
Emily Grace Seville
@EmilySeville7cfg
My screen sometimes is too small for some descriptions ;)
David Adam
@zanchey
yes, I know what you mean. we were trying to keep them fairly short for most commands but it's not always easy
Thom Chiovoloni
@thomcc
if exit is used in a function, is that the same as return (i assume not but it would be nice, although thinking more i can see many reasons why it shouldn't be)
i guess really what i want is an easy way to "print a message to stderr, and exit return a status to the caller". i find myself writing this often, and because i can't return from the caller (nor would i really want that) i can't really encapsulate it
Thom Chiovoloni
@thomcc
that said a significant portion of why i want this is despite having used fish heavily for years now, i have to look up the syntax for printing to stderr every single time
Fabian Boehm
@faho
@thomcc exit in a function executed inside the shell exits the shell. exit inside a script exits the script.
Basically it jumps to the nearest source.
Thom Chiovoloni
@thomcc
yeah, that does make sense
Aaron Gyes
@floam
@EmilySeville7cfg really, the descriptions are probably just too long; try to summarize them, we'll take the PR.
1 reply
let alone being able to read them in their entirety, it is very useful to make them all short enough to be displayed in 2 or 3 columns in at least a bigger terminal window
like, it literally adds a dimension, mannnn
Aaron Gyes
@floam
the completions must only indicate the functionality such that a familiar user can be reminded or an unfamiliar user somewhat guided; they need not be fully descriptive.
Aaron Gyes
@floam
@thomcc omg, sorry, I think I deleted one of your comments on accident. I was intending to reply.
Anyhow, I suggest make a feature request re: wanting an easier way to stderr a string.
there's even this family of functions in C, at least on BSD: it's not crazy
Thom Chiovoloni
@thomcc
hm
Thom Chiovoloni
@thomcc
fair enough. rust has eprintln too, and if you squint perror and friends are sort of similar. i dont know of other shells with it though. it does feel a little silly to request something like this when it's, like, literally only 3 characters away (even if they're basically impossible to remember)
Aaron Gyes
@floam
well, I did the same thing. When I could redirect all to stderr with ^ I felt more confident. I eventually did memorize them but it took years.
I'd be trying variations of 2&>1 1>2 &2>1 1&>2
that particular syntax just never felt natural.
living rent free in my homedir: some rando files named 1 and 2
Aaron Gyes
@floam
I had to chmod 000 1 & chmod 000 2 to make sure I wasn't fucking it up.
but my memory is weird.
Aaron Gyes
@floam
is it just me or is __fish_complete_suffix broken?
image.png
kaddkaka
@kaddkaka:matrix.org
[m]
When can I expect an impish release of fish? (https://launchpad.net/~fish-shell/+archive/ubuntu/release-3/+packages)
oooh, there is an impish release, but the file is named hirsute
Subsentient
@Subsentient
Can someone explain to me how the "or" modifier executes at all when it's not part of the conditional itself, but rather a member of the block to execute? That block should never be entered because the first test condition just failed, so how is "or" working?
Fabian Boehm
@faho
@Subsentient You might have more luck with some example code.

In lieu of that, here's how or works:

In the simple case:

foo
or bar

if foo failed, fish moves on to the or, which checks $status. This is similar to

foo
if test $status -ne 0
    bar
end

This is all very easy and fine and dandy, there is however a special case. In if or while conditions, the or binds the command to the condition instead of going into the block:

if foo; or bar
    echo hello
end

will print hello if foo succeds, and will also print hello if foo fails and the subsequent bar succeeds. If both foo and bar fail, it won't print.

This isn't 1000% clean, but the alternative of making or just that simple shortcut is that you now need to write

if begin; foo; or bar; end

which is just annoying (and yes, that used to be the case up to fish ~2.3)

Fabian Boehm
@faho

I'm assuming you meant the latter by "member of the block to execute", and so the answer is: Because it was annoying otherwise, so we changed it.

Because the other behavior might be "clean" from a theoretical standpoing, but also 100% useless:

if foo
    if test $status -ne 0
        bar
    end
   echo hello
end

Here, to get to the bar, foo would have to fail. But once it fails the if-block won't be entered anymore, so that bar is unreachable! It can't be used! It's dead!

Subsentient
@Subsentient
Damn, I really, really don't like that. Just a suggestion, but if it were me, I'd deprecate that usage of or in an if conditional with the semicolon preceding, and either A. Add documented syntax for 'or' used there without a semicolon, or B. move to || as the supported method. >.<
Subsentient
@Subsentient
I do want to say, however, that I'm very appreciative of Fish shell. Please make sure that this project flourishes. I never liked old shell script, too many bizarre edge cases and strange behaviors. With Fish I'm finally comfortable writing complex shell scripts without feeling that sinking feeling that something somehow isn't quoted or escaped properly.
Bash is better but still terrible
POSIX shell script is nearly unusable for me
Subsentient
@Subsentient
Only pet peeves I have are A: The "or" thing which feels bizarre and likely to cause trouble, and B: the autocomplete is a bit unpredictable what it will do when you hit a given tab or -> key.
Aaron Gyes
@floam
the old behavior with bow it worked with begin, end could get tricky to wrap ones head around when you started chaining several conditionals together. It confused a lot of people, I'm afraid we won't be going back.