Commit Graph

19168 Commits

Author SHA1 Message Date
Fabian Boehm
7850142bef printf/tests: Use c_char instead of i8
Breaks on arm again
2024-05-27 12:47:51 +02:00
Nguyen Huu Kim
8880fa8dd7
feat: add completions for k8s tools (kustomize, flux) (#10473)
* feat: add completions for kustomize

* feat: add completions for FluxCD

* Update flux.fish

* Update kustomize.fish

---------

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-05-26 22:12:49 -05:00
Mahmoud Al-Qudsi
f84b1993ec Add path basename -E tests 2024-05-26 22:06:11 -05:00
Mahmoud Al-Qudsi
6091d1149f Document path basename -E 2024-05-26 22:06:11 -05:00
Mahmoud Al-Qudsi
286fa4bf5b Add path basename --no-extension
This makes `path basename` a more useful replacement for the stock `basename`
command, which can be used with `-s .ext` to trim `.ext` from the base name.

Previously, this would have required the equivalent of

    path change-extension "" (path basename $path)

but now it can be just

    path basename -E $path
2024-05-26 22:06:11 -05:00
Mahmoud Al-Qudsi
dbf6dfd5d2 completions/flatpak: dynamically complete flatpak install 2024-05-26 22:03:27 -05:00
Mahmoud Al-Qudsi
4868166f86 completions/rustc: preserve trailing = in -Z values 2024-05-26 21:44:02 -05:00
Mahmoud Al-Qudsi
84d057e7b7 Finish refactoring rustc completions
* Properly handle a lot more -Z completion formats as suggested by `rustc -Z
  help`
* Don't run any `rustc` commands when sourcing `rustc.fish`; these invocations
  are instead deferred until the user attempts to complete the specific switch.
* Support CSV -A/F/D/W values
2024-05-26 21:33:48 -05:00
Mahmoud Al-Qudsi
9045b251b0 Fix missing -- filter in string replace call 2024-05-26 21:33:48 -05:00
tesuji
114856e1d9
git: add --reuse-message and --reedit-message completion (#10530) 2024-05-26 20:57:43 -05:00
ridiculousfish
94f13a50f5 Add musl libc to our license.rst
The new printf is derived from musl libc. Add it to license.rst to reflect our
usage.
2024-05-26 16:07:27 -04:00
ridiculousfish
f16a1361c5 Adopt the new printf crate
This drops our usage of printf-compat.
2024-05-26 16:07:27 -04:00
ridiculousfish
585dac6b08 Use cargo test --workspace
Allows running printf tests.
2024-05-26 16:07:27 -04:00
ridiculousfish
7002571cf8 Add printf crate to workspace
This adds a crate containing a new implementation of printf, ported from musl.

This has some advantages:

- locale support is direct instead of being "applied after".
- No dependencies on libc printf. No unsafe code at all.
- No more WideWrite - just uses std::fmt::Write.
- Rounding is handled directly in all cases, instead of relying on Rust and/or
  libc.
- No essential dependency on WString.
- Supports %n.
- Implementation is more likely to be correct since it's based on a widely used
  printf, instead of a low-traffic Rust crate.
- Significantly faster.
2024-05-26 16:07:27 -04:00
Fabian Boehm
b9b7dc5f6c fmt 2024-05-26 10:50:45 +02:00
Fabian Boehm
52d1806e1f Apply some manual clippy lints
Mostly replacing std::<type>::MAX with <type>::MAX.

Surprising here is replacing

.expect(format!(...))

with

.unwrap_or_else(|_| panic!(...))

It explains that this is because the "format!" would always be called.
2024-05-26 10:45:46 +02:00
Fabian Boehm
20830744a9 Apply some clippy lints
Nothing too surprising, mostly removing useless references and lambdas
2024-05-26 10:37:37 +02:00
Fabian Boehm
2c3894993f Remove errant profiling enabling
This enabled the profile in fish_setlocale, which caused startup
profile to always be on, so

```fish
fish --profile file -c 'foo'
```

would show the entire startup as well
2024-05-26 10:32:28 +02:00
ridiculousfish
08f8983085 Adopt the new hex float parsing
This eliminates hexponent.
2024-05-25 18:39:45 -07:00
ridiculousfish
bed2ff2ea6 Add homegrown hex float parsing
Hex float parsing may come about through wcstod, for example:

    printf "%f" '0x8p2'

should output 32.0.

Currently we use a not-great fork of hexponent. Hexponent has been dormant for
years, and has some issues: doesn't round properly, allocates unnecessarily,
doesn't handle denormals, is more complicated than necessary.

Just rewrite hex float parsing, fixing those problems and getting us off of this
weird fork.
2024-05-25 18:31:38 -07:00
Fabian Boehm
1d0f1d2697 fmt 2024-05-25 22:21:52 +02:00
Fabian Boehm
d5101e1923 set: Put back zero-index error instead of crashing
This was missed in the initial port in 77aeb6a2a8.
2024-05-25 21:32:40 +02:00
Fabian Boehm
89ed37d957 CHANGELOG 2024-05-25 13:21:02 +02:00
Fabian Boehm
bf9e5583ba Push and pop for-block every run through the loop
We do the same in while loops. This clears the local variables every time.

Fixes #10525
2024-05-25 13:20:05 +02:00
Mahmoud Al-Qudsi
6921394db2 Remove needless use of dynamic dispatch
We return a plain function, all with matching signatures. No need for dynamic
dispatch here.
2024-05-24 17:30:38 -05:00
Klaus Hipp
cd9f5bdbaa
Add jnv completions (#10519) 2024-05-24 17:09:18 -05:00
tesuji
57963ced4b
add completions for ssh-keygen (#10508)
* add bare completions for ssh-keygen

* chore: more completions for ssh-keygen
2024-05-24 17:07:32 -05:00
Fabian Boehm
06d842b0d8 completions/csvlens: Fix a typo 2024-05-24 22:40:18 +02:00
Klaus Hipp
843933ce95
Add csvlens completions (#10520) 2024-05-24 15:38:45 -05:00
Mahmoud Al-Qudsi
2c2f7cb4d1 Use our own thread id
ThreadId is way slower than it should be for the sense that we use it in; it
doesn't cache the id and allocates an Arc internally.

We don't care about the thread id used in crate::threads correlating with any
other thread id the code uses anywhere (not that it does) because it's only used
for our own bookkeeping. Change to something much simpler instead.
2024-05-24 13:34:18 -05:00
Mahmoud Al-Qudsi
cf4ab20055 Use OnceLock in crate::threads
Verified that std::sync::OnceLock<T> compiles to the same assembly at the
*access* site as the Option<T> we were using. The additional overhead upon init
is fine. No need for extra Box<T> indirection for IO_THREAD_POOL.
2024-05-24 12:46:47 -05:00
Mahmoud Al-Qudsi
b49e9b906f Wrap an unruly comment 2024-05-24 10:21:07 -05:00
Mahmoud Al-Qudsi
59317da19e Clarify threading semantics of DISOWNED_PIDS
While obtaining an uncontested mutex from the same thread (without reentrance)
is basically ~free, the use of `MainThread<RefCell<T>>` instead of `Mutex<T>`
makes it clear that there is no actual synchronization taking place, hopefully
making the code easier to understand.
2024-05-24 10:20:29 -05:00
Mahmoud Al-Qudsi
43d6289c26 Make assert_is_main_thread() simpler to optimize
The compiler cannot guarantee that a `static AtomicBool` is always the same
initial value, but it can do so for a `const bool`.
2024-05-24 09:57:42 -05:00
Johannes Altmanninger
6cd1323bfe Work on changelog 2024-05-24 15:16:17 +02:00
Johannes Altmanninger
8c073f56c2 Changelog issues from current milestone 2024-05-24 14:01:46 +02:00
Mahmoud Al-Qudsi
537cde0c72 Avoid auto-colorization of ls output if CLICOLOR_FORCE is set
We don't set this variable ourselves, but some might set it in their config out
of habit coming from shells that don't automatically colorize ls output.

This variable overrides stdout tty detection for `ls --color=auto` (but does not
modify the behavior of `ls --color=never` or `ls --color=always` regardless of
its value) under at least the BSD version of `ls`. (Under the GNU version, it
influences colorization only if stdout *is* a tty.)

If we detect CLICOLOR_FORCE *and* we are not writing directly to the tty, we
skip colorization (by clearing-but-not-erasing `$__fish_ls_color_opt`, so that
we don't end up accidentally using its value from another scope).
2024-05-23 20:50:23 -05:00
Shun Sakai
6d8b4214d5
Add completions for reuse-tool (#10511) 2024-05-23 16:53:53 -05:00
Mahmoud Al-Qudsi
d654880bcf
Automatically label and milestone completions (#10517)
This automatically assigns the 'completions' label and the 'fish next-3.x'
milestone to completions-only PRs.

A completions-only PR is defined as being one that touches
share/completions/*.fish but does not touch any files outside of share/
2024-05-23 13:34:20 -05:00
Fabian Boehm
5bd1c5ecbf completions/git: Move unmerged to git restore --staged
I still don't get how exactly restore works.

Fixes #10518
2024-05-23 15:08:55 +02:00
Fabian Boehm
00e0d6ad9d Yet more shortening 2024-05-23 14:36:56 +02:00
Johannes Altmanninger
2f84f76cc2 completions/bind: complete ctrl/alt modifier abbreviations 2024-05-22 22:38:06 +02:00
Johannes Altmanninger
de7f39d627 builtin bind: make function keys lowercase (f1 instead of F1)
All other key names are lowercase so this inconsistency is weird.
2024-05-22 22:38:06 +02:00
Mahmoud Al-Qudsi
4869b98482 completions/flatpak.fish: Use terser/faster declarative style 2024-05-22 13:53:25 -05:00
Mahmoud Al-Qudsi
c2ecfe60ac completions/flatpak: Fix compatibility with older versions
Filter out ansi control characters and pretty formatting from older versions
that don't detect the absence of a tty.

Closes #10514.
2024-05-22 13:53:25 -05:00
Michal Koutný
fa0c585662
completions/git: Add git branch --edit-description (#10512)
* completions/git: Add `git branch --edit-description`
2024-05-21 18:56:52 -05:00
Johannes Altmanninger
2fa98ec20c Fix deadlock when importing universal LC_* variable
The C++ version of this code simply copied the entire uvar table.
Today we take a reference. It's not clear which one is better.

Removal of locale variables like LC_ALL triggers variable change handlers
which call EnvStackImpl::get. This deadlocks because we still hold the lock
to protect the reference to all uvars.  Work around this.

Closes #10513
2024-05-21 23:11:06 +02:00
Mahmoud Al-Qudsi
d07d0170ad build.rs: also declare cfgs when we run into a warning
e.g. gettext is found but can't be used
2024-05-21 13:34:24 -05:00
Mahmoud Al-Qudsi
0b5e41b268 Rework path_normalize_for_cd() to be less allocation trigger happy
Lots of resizing, splicing, and full-on allocating going on here.
2024-05-21 12:54:52 -05:00
Mahmoud Al-Qudsi
d14d8d5733 Remove wcstringutil::split_string()
It is short and simple enough to write yourself if you need it and it encourages
bad behavior by a) always returning owned strings, b) always allocating them in
a vector. If/where possible, it is better to a) use &wstr, b) use an iterator.

In rust, it's an anti-pattern to unnecessarily abstract over allocating
operations. Some of the call sites even called split_string(..).into_iter().
2024-05-21 12:54:52 -05:00