Commit Graph

17636 Commits

Author SHA1 Message Date
Henrik Hørlück Berg
eacbd6156d Port and adopt main written in Rust
We don't change anything about compilation-setup, we just immediately jump to
Rust, making the eventual final swap to a Rust entrypoint very easy.

There are some string-usage and format-string differences that are generally
quite messy.
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
96e58dac21 Port env_init to Rust
- This does not adopt it.
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
e7f8fb04cc Add BUILD_VERSION to lib.rs
In CMake this used a `version` file in the CARGO_MANIFEST_DIR, but
relying on that is problematic due to change-detection, as if we add
`cargo-rerun-if-changed:version`, cargo would rerun every time if the file does
not exist, since cargo would expect the file to be generated by the
build-script. We could generate it, but that relies on the output of `git
describe`, whose dependencies we can only limit to anything in the
`.git`-folder, again causing unnecessary build-script runs.

Instead, this reads the `FISH_BUILD_VERSION`-env-variable at compile time
instead of the `version`-file, and falls back to calling git-describe through
the `git_version`-proc-macro. We thus do not need to deal with extraneous
build-script running.
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
360ba46660 Make ConfigPaths store as PathBuf
- These are paths, we can just store them raw.
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
55302629cd Add various FFI-interop-functions
- `libc::setlinebuf` is not available through Rust's libc it appears.
- autocxx fails to generate bindings using `*mut FILE`, instead go through
  `void*`
- rust_main needs `parse_util_detect_errors_in_ast`, which is _partially_
  ported, instead add FFI interop for C++.
- We need to set the filename if we are sourcing a file
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
25d207a8ce Make get_current_exe use impl AsRef<Path>
- It does not need to require the default to be valid UTF8
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
a92804a8a1 Port MISSING_HELP and MISSING (arg)
C++ main used getopt (no w!), which appears to internally print
error-messages. The Rust version will use `wgetopter_t`, and therefore needs to
print this itself.
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
7c2311abd7 Make methods in path not unnecessairly take &mut 2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
cf8e0ae1b5 Make ParsedSource::new pub
It will be used from main
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
3777bc941f Port history::start_private_mode to Rust 2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
c5c5043d7e Make PROGRAM_NAME safe, fix cmp
- It is currently never set, but will be set once `main` is ported
- `should_suppress_stderr_for_tests` used to be PROGRAM_NAME !=
  TESTS_PROGRAM_NAME, but the equivalent C++ code was
  `!std::wcscmp(program_name, TESTS_PROGRAM_NAME)`, and `wcsmp` returns
  zero if they are equal, thus is equivalent to `==` in Rust
2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
e4df340f43 Forward CMake configs to Cargo 2023-09-05 11:38:59 +02:00
Henrik Hørlück Berg
5db08e1126 Make CARGO_MANIFEST_DIR for fish-rust equal to src 2023-09-05 11:38:59 +02:00
Fabian Boehm
dcebffb9e7 funced: Note --wait
See #9999
2023-09-05 09:19:21 +02:00
Johannes Altmanninger
a3311c9b09 Fix incorrect port of write_to_fd 2023-09-03 14:03:14 +02:00
ghostflyby
c17fc65321 Update CHANGELOG.rst 2023-09-01 10:27:18 -07:00
ghostflyby
33ec25da8a completion for macOS java_home 2023-09-01 10:27:18 -07:00
Fabian Boehm
e52e7cea43 CHANGUELOGUE 2023-08-30 23:15:01 +02:00
Fabian Boehm
9f5f34267d key delay: Add tests
I already forsee these being annoying on CI, because they involve a timeout.
2023-08-30 23:13:10 +02:00
Fabian Boehm
f9b51cf8a6 docs: Add key timeout 2023-08-30 23:13:09 +02:00
yanshay
01db48a712
Added fish_sequence_key_delay_ms to set time to wait between sequence key presses (#7401) (#9926)
* added support for fish_sequence_key_delay_ms to set how long to wait between sequence key presses

* fixed cargo fmt
2023-08-30 23:12:22 +02:00
Fabian Boehm
b54faf9469 webconfig: Fix box shadow in dark mode
This changed from a separate div to directly on the body
2023-08-29 14:29:20 +02:00
Fabian Boehm
209af84a37 webconfig: Make prompt selectable 2023-08-29 14:29:20 +02:00
Fabian Boehm
4b4cd4c45a
Merge pull request #9554 from septatrix/rewrite/webconfig-to-alpinejs
WIP: Proof of concept for replacing AngularJS with Alpine.js in webconfig component
2023-08-29 14:28:39 +02:00
Fabian Boehm
5e6f187ca6
Merge branch 'master' into rewrite/webconfig-to-alpinejs 2023-08-29 14:25:02 +02:00
Henrik Hørlück Berg
5734630966 Replace ATiltedTree/setup-rust with rust-toolchain
- https://github.com/ATiltedTree/setup-rust has not been committed to since May
  2022, I am uncertain about how widely used it is.
- It appears to have a bug with restoring its internal cache whenever there
  comes a new stable version (immediate guess would be the cache-key does not
  resolve `stable` to a specific version, which somehow breaks rustup, but I have not investigated)
- https://github.com/dtolnay/rust-toolchain is a more sensible take of https://github.com/actions-rs/toolchain,
  where the original repo appears to be unmaintained.
  It is implemented in one file of yaml/bash
  https://github.com/dtolnay/rust-toolchain/blob/master/action.yml, we could
  easily fork it if it becomes unmainted, unlike the other actions which uses
  unnecessary javascript
2023-08-28 23:15:25 +08:00
Yuntao Zhao
9d0d16686e
Improve completion for rpm-ostree (#9910)
* Some temporary change until compose - commit

* First draft

* Fix an error that prints double completion

* Fix completion errors. Add rpm-ostree alias.

Fix cimpletion where it trigger by multiple commands.
Add update and remove, which are aliases for upgrade and uninstall.

* Remove -r when it is unnecessary

Some command need path completion for arguments no matter what,
which makes -r flag useless

* Remove -x for compose image
-x does not block the path anyway

* Add missing short otpion in compose image

Revert the last change to block -l completion

* Fix description

Fix multiple description.
2023-08-26 15:05:52 +02:00
Jason Nader
f6123d235c scp completions: fix path escaping 2023-08-26 15:04:48 +02:00
Fabian Boehm
7b5667b11f parse_execution: Remove dead tcgetattr code
This used to be assigned to the job, but that was removed in
f30ce21aaa.

Since then this was vestigial. It could have technically errored out,
but we should be catching that where we use the actual modes, not here.
2023-08-26 14:58:14 +02:00
Fabian Boehm
b454b3bc40 Also allow command and in a pipeline
Similar to `time`, except that one is more common as a command.

Note that this will also allow `builtin and`, which is somewhat
useless, but then it is also useless outside of a pipeline.

Addition to #9985
2023-08-26 13:45:54 +02:00
Fabian Boehm
55c425a0dd fish_key_reader: Humanize key descriptions
This used to print all codepoints outside of the ASCII range (i.e.
above 0x80) in \uXXXX or \UYYYYYYYY notation.

That's quite awkward, considering that this is about keys that are
being pressed, and many keyboards have actual symbols for these on
them - I have an "ö" key, so I would like to use `bind ö` and not
`bind \u00F6`. So we go by iswgraph.

On a slightly different note, `\e` was written as `\c[ (or \e)`. I do
not believe anyone really uses `\c[` (the `[` would need to
be escaped!), and it's confusing and unnecessary to even mention that.
2023-08-26 10:43:42 +02:00
Fabian Boehm
d803ebbff9 docs: Some teensy bits on if/while
The ``test`` thing was just duplicated, and ``while`` linked to the
if-*command* page, where the syntax section is probably nicer
2023-08-26 09:32:05 +02:00
Fabian Boehm
03e659f96d Bring back "(deleted)" hack for status fish-path
This is untested mostly because it is supremely awkward to test.

Fixes #9925
2023-08-25 22:02:55 +02:00
Fabian Boehm
482616f101 parse_util: Only reject time in a pipeline without decorator
This allows e.g. `foo | command time`, while still rejecting `foo | time`.

(this should really be done in the ast itself, but tbh most of
parse_util kinda should)

Fixes #9985
2023-08-25 19:45:15 +02:00
Fabian Boehm
b48fa1f1a0
Css refresh (#9982)
This cleans up the CSS, reduces the number of different colors and special settings we use.

It increases contrast so we now pass WCAG AAA (according to chromium), and switches to css variables for colors to make dark mode simpler to implement.
2023-08-25 17:13:35 +02:00
Fabian Boehm
03402e572d format 2023-08-25 16:28:41 +02:00
Fabian Boehm
e555f1b235 math: Fix docs on --scale
Fixes #9983
2023-08-25 16:17:59 +02:00
Fabian Boehm
06b89083d5 tinyexpr: Check for wcstod errors
This would otherwise unwrap() an Err and crash.
2023-08-25 16:15:52 +02:00
Fabian Boehm
b3ff982ad7 docs: Remove some jquery leftovers 2023-08-24 21:55:57 +02:00
Fabian Boehm
e3b1d327f1 docs: Remove reference to nonexistent style.css 2023-08-24 21:55:57 +02:00
Henrik Hørlück Berg
05c44df1a4 Run cargo fmt with Rustfmt 1.6.0
- "1.6.0" now supports formatting let-else statements which we use liberally,
  and appears to have some fixes in regards to long-indented-lines with macros
  like `wgettext_ft!`
- This commit updates the formatting so that devs with the latest stable don't
  see random format-fixes upon running `cargo fmt`
2023-08-24 18:16:24 +02:00
Fabian Boehm
0aa21440d1 docs/path: Remove incorrect status comments
During development, for a while `path change-extension` would return 0
when it found an extension to change.

This was later changed to returning 0 if there are any path arguments.

Neither of which is *super* useful, I admit, but we've picked one and
the docs shouldn't contradict it.
2023-08-24 18:06:03 +02:00
Fabian Boehm
8abd0319fb docs: Some slight rewordings 2023-08-23 23:08:56 +02:00
Fabian Boehm
5b1ff9459a sample_prompts/scales: Silence one last git call
Fixes #9975
2023-08-23 19:15:05 +02:00
Fabian Boehm
81cd035950 print_apt_packages: Go back to apt-cache for non-installed packages
Unfortunately, /var/lib/dpkg/status on recent-ish Debian versions at
least only contains the *installed* packages, rendering this solution
broken.

What we do instead is:

1. Remove a useless newline from each package, so our limit would now
let more full package data sets through
2. Increase the limit by 5x

This yields a completion that runs in ~800ms instead of ~700ms on a
raspberry pi, but gives ~10x the candidates, compared to the old
apt-cache version.

This partially reverts 96deaae7d8
2023-08-22 22:17:22 +02:00
Fabian Boehm
36a7924fa8 CHANGELOG: Document incompatible changes 2023-08-22 15:27:00 +02:00
figurantpp
6473a9c763 Shortens rsync completion description 2023-08-21 17:51:15 +02:00
figurantpp
5a934e7ae3 Removed type declarations from node descriptions 2023-08-21 17:51:15 +02:00
Kevin Cali
716001789b docs: correct insert mode key 2023-08-21 17:50:45 +02:00
Fabian Boehm
79aeb1656c docs/type: Correct "--no-functions"
This was accidentally changed in 3.2.0, when type was made a builtin.

Since it's been 4 releases and nobody has noticed, rather than
breaking things again let's leave it as it is, especially because the
option is named "--no-functions", not "--no-functions-or-builtins".
2023-08-21 17:44:21 +02:00