Commit Graph

18584 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
99bd2e71d0 Unify how file mode is specified
The lines of code I commented on in #10254 were meant to serve only as examples
of the changes I was requesting, not the only instances.

Also just use `Mode::from_bits_truncate()` instead of unsafe or unwrapping since
we know the modes are correct.
2024-01-28 18:09:52 -06:00
Fabian Boehm
6877773fdd
Fix build on NetBSD (#10270)
* Fix build on NetBSD

Notably:

1. A typo in `f_flag` vs `f_flags` - this was probably never tested
2. Some pointless name differences  - `st_mtimensec` vs
`st_mtime_nsec`
3. The big one: This said that LC_GLOBAL_LOCALE() was -1 "everywhere".
   Well, not on NetBSD.

* ifdef for macos
2024-01-28 21:45:14 +01:00
Mahmoud Al-Qudsi
45285b3870 Refactor error handling in binary_semaphore_t 2024-01-28 12:43:53 -06:00
Bartłomiej Maryńczak
2ca102193c
Statically type binary_semaphore_t mode of operation (#10272)
* Cleanup binary_semaphore_t by removing `sem_ok_` checks

* Fix unused import on non-Linux platforms

---------

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-01-28 12:21:15 -06:00
Fabian Boehm
a03162bd5b Update dependencies 2024-01-28 14:23:16 +01:00
Fabian Boehm
aa5649ca99 Add # as a path component char
Fixes #10271
2024-01-28 10:41:15 +01:00
PolyMeilex
05ac1b770c Use AsFd for maybe_lock_file 2024-01-27 20:42:13 +01:00
PolyMeilex
341fd7ca16 Revert to octal mode repr in autoload and io 2024-01-27 20:42:13 +01:00
PolyMeilex
6ef8125c96 Return OwnedFd from open_cloexec 2024-01-27 20:42:13 +01:00
PolyMeilex
2512849ece Use nix OFlag for open_cloexec 2024-01-27 20:42:13 +01:00
PolyMeilex
6915aeb44c Use nix mode for open_cloexec 2024-01-27 20:42:13 +01:00
PolyMeilex
23301e4895 Return Result from wopen_cloexec 2024-01-27 20:42:13 +01:00
bitraid
86afc7832d Call fish_vi_cursor_handle also for interactive read
Not doing this results in the cursor not being initially set for `read`.
2024-01-27 20:13:47 +01:00
bitraid
a5dfa84f73 fish_vi_cursor: skip if stdin is not a tty
Instead of skipping for non-interactive shells, skip when stdin is not a tty.
This allows the cursor to be set for scripts that use the `read` command.
2024-01-27 20:13:47 +01:00
Johannes Altmanninger
33a9659cd1 Fix stale name of --tokens-expand option
Missed in 368017905 (builtin commandline: -x for expanded tokens, supplanting
-o, 2024-01-06).
2024-01-27 20:09:33 +01:00
Fabian Boehm
1deb065f59 build.rs: canonicalize CARGO_MANIFEST_DIR
We use this so you can run fish from the build directory and it picks
up its data files.

If this wasn't canonicalized, that would break if you're building with
a $PWD through a symlink.
2024-01-27 20:00:10 +01:00
Daniel Bretoi
6f797ac958
Update just.fish to handle descriptions for completions (#10260)
* Update just.fish to handle descriptions for completions

This change updates fish completions to also include descriptions for justfile recipes. It has been tested with descriptions for recipes with arguments as well

* rely on fish only (avoid sed)
2024-01-27 18:58:24 +01:00
Fabian Boehm
3914bbe538 Remove use of env -u in tests
Not available on NetBSD.

We can get by without.
2024-01-27 18:47:38 +01:00
Fabian Boehm
677e4ff698 anypython: Add more versions 2024-01-27 18:47:38 +01:00
Fabian Boehm
c735dafb98 tests: Exit early if python is missing for littlecheck 2024-01-27 18:47:38 +01:00
Fabian Boehm
019a082d5d Remove unused import 2024-01-27 18:47:38 +01:00
Johannes Altmanninger
9a1226684e Fixup formatting 2024-01-27 18:08:02 +01:00
Johannes Altmanninger
37c380d885 completions/git: add send-email 2024-01-27 17:57:48 +01:00
Johannes Altmanninger
b768b9d3f5 Use fuzzy subsequence completion for options names as well
Version 2.1.0 introduced subsequence matching for completions but as the
changelog entry mentions, "This feature [...] is not yet implemented for
options (like ``--foobar``)".  Add it. Seems like a strict improvement,
pretty much.
2024-01-27 17:57:48 +01:00
Johannes Altmanninger
033f64fde6 Fix indentation in bitflags macro 2024-01-27 17:57:48 +01:00
Johannes Altmanninger
623ad21b47 Remove code clone in completion insertion 2024-01-27 17:57:48 +01:00
Fabian Boehm
1e5a585875 builtins: Remove some uses of .unwrap()
.unwrap() is in effect an assert(). If it is applied mistakenly, the
program crashes and there isn't a good error.

I would like it to be used as a last resort. In these cases there are
nicer ways to do it that handle a missing result properly.
2024-01-27 16:06:36 +01:00
Jason Nader
28d9f1878d completions: fix wg-quick interface completions
wg outputs space separated list
2024-01-27 11:40:57 +01:00
Johannes Altmanninger
5f459446a8 functions/funced: harmonize interpretation of VISUAL/EDITOR
Like other tools, we split $EDITOR by spaces and remove backslashes in Alt+e
and Alt+o but not in funced. Let's' fix this inconsistency.
2024-01-27 09:38:51 +01:00
Johannes Altmanninger
a9618477ec Merge branch 'completions-to-use-expanded-tokens'
The grandparent commit has a regression which is fixed by the parent, hence
the merge commit to communicate the grouping.
2024-01-27 09:36:07 +01:00
Johannes Altmanninger
29f35d6cdf completion: adopt commandline -x replacing deprecated -o
This gives us more accurate completions because completion scripts get
expanded paths
2024-01-27 09:28:06 +01:00
Johannes Altmanninger
798527d79a completions: fix double evaluation of tokenized commandline
Fix cases like

    eval my-cmd (commandline -o)
    complete -C "my-cmd $(commandline -o)"

In both cases, we spuriously evaluate tokens like "(inside-quoted-string)"
as command substitutions. Fix this by escaping the strings.  The momentarily
regresses the intended purpose of "eval" -- to expand variables -- but the
next commit will fix that.
2024-01-27 09:28:06 +01:00
Johannes Altmanninger
368017905e builtin commandline: -x for expanded tokens, supplanting -o
Issue #10194 reports Cobra completions do

    set -l args (commandline -opc)
    eval $args[1] __complete $args[2..] (commandline -ct | string escape)

The intent behind "eval" is to expand variables and tildes in "$args".
Fair enough. Several of our own completions do the same, see the next commit.

The problem with "commandline -o" + "eval" is that the former already
removes quotes that are  relevant for "eval". This becomes a problem if $args
contains quoted () or {}, for example this command will wrongly execute a
command substituion:

    git --work-tree='(launch-missiles)' <TAB>

It is possible to escape the string the tokens before running eval, but
then there will be no expansion of variables etc.  The problem is that
"commandline -o" only unescapes tokens so they end up in a weird state
somewhere in-between what the user typed and the expanded version.

Remove the need for "eval" by introducing "commandline -x" which expands
things like variables and braces. This enables custom completion scripts to
be aware of shell variables without eval, see the added test for completions
to "make -C $var/some/dir ".

This means that essentially all third party scripts should migrate from
"commandline -o" to "commandline -x". For example

    set -l tokens
    if commandline -x >/dev/null 2>&1
        set tokens (commandline -xpc)
    else
        set tokens (commandline -opc)
    end

Since this is mainly used for completions, the expansion skips command
substitutions.  They are passed through as-is (instead of cancelling or
expanding to nothing) to make custom completion scripts work reasonably well
in the common case. Of course there are cases where we would want to expand
command substitutions here, so I'm not sure.
2024-01-27 09:28:06 +01:00
Johannes Altmanninger
1b9e5258b5 Fix regression when erasing word in search field
This fixes a crash introduced in the reader port.

The tmux tests are not great but at least easy to write.
2024-01-27 03:46:26 +01:00
David Adam
9ac5e79e46 CI: use make VERBOSE=1 everywhere
Having visible build commands helps reproducibility.
2024-01-26 07:33:24 +08:00
Fabian Boehm
b8b062eb84 docs: Update qmark-noglob status
Note: The version number needs to be adjusted
2024-01-25 18:47:41 +01:00
Fabian Boehm
bfc17079be qmark-noglob: Set group back
These are the version the flag was *introduced*, so they should stay
the same over the lifetime of the flag.
2024-01-25 18:26:48 +01:00
Fabian Boehm
ac9c5ed1b2 Retry open_cloexec for signals other than SIGINT
Fixes #10250
2024-01-25 11:14:31 +01:00
Mahmoud Al-Qudsi
ea980c19db Make string_tests.rs deterministic regardless of qmark-noglob
Move all qmark tests to `scoped_test()` sections with explicitly set feature
flags. We already test the default qmark behavior in the functionality tests.
2024-01-24 22:42:02 -06:00
Mahmoud Al-Qudsi
34a5443cfd Disable ? as a glob by default
aka, enable the qmark-noglob feature by default.
2024-01-24 21:17:36 -06:00
ridiculousfish
42bb4b55d3 Add default-run = fish to Cargo.toml
This makes fish the default binary, so that "cargo run" will launch fish.
2024-01-23 19:49:35 -08:00
Fabian Boehm
f7b57065db docs/command: Simplify
This prefers `-s` to `-v` - we have a *lot* more uses of `command -s`, it's the easier
mnemonic *and* the more compatible-with-fish option.

Also we don't really need the separate section that explains what
these options do *again*.
2024-01-22 21:44:59 +01:00
Daniel Bretoi
c78750499d
Dynamic Completion for Justfile Recipes (#10244)
* Create just.fish

justfile completions for tasks similar to make completions for targets

* no need for the match at all
2024-01-22 20:13:10 +01:00
Asuka Minato
0f97111290
add more strace completion (#10227)
* Update strace.fish

* Update strace.fish

* upper case
2024-01-22 20:12:43 +01:00
Fabian Boehm
4157c28cc6 Update cargo.lock 2024-01-22 17:23:24 +01:00
Fabian Boehm
db361644c4 Remove unused num-derive dependency 2024-01-22 17:21:40 +01:00
Fabian Boehm
d74519081e fish_key_reader: Exit after "--version" 2024-01-22 17:18:11 +01:00
Mahmoud Al-Qudsi
977b97a236 Fix assertion failure in FZF keybindings
It seems the logic for calculating the cursor position was not ported correctly,
because the correct place to insert it is at the cursor_pos regardless of
range.start, going by the parameters submitted to the function and the expected
result.
2024-01-21 23:11:20 -06:00
ridiculousfish
ce19f82c19 Fix some clippy warnings 2024-01-21 19:12:33 -08:00
ridiculousfish
9a0728eed6 Stop using num_traits in common.rs
This was a rather silly usage only for estimating string capacity in a rarely
used function. We can do without it.
2024-01-21 18:19:40 -08:00