Commit Graph

17054 Commits

Author SHA1 Message Date
NextAlone
37e7e90bff completion/ssh-copy-id: add completion (#9675)
Add completions for ssh-copy-id.

Refactored __ssh_history_completions into its own file for autoloading across
completions.

(cherry picked from commit 45b6622986)

Conflicts:
	CHANGELOG.rst
2023-03-22 12:30:01 -05:00
NextAlone
45b6622986
completion/ssh-copy-id: add completion (#9675)
Add completions for ssh-copy-id.

Refactored __ssh_history_completions into its own file for autoloading across completions.
2023-03-22 12:24:18 -05:00
NextAlone
7f867298e7 completion/git: complete tags for force option (#9678)
(cherry picked from commit ff34c1a573)
2023-03-22 11:07:33 -05:00
NextAlone
ff34c1a573
completion/git: complete tags for force option (#9678) 2023-03-22 11:07:18 -05:00
Mahmoud Al-Qudsi
80b31e87ec Merge deno completions update from #9676
(Can't cherry-pick because GitHub tricked me into rebasing instead of
squashing.)
2023-03-22 11:04:41 -05:00
sigmaSd
860de8aa8f minor cleanup 2023-03-22 11:00:59 -05:00
sigmaSd
b95085609e deno task take one argument max 2023-03-22 11:00:59 -05:00
sigmaSd
93bf4e1187 Update deno task completions to handle deno.jsonc and package.json 2023-03-22 11:00:59 -05:00
NextAlone
e00f63b9e9 completion/adb: add execout and complete props
Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
(cherry picked from commit da3323bbc2)
2023-03-21 22:20:57 -05:00
NextAlone
da3323bbc2 completion/adb: add execout and complete props
Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
2023-03-21 22:20:36 -05:00
Fabian Boehm
693595a6c0 Silence fstatat errors
These just keep happening, people run haunted computers.

Fixes #9674.

(cherry picked from commit cd7e8c00e1)
2023-03-21 17:17:55 +01:00
Fabian Boehm
cd7e8c00e1 Silence fstatat errors
These just keep happening, people run haunted computers.

Fixes #9674.
2023-03-21 17:10:23 +01:00
Mahmoud Al-Qudsi
fb74f77c86 Use bsd feature for signals
Signals present in 4.4BSD can be assumed present on all modern BSD derivatives.
2023-03-20 20:28:25 -05:00
Mahmoud Al-Qudsi
f2cf54608d Migrate existing rust code to Signal type
Everything but signal handlers has been changed to use `Signal` instead of
`c_int` or `i32` signal values.

Event handlers are using `usize` to match C++, at least for now.
2023-03-20 16:17:28 -05:00
Mahmoud Al-Qudsi
1f4c233dfb Add Signal newtype
Signal is a newtype around NonZeroI32. We could use NonZeroU8 since all signal
values comfortably fit, but using i32 lets us avoid a fallible attempt at
narrowing values returned from the system as integers to the narrower u8 type.

Known signals are explicitly defined as constants and can be matched against
with equality or with pattern matching in a `match` block. Unknown signal values
are passed-through without causing any issues.

We're using per-OS targeting to enable certain libc SIGXXX values - we could
change this to dynamically detecting what's available in build.rs but then it
might not match what libc exposes, still giving us build failures.
2023-03-20 16:17:28 -05:00
AsukaMinato
2e66bb19da use $( ... )* syntax 2023-03-20 11:20:12 -07:00
ridiculousfish
732f7284d4 Adopt the new termsize
This eliminates the C++ version.
2023-03-19 16:13:41 -07:00
ridiculousfish
6ec35ce182 Reimplement termsize in Rust
This is not yet adopted by fish.
2023-03-19 16:13:41 -07:00
ridiculousfish
30feef6a72 Migrate env_stack_t::get_or_null to environment_t
Allows it to be used when we only have an environment_t.
2023-03-19 16:13:41 -07:00
Mahmoud Al-Qudsi
3fab931e86 Fix build.rs formatting and prep it for further feature detections 2023-03-19 18:12:50 -05:00
ridiculousfish
99c6c76c5e Add the category name back to FLOG output in Rust
This went missing.
2023-03-19 16:04:57 -07:00
Mahmoud Al-Qudsi
34a4c7de7f Add BSD feature
This should be used in lieu of manually targeting individual operating systems
when using features shared by all BSD families.

e.g. instead of

   #[cfg(any(target_os = "freebsd", target_os = "dragonflybsd", ...))]
   fn foo() { }

you would use

    #[cfg(feature = "bsd")]
    fn foo() { }

This feature is automatically detected at build-time (see build.rs changes) and
should *not* be enabled manually. Additionally, this feature may not be used to
conditionally require any other dependency, as that isn't supported for
auto-enabled features.
2023-03-19 17:55:22 -05:00
ridiculousfish
57f4571a01 Rewrite wait handles and wait handle store in Rust 2023-03-18 18:53:04 -07:00
AsukaMinato
14d6b1c3de Simplify Default impl for ParseError
By implementing `Default` for `ParseErrorCode`, `ParseError` can just
`#[derive(Default)]` instead.

Closes #9637.
2023-03-17 19:59:52 -05:00
David Adam
a1f79b3acc CHANGELOG: work on 3.6.1 2023-03-18 00:41:09 +08:00
David Adam
88043088f2 CHANGELOG: work on 3.6.1 2023-03-18 00:14:24 +08:00
David Adam
38be704434 Revert "Disable bracketed paste for read"
This reverts commit 71dc334010.

Although this is a partial fix for the problem behaviour, it is too much of a
breaking change for my appetite in a minor release.
2023-03-18 00:11:56 +08:00
Fabian Boehm
71dc334010 Disable bracketed paste for read
It's not of much use (read will only read a single line anyway) and
breaks things

Fixes #8285

(cherry picked from commit af49b4d0f8)
2023-03-16 20:31:37 +08:00
Fabian Boehm
a16abf22d9 builtins: Don't crash for negative return values
Another from the "why are we asserting instead of doing something
sensible" department.

The alternative is to make exit() and return() compute their own exit
code, but tbh I don't want any *other* builtin to hit this either?

Fixes #9659
2023-03-14 10:53:35 +01:00
Quinten Roets
f5506803d7
fish_vi_cursor: add new variable for external cursor mode (#9565)
* add new variable for external cursor mode

* fix backwards compatibility

* add documentation

* document change in changelog
2023-03-14 10:50:20 +01:00
Xiretza
b39715434b ScopeGuard: remove memory leak
Calling ScopeGuard::rollback() would leak the `on_drop` callable; this is
a problem for Box<dyn FnOnce> or closures containing Drop data.
2023-03-13 11:54:05 -05:00
lengyijun
22cb03c236 Fixes #8924 via __fish_complete_suffix overhaul
Before:
* hand write arg parse
* only accepts one suffix

After:
* use `arg_parse` to parse args
* accepts multi suffixes

Closes #9611.

(cherry picked from commit aa65856ee0)
2023-03-12 22:12:11 -05:00
lengyijun
aa65856ee0 Fixes #8924 via __fish_complete_suffix overhaul
Before:
* hand write arg parse
* only accepts one suffix

After:
* use `arg_parse` to parse args
* accepts multi suffixes

Closes #9611.
2023-03-12 22:07:44 -05:00
ridiculousfish
dea18b34aa Add tests for normalize_path and fix some bugs 2023-03-12 19:50:35 -07:00
ridiculousfish
33fd679f68 Use char_at instead of to_char_slice() 2023-03-12 19:50:35 -07:00
ridiculousfish
f54a45d09c Add missing builtin_print_help in realpath
This got dropped in the port.
2023-03-12 19:50:35 -07:00
Victor Song
88e0c2137a Added constants for expansions 2023-03-12 19:50:35 -07:00
Victor Song
80c8bc75e6 Switch to errno crate 2023-03-12 19:50:35 -07:00
Victor Song
3dfc9082e6 Use std::io::Error::last_os_error() for errno 2023-03-12 19:50:35 -07:00
Victor Song
ca494778e4 builtins: Port realpath to Rust 2023-03-12 19:50:35 -07:00
Mahmoud Al-Qudsi
47b4e3d067 fixup! Switch signals from usize to i32
Just address two clippy lints that are fallout from changing the signal type.
There's no longer any need to convert these (which gets rid of an unwrap).
2023-03-12 21:38:24 -05:00
Mahmoud Al-Qudsi
4f30993dbb Use ScopeGuard to replace manually saved-and-restored variables 2023-03-12 21:32:35 -05:00
Mahmoud Al-Qudsi
11766cf56f Add a proper rust ScopeGuard
Due to limitations imposed by the borrow checker, there are very few places
where we will be able to use the `ScopedPush` class ported over from the C++
codebase (once you capture the value w/ a `ScopedPush` you can't access the
value - or the mutable reference you used to reach it! - until the `ScopedPush`
object goes out of scope).

This alternative requires binding the previous values to a variable and manually
restoring them in the callback passed to the `ScopeGuard` constructor, but will
work with rust's borrow and `&mut` paradigm.
2023-03-12 21:32:35 -05:00
Victor Song
06547aef54 Detect rust-analyzer in build script to enable autocxx completions
Currently the `autocxx` generated code does not produce any code intelligence
because `rust-analyzer` can't find the generated code since it's not in the
workspace. Here, we detect `rust-analyzer` by checking for a `RUSTC_WRAPPER`
environment variable containing `rust-analyzer` and changing (or avoid changing)
the output directory accordingly.

Closes #9654.
2023-03-12 21:31:28 -05:00
ridiculousfish
409bf2995d Switch signals from usize to i32
This eliminates some conversions.
2023-03-12 17:08:35 -07:00
ridiculousfish
161734f310 Remove bitset module
This was added to support signals; however we are unlikely to use this
for anything else. Remove it; just use a u64 to report signals that have
been set.
2023-03-12 16:58:22 -07:00
Mahmoud Al-Qudsi
8e9dc74a02 Simplify EventType matching slightly 2023-03-12 16:24:04 -05:00
Mahmoud Al-Qudsi
dabe7a1c7c Skip tmux-complete test under WSL
The test passes but only if executed on its own. It's not the most perfect test,
but I can basically never get `make test` to pass under WSL while that's not the
case on all my other machines.
2023-03-12 15:18:17 -05:00
Victor Song
77fe9933e2 builtins: Rewrite pwd in Rust
Closes #9625.
2023-03-12 15:18:15 -05:00
Mahmoud Al-Qudsi
6809a8dfbc Use a bit set for pending signals
This optimizes over both the rust rewrite and the original C++ code. The rust
rewrite saw `std::bitset` replaced with `[bool; 65]` which could result in a
lot of memory copy bandwidth each time we checked for and received no signals.
The original C++ code would iterate over all signal slots to see if any were
set. The code now returns a single u64 and only checks slots that are known to
have signals via an intelligent `Iterator` impl.
2023-03-12 14:55:50 -05:00