Commit Graph

19575 Commits

Author SHA1 Message Date
Peter Ammon
d2d2d8cb45
Remove the shared_from_this for Parser
We no longer need this.
2024-06-23 16:39:39 -07:00
ridiculousfish
924d6aac71
Remove another call to current_data()
Continue to get off of globals.
2024-06-23 16:39:39 -07:00
ridiculousfish
dee692759a
Split Reader off from ReaderData
Prior to this commit, there was a stack of ReaderDatas, each one has a
reference to a Parser (same Parser in each, for now). However, the current
ReaderData is globally accessible. Because it holds a Parser, effectively
anything can run fish script; this also prevents us from making the Parser
&mut.

Split these up. Create ReaderData, which holds the data portion of the
reader machinery, and then create Reader which holds a ReaderData and a
Parser. Now `reader_current_data()` can only return the data itself; it
cannot execute fish script.

This results in some other nice simplifications.
2024-06-23 16:39:39 -07:00
ridiculousfish
dfd948fcb5
Eliminate a call to reader_current_data
Try to get off of these globals.
2024-06-23 16:39:39 -07:00
ridiculousfish
c297df38c7
Migrate the Inputter type to a trait
This is a start on untangling input. Prior to this, a ReaderData and an
Inputter would communicate with each other; this is natural in C++ but
difficult in Rust because the Reader would own an Inputter and therefore
the Inputter could not easily reference the Reader. This was previously
"resolved" via unsafe code.

Fix this by collapsing Inputter into Reader. Now they're the same object!
Migrate Inputter's logic into a trait, so we get some modularity, and then
directly implement the remaining input methods on ReaderData.
2024-06-23 16:39:39 -07:00
ridiculousfish
c9a76bd634
Make OperationContext not hold a Parser via Rc
Exploit Rust's lifetimes. This will lead to simplifications.
2024-06-23 16:39:39 -07:00
ridiculousfish
d36f94d96c
Remove additional call to Parser::shared() 2024-06-23 16:39:39 -07:00
ridiculousfish
832ed31687
Start removing calls to Parser::shared()
Parser::shared() gets an Rc to a Parser, but we can do without it.
Let's aim to get rid of the cyclic ref.
2024-06-23 16:39:39 -07:00
Mahmoud Al-Qudsi
245ee466cb completions/magento: remove sed dependency
This runs in about half the time, too.
2024-06-23 18:08:34 -05:00
Jean-Bernard Valentaten
3c74f14569
completions/magento: Fixes module aggregation for module related commands (#10446)
* completions/magento: Fixes module aggregation for module related commmands

Previousely when attempting completion for commands `module:enable`,
`mmodule:disable` and `module:uninstall` and error would be disaplyed,
stating that "magento" was not found.
Upon inspection of the issue in the related completion script it became
clear that:
1. The shell command `magento` does not exist as the CLI script of
   Magentoresides under `bin/magento`.
2. The module aggregation would not work after referncing the
   appropriate CLI command as an undeclared variable was being
   introspected.
3. Using Magento's CLI command took too long to respond as it has to
   bootstrap the whole Magento stack in order to deliver modules.

Thus the whole aggregation was rewritten to a form that actually works
and reduces the aggregation to reading the appropriate information
directly from the configuration file, provided that the file exists and
PHP is installed.

* completions/magento: Refactors module aggregation for module related commmands to not use PHP script

Executing random scripts from fish completion poses a threat to the
system. While this would indicate that the Magento installation has been
corrupted, it still is better to not run `app/etc/config.php` to get
hold of the modules.
Thus the module aggregation was rewritten to make use of `sed` instead,
which has the additional benefit of being faster than using PHP.
2024-06-23 18:05:52 -05:00
Mahmoud Al-Qudsi
2f46186f2b Fix formatting 2024-06-23 18:01:31 -05:00
Mahmoud Al-Qudsi
1a18d06a57 math: Fix copy-and-paste error in error message 2024-06-23 17:53:49 -05:00
Mahmoud Al-Qudsi
1a7a7a5dcb math: Support abbreviated scale modes 2024-06-23 17:52:14 -05:00
Mahmoud Al-Qudsi
80c02400eb Fix hard-coded decimal separator in builtin math 2024-06-23 17:50:02 -05:00
Mahmoud Al-Qudsi
c0028a0ec9 math: Rename ZeroScaleMode
It's no longer only for the zero scale.
2024-06-23 17:47:21 -05:00
Looouiiis
480d48351c feat(math): add round options (#9117)
Add round options, but I think can also add floor, ceiling, etc. And
the default mode is trunc.

Closes #9117

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-06-23 17:45:52 -05:00
Mahmoud Al-Qudsi
f1ae170155 printf: Ignore some floating point tests under i586
A few specific tests fail under i586 due to its inherent floating point
inaccuracy issues (rust-lang/rust#114479), so ignore these tests if certain
are met.

We have specific integration tests elsewhere in fish to check that even under
i586 we get mostly sane results, so this is OK. I tried to modify the assert
macros to check for a loose string match (up to one character difference) or an
f64 abs diff of less than epsilon, but it was a lot of code with little value
and increased the friction to contributing to the tests. Also, let's just
acknowledge the fact that all of i686, let alone i586 specifically, is a dead
end and not worth investing such time and effort into so long as it more or less
"works".

Closes #10474.
2024-06-23 16:14:02 -05:00
Mahmoud Al-Qudsi
7d1942a023 Add reduced-accuracy variants of some math tests under x86
Due to the inherent floating point accuracy issues under i586 described
in #10474 and at https://github.com/rust-lang/rust/issues/114479, we need to add
a workaround to our littlecheck math tests to perform less stringent comparisons
when fish was built for x86 without SSE2 support.

This commit addresses the littlecheck issues that caused #10474 to be re-opened,
but I still have to reproduce the cargo test failures for
`negative_precision_width`, `test_float`, `test_float_g`, and `test_locale`.
2024-06-23 16:14:02 -05:00
Lzu Tao
e0266067c4 git: completion for git commit --edit 2024-06-22 20:00:31 +00:00
Fabian Boehm
d917b89009 docs: Fix two links 2024-06-22 14:58:07 +02:00
Mahmoud Al-Qudsi
59daa5abce
Run 32-bit CI tests as i586 (#10578) 2024-06-21 12:45:54 -05:00
Mahmoud Al-Qudsi
298cdb0c5b Always pass --target to cargo test when CMake Rust_CARGO_TARGET is set
The CMake `cargo test` integration was broken if Rust_CARGO_TARGET were used
with `CARGO_FLAGS` set to `-Zbuild-std` (e.g. to target i586 under i686 without
the i586 toolchain installed).
2024-06-21 12:00:10 -05:00
Florian Meißner
14fd7bd9af
Explain function --argument-names in more detail. (#10524) 2024-06-19 22:51:47 -05:00
Mahmoud Al-Qudsi
32a5be52e1 Add note about non-ASCII decimal_sep length 2024-06-19 18:50:24 -05:00
Mahmoud Al-Qudsi
28a3ae7a8b Remove Clone bound on parse_dec_float()
It's not necessary to clone the character iterator at all.
Also move rarely used inf/nan parsing to own cold function.
2024-06-19 18:43:53 -05:00
Peter Ammon
373cef08cc
Fix a clippy in ulimit 2024-06-19 10:47:46 -07:00
Schlomo Schapiro
b3a16e0993
Show only writeable volumes
to exclude system volume
2024-06-19 09:17:14 -07:00
Schlomo Schapiro
f0c8f7406c
Extend diskutil eject to suggest volumes
Extend `diskutil eject` completion to also suggest mounted volumes.

Fixes #10573
2024-06-19 09:17:14 -07:00
Manuel Krebs
27c7578760 Add completions for dust 2024-06-19 02:10:52 +02:00
David Adam
e95fc104ec CHANGELOG #830 2024-06-17 06:36:38 +08:00
Peter Ammon
5cc9e0187e
Suppress an annoying warning about non-camel-case types 2024-06-16 11:49:09 -07:00
Peter Ammon
376bdb16c7
Fix a misspeeled comment 2024-06-15 16:20:15 -07:00
Peter Ammon
5a45b189da
Make EnvStackSetResult use Rust naming conventions 2024-06-15 15:57:28 -07:00
Peter Ammon
0c20ccc72d
Fix an annoying warning about camel case types 2024-06-15 13:46:45 -07:00
Peter Ammon
4d300b7f32
Correct fish_default_key_bindings docs
These referred to vi key bindings, not emacs.

Credit to chapeupreto for spotting this in #10569.
2024-06-15 12:18:37 -07:00
Peter Ammon
aa83e155f5
Correct changelog for #10394 2024-06-15 12:16:55 -07:00
Lzu Tao
d370adf5fe git: allow path completion after git reset -- 2024-06-15 11:59:24 -07:00
Peter Ammon
61a90deb8f
Changelog fix to #10394 2024-06-15 11:50:35 -07:00
iselda aiello
bac222e001 Move cursor back one space when deleting in vi visual mode
Fixes #10394
2024-06-15 11:44:32 -07:00
Trishank Karthik Kuppusamy
261274ea26
docs/tutorial: Add a note about universal variables (#10548)
Link to some best practices for universal variables.
2024-06-13 18:28:22 +02:00
Fabian Boehm
616ca83799 Cirrus: Increase clone depth
This would fail the FreeBSD tests whenever we merge or push multiple
times in quick succession.

Basically:

- Commits up to ABCDEF are pushed, which triggers a CI run
- Cirrus starts up, but takes a while - it knows to use commit ABCDEF
- More commits are pushed up to 123456
- Cirrus does a shallow clone, only has 123456
- Cirrus tries to check out ABCDEF, but doesn't know it - instant failure

Instead, let's use 100 commits, which should be enough
2024-06-12 17:28:23 +02:00
David Adam
3a9dc12a31 fish.spec: drop C++ requirement 2024-06-12 14:14:52 +08:00
Fabian Boehm
61bf839991 Update README 2024-06-12 08:11:16 +02:00
Fabian Boehm
84b5701b92 Port fish_test_helper to C
This is the last piece of C++, so now we can remove the need for a C++
compiler.

We need one for C anyway (libc.c).

Fixes #10549
2024-06-12 08:11:16 +02:00
Shun Sakai
525a39b42c Add completions for actionlint 2024-06-12 08:10:57 +02:00
Mark Huang
1d8b10399a apt list completions 2024-06-12 08:10:38 +02:00
Fabian Boehm
04da7043a6 tests: Remove skipped tests hack for Cmake < 3.9.0
We require 3.19

This also makes skipped tests visible, which showed that the
print-help test was never run because the REQUIRES line was off.

In sh-mode, bash's `command -v` returns true if *all* commands exist.
2024-06-11 16:55:11 +02:00
Fabian Boehm
32d23a37cb format 2024-06-10 17:16:19 +02:00
Fabian Boehm
652996124d reader: Remove a panic
The special input functions self-insert, self-insert-not-first, and
and or used to be handled by inputter_t::readch, but they aren't
anymore with `commandline -f`.

I am unsure if these *would* have worked, I can't come up with a use.

So, for now, do nothing instead of panicking.
2024-06-10 17:14:13 +02:00
Fabian Boehm
c7d878a8d2 input: Let function_pop_arg return an Option
This would crash if you ran `commandline -f backward-jump`.

The C++ version would read a char (but badly), this doesn't anymore.

So, at least instead of crashing, just do nothing.
2024-06-10 17:02:11 +02:00