Compare commits

...

49 Commits

Author SHA1 Message Date
Johannes Altmanninger
03cee61f77 Atom feed of PRs adding/removing translations to/from po/*.po
(This is experimental, and our concrete need to automate this is not
super high, but I want to have a solution for this problem in general.)

There are various automated ways to notify people of changes to a
component, without them having to set up complicated filtering.
For example
1. using GitHub's codeowners feature, perhaps creating a GitHub team
   per component
2. by requiring all changes to the component to go through a fork
3. Using [public-inbox](https://public-inbox.org/)'s "lei" tool,
   which makes it easy to create a filter for all patches touching a given file
   (consumable as pull-based mbox or RSS feed), see
   https://people.kernel.org/monsieuricon/lore-lei-part-1-getting-started

Option 3 seems ideal because it allows anyone to subscribe/unsubscribe,
and it remains obvious where to send PRs to.

It would be fairly easy to write a client-side tool (fetch all commits
and/or PRs and look for interesting changes) but people are more likely
to use something that works OOTB with newsreaders / mail clients.

Expose atom feeds of PRs proposing translation additions/removals.
The one with removals is higher traffic because it can be triggered
when rewording a source string.

Feeds are already online. For example, use:

	https://raw.githubusercontent.com/fish-shell/fish-shell/fish-shell-events/po/zh_CN-additions.atom
	https://raw.githubusercontent.com/fish-shell/fish-shell/fish-shell-events/po/zh_CN-removals.atom

Ref: https://github.com/fish-shell/fish-shell/pull/11833#discussion_r2394161766
2025-10-03 10:26:56 +02:00
Johannes Altmanninger
db6a7d26cd update_translations.sh: add header to new files too
Fixes #11855
2025-10-01 18:30:38 +02:00
Johannes Altmanninger
6be03d7cc4 update_translations.sh: fix test invocation when passed a file in non-extant directory
Need to make sure test arguments are not empty lists.
2025-10-01 18:30:38 +02:00
Daniel Rainer
617a6edb13 Extract messages without building default features
Default features are not needed for message extraction, so there is no
need to spend any resources on them.

If a PO files contains a syntax error, extraction would fail if the
`localize-messages` feature is active. This is undesirable, because it
results in an unnecessary failure with worse error messages than if the
`msgmerge` invocation of the `update_translations.fish` script fails.

Closes #11849
2025-10-01 08:05:37 +02:00
王宇逸
31c85723e8 zh_CN: don't translate set command
Closes #11852
2025-10-01 08:02:38 +02:00
王宇逸
d22c905d9f zh_CN: fix typo
Part of #11852
2025-10-01 08:02:38 +02:00
Daniel Rainer
216dc2d473 Remove redundant variable declaration
Closes #11851
2025-10-01 08:00:21 +02:00
Daniel Rainer
918e7abe6b Hide output of msgfmt -h
This command is only used to determine availability of `msgfmt`. Without
these changes, the entire help output shows up if the code panics later
on, which adds useless bloat to the output, making it harder to analyze
what went wrong.

Closes #11848
2025-10-01 07:59:46 +02:00
Daniel Rainer
c145ee6df3 Check exit status of msgfmt
Prior to this, when `msgfmt` failed, this would be detected indirectly
by the parser, which would then panic due to it input being empty.

Explicit checking allows us to properly display `msgfmt`'s error
message.

Closes #11847
2025-10-01 07:59:21 +02:00
Johannes Altmanninger
62543b36a4 release.sh: sunset release announcement email
I'm not sure if our peer projects do this or if it's useful to have
on top of github releases (especially as most releases are patch
releases mainly).

We could certainly use "sphinx-build -b text" in
build_tools/release-notes.sh to extract a nice plaintext changelog
and send that, but that doesn't support links.  Not sure about HTML
email either.
2025-10-01 07:26:50 +02:00
Daniel Rainer
751aad5302 Refactor PO section marking
Use msgids to mark sections. In the PO format, comments are associated
with specific messages, which does not match the semantics for section
markers.
Furthermore, comments are not preserved by `msgmerge`, which required
quite convoluted handling to copy them over from the template.
By using msgids to mark sections, this problem is avoided.

This convoluted handling was also used for header comments. Header
comments are now handled in a simpler way. There is a fixed prefix,
identifying these comments, as well as a list variable containing the
lines which should be put into the header. When a PO file is generated,
all existing lines starting with the prefix are deleted, the and the
current version of the lines is prepended to the file.

Closes #11845
2025-09-30 19:45:31 +02:00
Daniel Rainer
efabab492a Remove useless comments
Most of them have been added automatically for no good reason.

Also remove outdated comments referring to source locations in pt_BR.po.

Closes #11844
2025-09-30 19:44:36 +02:00
Daniel Rainer
c7cdbe60cd Put general comments on top of empty msgid
These should not be comments on an actual message, since they apply
throughout the entire file, so the sensible location is as comments on
the empty msgid.

Closes #11843
2025-09-30 19:44:15 +02:00
Johannes Altmanninger
412149a5de Changelog update for 4.1.1 2025-09-30 19:22:41 +02:00
Johannes Altmanninger
abd23d2a1b Increase escape sequence timeout while waiting for query response
Running "fish -d reader" inside SSH inside Windows terminal sometimes
results in hangs on startup (or whenever we run "scrollback-push"),
because not all of the Primary DA response is available for reading
at once:

	reader: Incomplete escape sequence: \e\[?61\;4\;6\;7\;14\;21\;22\;23\;24\;28\;32

Work around this by increasing the read timeout while we're waiting
for query responses.

We should try to find a better (more comprehensive?) fix in future,
but for the patch release, this small change will do.

Fixes #11841
2025-09-30 19:00:40 +02:00
Johannes Altmanninger
b774c54a6f Changelog for translation fixes from #11833 2025-09-30 19:00:40 +02:00
王宇逸
e4b797405b zh_CN: fix tier 1 translations
Closes #11833
2025-09-30 18:41:44 +02:00
Johannes Altmanninger
81a89a5dec release-notes.sh: fix sphinx warning for patch release notes
Integration_4.1.1 fails to generate release notes with

	CHANGELOG.rst:9: WARNING: Bullet list ends without a blank
	line; unexpected unindent. [docutils].
2025-09-30 18:00:09 +02:00
Johannes Altmanninger
0da12a6b55 Primary Device Attribute is a proper noun
We don't care about any specific attributes but we do very much care
about the specific query and response format associated with VT100's
primary device attribute query. Use a proper noun to emphasize that
we want that one and no other.

Ref: https://github.com/fish-shell/fish-shell/pull/11833#discussion_r2385659040
2025-09-30 12:06:08 +02:00
Johannes Altmanninger
86ec8994e6 build.rs: fix MSRV (1.70) clippy 2025-09-30 12:06:08 +02:00
Johannes Altmanninger
caf426ddb2 po/de.po: copy-edit German translations
Go through all existing translations except for tier3.
2025-09-30 11:50:43 +02:00
Johannes Altmanninger
508ae410a6 builtin commandline: fix completion description 2025-09-30 11:47:26 +02:00
Johannes Altmanninger
993b977c9b builtin function: remove dead code 2025-09-30 11:47:26 +02:00
Johannes Altmanninger
a7f0138fc7 builtin function: fix a misleading error message
Issue introduced in 7914c92824 (replaced the functions '--rename'
option with '--copy'., 2010-09-09).
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
ab3c932903 builtin set: fix regression in error message description 2025-09-30 11:47:26 +02:00
Johannes Altmanninger
ae0fdadcff Remove translations for some error messages that basically never happen
Executable path is empty only in contrived circumstances.

The regex error happens only when the user explicitly turns off a
feature flag.

The orphaned process error seems very unlikely, not worth translating.
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
e3974989d8 Fix short description for builtin wait 2025-09-30 11:47:26 +02:00
Johannes Altmanninger
080b1e0e4f Translation update implied by parent commit
Part of #11833
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
a5db91dd85 po: add section markers to indicate translation priority
Part of #11833
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
b62f54631b Translation update implied by parent commit
Part of #11833
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
d835c5252a Prepare to not localize private function descriptions
The overwhelming majority of localizable messages comes from
completions:

	$ ls share/completions/ | wc -l
	$ 1048

OTOH functions also contribute a small amount, mostly via their
descriptions (so usually just one per file).

	$ ls share/functions/ | wc -l
	$ 237

Most of these are private and almost never shown to the user, so it's
not worth bothering translators with them. So:

- Skip private (see the parent commit) and deprecated functions.
- Skip wrapper functions like grep (where the translation seems to
  be provided by apropos), and even the English description is not
  helpful.
  - Assume that most real systems have "seq", "realpath" etc.,
    so it's no use providing our own translations for our fallbacks.
- Mark fish's own functions as tier1, and some barely-used functiosn
  and completions as tier3, so we can order them that way in
  po/*.po. Most translators should only look at tier1 and tier2.
  In future we could disable localization for tier3.

See the explanation at the bottom of
tests/checks/message-localization-tier-is-declared.fish

Part of #11833
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
a53db72564 Mark private functions that don't need localization
See the next commit.

Part of #11833
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
61b0368dac functions/realpath: remove weird wrapping
Wrapping the same thing is redundant and wrapping grealpath is kinda
pointless since we only provide completions for realpath.
2025-09-30 11:47:26 +02:00
Integral
568b4a22f9 completions/help: correct the spelling of "redirection"
Closes #11839
2025-09-30 11:47:26 +02:00
Jiangqiu Shen
8abba8a089 Re-add translations for share/completions/cjpm.fish
As removed in the parent commit.
Cherry-picked from e4c55131c7 (Update translation, 2025-07-04)
2025-09-30 11:47:26 +02:00
王宇逸
b3b789cd68 zh_CN: bad translations are worse than none
Part of #11833
2025-09-30 11:47:26 +02:00
Johannes Altmanninger
425a166111 functions/seq: use early return 2025-09-30 10:37:11 +02:00
Johannes Altmanninger
1dcc290e29 tests/checks/check-all-fish-files.fish: follow naming convention 2025-09-30 10:37:11 +02:00
Johannes Altmanninger
863204dbfa build.rs: remove dead code 2025-09-30 10:37:11 +02:00
Sebastian Fleer
4b21e7c9c7 webconfig: Replace str.stripprefix with str.removeprefix
str.stripprefix doesn't exist in Python:
https://docs.python.org/3/library/stdtypes.html#str.removeprefix

Closes #11840
2025-09-30 10:37:06 +02:00
Johannes Altmanninger
df5230ff4a Reliably disable modifyOtherKeys on WezTerm
WezTerm allows applications to enable modifyOtherKeys by default.
Its implementation has issues on non-English or non-QWERTY layouts,
see https://github.com/wezterm/wezterm/issues/6087 and #11204.

fish 4.0.1 disabled modifyOtherKeys on WezTerm specifically
(7ee6d91ba0 (Work around keyboard-layout related bugs in WezTerm's
modifyOtherKeys, 2025-03-03)), fish 4.1.0 didn't, because at that
time, WezTerm would advertise support for the kitty keyboard protocol
(even if applications are not allowed to enable it) which would make
fish skip requesting the legacy modifyOtherKeys.

WezTerm no longer advertises that if config.enable_kitty_keyboard
is false.  Let's work around it in another way.
2025-09-30 10:33:03 +02:00
Johannes Altmanninger
7cd0943056 Tighten some screws for TTY-specific workarounds 2025-09-30 10:25:23 +02:00
Johannes Altmanninger
6f0532460a fish_config: fix for non-embedded builds
I only tested with embedded-builds; CMake tests were failing because
they use different code paths here.

fish_config could use some love.  Start by extracting common
functionality between "{theme,prompt} show", fixing the behavior.

Fixes 29a35a7951 (fish_config: fix "prompt/theme show" in embed-data
builds, 2025-09-28).
2025-09-28 12:29:18 +02:00
Johannes Altmanninger
29a35a7951 fish_config: fix "prompt/theme show" in embed-data builds
Fixes #11832
2025-09-28 10:59:53 +02:00
Johannes Altmanninger
dd0d45f88f fish_config prompt: remove dead code
Commit 2b74affaf0 (Add prompt selector, 2021-04-22)
intentionally added an unused code path that checks for
$__fish_data_dir/sample_prompts, see

https://github.com/fish-shell/fish-shell/pull/7958#discussion_r621320945

> (note: This was added in preparation of moving the sample_prompts directory out of web_config -
> because it no longer is web-exclusive)

Remove it.
2025-09-28 10:11:01 +02:00
Johannes Altmanninger
0ff0de7efe release workflow: install msgfmt for staticbuilds
This makes us actually embed localized messages.

Part of #11828
2025-09-28 09:56:57 +02:00
Johannes Altmanninger
092ef99551 macos CI: explicitly install gettext
We need msgfmt for embedding translations.

Part of #11828
2025-09-28 09:54:30 +02:00
Johannes Altmanninger
97ae05b69d build_tools/release.sh: actually add new docs
Not quite sure for which step this is actually needed.  While at it,
fix the errexit issue that caused this blunder.
2025-09-27 22:56:49 +02:00
Johannes Altmanninger
3d8eca178e start new cycle
Created by ./build_tools/release.sh 4.1.0
2025-09-27 22:41:54 +02:00
253 changed files with 36046 additions and 38092 deletions

View File

@@ -163,7 +163,7 @@ jobs:
# --break-system-packages because homebrew has now declared itself "externally managed".
# this is CI so we don't actually care.
sudo pip3 install --break-system-packages pexpect
brew install tmux
brew install gettext tmux
- name: cmake
run: |
mkdir build && cd build

View File

@@ -80,7 +80,7 @@ jobs:
with:
targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
- name: Install dependencies
run: sudo apt install crossbuild-essential-arm64 musl-tools python3-sphinx
run: sudo apt install crossbuild-essential-arm64 gettext musl-tools python3-sphinx
- name: Build statically-linked executables
run: |
set -x
@@ -150,6 +150,8 @@ jobs:
uses: ./.github/actions/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Install dependencies
run: brew install gettext
- name: Build and codesign
run: |
die() { echo >&2 "$*"; exit 1; }

View File

@@ -0,0 +1,56 @@
on:
pull_request_target:
types: [opened, synchronize]
workflow_dispatch:
inputs:
pr_number:
description: Pull request number
required: true
type: number
permissions:
contents: write
jobs:
update-event-feeds:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt install python3-git python3-polib
sudo pip3 install --break-system-packages feedgen==1.0.0
- name: Update event feeds
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -x
if [ "${{ github.event_name }}" = pull_request ]; then
pr_number=${{ github.event.pull_request.number }}
else
pr_number=${{ inputs.pr_number }}
fi
# E.g. https://github.com/fish-shell/fish-shell
repo_url=${{ github.server_url }}/${{ github.repository }}
workflow_sha=${{ github.workflow_sha }}
run_id=${{ github.run_id }}
events_ref=refs/fish-shell-events
git clone "$repo_url" --revision="$events_ref" worktree --depth=1
cd worktree
git fetch origin "$workflow_sha" --depth=1
set -o pipefail
git show "$workflow_sha":build_tools/event-feeds.py |
python - "$pr_number"
git add .
if git diff --cached --exit-code; then
exit
fi
git config user.name fish-shell-bot
git config user.email fish-shell-bot
git commit -m "update via github run ID $run_id"
cat >>.git/config <<'EOF'
[credential]
username = fish-shell-bot
helper = !sh -c 'echo "password=$GITHUB_TOKEN"'
EOF
# Might fail due to a race; that's usually fine to ignore...
git push origin HEAD:"$events_ref" ||:

View File

@@ -1,3 +1,23 @@
fish ?.?.? (released ???)
=========================
fish 4.1.1 (released ???)
=========================
This release fixes the following regressions identified in 4.1.0:
- Many of our new Chinese translations were more confusing than helpful; they have been fixed or removed (:issue:`11833`).
Note that you can work around this type of issue by configuring fish's :doc:`message localization <cmds/_>`:
if your environment contains something like ``LANG=zh_CN.UTF-8``,
you can use ``set -g LC_MESSAGES en`` to use English messages inside fish.
This will not affect fish's child processes unless ``LC_MESSAGES`` was already exported.
- Some :doc:`fish_config <cmds/fish_config>` subcommands for showing prompts and themes had been broken in standalone Linux builds (those using the ``embed-data`` cargo feature), which has been fixed (:issue:`11832`).
- On Windows Terminal, we observed an issue where fish would fail to read the terminal's response to our new startup queries, causing noticeable lags and a misleading error message. A workaround has been added (:issue:`11841`).
- A WezTerm `issue breaking shifted key input <https://github.com/wezterm/wezterm/issues/6087>`__ has resurfaced on some versions of WezTerm; our workaround has been extended to cover all versions for now (:issue:`11204`).
- Fixed a crash in :doc:`the web-based configuration tool <cmds/fish_config>` when using the new underline styles (:issue:`11840`).
fish 4.1.0 (released September 27, 2025)
========================================
@@ -30,7 +50,7 @@ Deprecations and removed features
- The ``--install`` option when fish is built as self-installing is removed, see :ref:`below <changelog-4.1-embedded>`.
- ``set_color ff0000`` now outputs 24-bit RGB true-color even if :envvar:`COLORTERM` is unset.
One can override this by setting :envvar:`fish_term24bit` to 0 (:issue:`11372`).
- fish now requires the terminal to respond to queries for the :ref:`primary device attribute <term-compat-primary-da>`.
- fish now requires the terminal to respond to queries for the :ref:`Primary Device Attribute <term-compat-primary-da>`.
For now, this can be reversed via a :ref:`feature flag <featureflags>`,
by running (once) ``set -Ua fish_features no-query-term`` and restarting fish.
- Users of GNU screen may experience :ref:`minor glitches <term-compat-dcs-gnu-screen>` when starting fish.
@@ -83,9 +103,6 @@ Improved terminal support
- Support for double, curly, dotted and dashed underlines, for use in ``fish_color_*`` variables and the :doc:`set_color builtin <cmds/set_color>` (:issue:`10957`).
- Underlines can now be colored independent of text (:issue:`7619`).
- New documentation page :doc:`Terminal Compatibility <terminal-compatibility>` (also accessible via ``man fish-terminal-compatibility``) lists the terminal control sequences used by fish.
- fish now requires the terminal to respond to queries for the :ref:`primary device attribute <term-compat-primary-da>`.
For now, this can be reversed via a :ref:`feature flag <featureflags>`,
by running (once) ``set -Ua fish_features no-query-term``.
Other improvements
------------------

2
Cargo.lock generated
View File

@@ -105,7 +105,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "fish"
version = "4.1.0"
version = "4.1.0-snapshot"
dependencies = [
"bitflags",
"cc",

View File

@@ -64,7 +64,7 @@ debug = true
[package]
name = "fish"
version = "4.1.0"
version = "4.1.0-snapshot"
edition.workspace = true
rust-version.workspace = true
default-run = "fish"

View File

@@ -180,7 +180,7 @@ To install fish with embedded files, just use ``cargo``, like::
cargo install --git https://github.com/fish-shell/fish-shell --tag "$(curl -s https://api.github.com/repos/fish-shell/fish-shell/releases/latest | jq -r .tag_name)" # to build the latest release
cargo install --git https://github.com/fish-shell/fish-shell # to build the latest development snapshot
This will place the binaries in ``~/.cargo/bin/``, but you can place them wherever you want.
This will place the standalone binaries in ``~/.cargo/bin/``, but you can place them wherever you want.
This build won't have the HTML docs (``help`` will open the online version).
It will try to build the man pages with sphinx-build. If that is not available and you would like to include man pages, you need to install it and retrigger the build script, e.g. by setting FISH_BUILD_DOCS=1::

View File

@@ -3,7 +3,6 @@
use fish_build_helper::{fish_build_dir, workspace_root};
use rsconf::Target;
use std::env;
use std::error::Error;
use std::path::{Path, PathBuf};
fn canonicalize<P: AsRef<Path>>(path: P) -> PathBuf {
@@ -81,53 +80,44 @@ fn detect_cfgs(target: &mut Target) {
for (name, handler) in [
// Ignore the first entry, it just sets up the type inference. Model new entries after the
// second line.
(
"",
&(|_: &Target| Ok(false)) as &dyn Fn(&Target) -> Result<bool, Box<dyn Error>>,
),
("", &(|_: &Target| false) as &dyn Fn(&Target) -> bool),
("apple", &detect_apple),
("bsd", &detect_bsd),
("cygwin", &detect_cygwin),
("small_main_stack", &has_small_stack),
// See if libc supports the thread-safe localeconv_l(3) alternative to localeconv(3).
("localeconv_l", &|target| {
Ok(target.has_symbol("localeconv_l"))
target.has_symbol("localeconv_l")
}),
("FISH_USE_POSIX_SPAWN", &|target| {
Ok(target.has_header("spawn.h"))
target.has_header("spawn.h")
}),
("HAVE_PIPE2", &|target| {
Ok(target.has_symbol("pipe2"))
target.has_symbol("pipe2")
}),
("HAVE_EVENTFD", &|target| {
// FIXME: NetBSD 10 has eventfd, but the libc crate does not expose it.
if cfg!(target_os = "netbsd") {
Ok(false)
false
} else {
Ok(target.has_header("sys/eventfd.h"))
target.has_header("sys/eventfd.h")
}
}),
("HAVE_WAITSTATUS_SIGNAL_RET", &|target| {
Ok(target.r#if("WEXITSTATUS(0x007f) == 0x7f", &["sys/wait.h"]))
target.r#if("WEXITSTATUS(0x007f) == 0x7f", &["sys/wait.h"])
}),
] {
match handler(target) {
Err(e) => {
rsconf::warn!("{}: {}", name, e);
rsconf::declare_cfg(name, false);
},
Ok(enabled) => rsconf::declare_cfg(name, enabled),
}
rsconf::declare_cfg(name, handler(target))
}
}
fn detect_apple(_: &Target) -> Result<bool, Box<dyn Error>> {
Ok(cfg!(any(target_os = "ios", target_os = "macos")))
fn detect_apple(_: &Target) -> bool {
cfg!(any(target_os = "ios", target_os = "macos"))
}
fn detect_cygwin(_: &Target) -> Result<bool, Box<dyn Error>> {
fn detect_cygwin(_: &Target) -> bool {
// Cygwin target is usually cross-compiled.
Ok(std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "cygwin")
std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "cygwin"
}
/// Detect if we're being compiled for a BSD-derived OS, allowing targeting code conditionally with
@@ -136,13 +126,14 @@ fn detect_cygwin(_: &Target) -> Result<bool, Box<dyn Error>> {
/// Rust offers fine-grained conditional compilation per-os for the popular operating systems, but
/// doesn't necessarily include less-popular forks nor does it group them into families more
/// specific than "windows" vs "unix" so we can conditionally compile code for BSD systems.
fn detect_bsd(_: &Target) -> Result<bool, Box<dyn Error>> {
fn detect_bsd(_: &Target) -> bool {
// Instead of using `uname`, we can inspect the TARGET env variable set by Cargo. This lets us
// support cross-compilation scenarios.
let mut target = std::env::var("TARGET").unwrap();
if !target.chars().all(|c| c.is_ascii_lowercase()) {
target = target.to_ascii_lowercase();
}
#[allow(clippy::let_and_return)] // for old clippy
let is_bsd = target.ends_with("bsd") || target.ends_with("dragonfly");
#[cfg(any(
target_os = "dragonfly",
@@ -151,7 +142,7 @@ fn detect_bsd(_: &Target) -> Result<bool, Box<dyn Error>> {
target_os = "openbsd",
))]
assert!(is_bsd, "Target incorrectly detected as not BSD!");
Ok(is_bsd)
is_bsd
}
/// Rust sets the stack size of newly created threads to a sane value, but is at at the mercy of the
@@ -160,13 +151,13 @@ fn detect_bsd(_: &Target) -> Result<bool, Box<dyn Error>> {
///
/// 0.5 MiB is small enough that we'd have to drastically reduce MAX_STACK_DEPTH to less than 10, so
/// we instead use a workaround to increase the main thread size.
fn has_small_stack(_: &Target) -> Result<bool, Box<dyn Error>> {
fn has_small_stack(_: &Target) -> bool {
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "netbsd")))]
return Ok(false);
return false;
// NetBSD 10 also needs this but can't find pthread_get_stacksize_np.
#[cfg(target_os = "netbsd")]
return Ok(true);
return true;
#[cfg(any(target_os = "ios", target_os = "macos"))]
{
@@ -182,8 +173,8 @@ fn has_small_stack(_: &Target) -> Result<bool, Box<dyn Error>> {
let stack_size = unsafe { pthread_get_stacksize_np(pthread_self()) };
const TWO_MIB: usize = 2 * 1024 * 1024 - 1;
match stack_size {
0..=TWO_MIB => Ok(true),
_ => Ok(false),
0..=TWO_MIB => true,
_ => false,
}
}
}

155
build_tools/event-feeds.py Normal file
View File

@@ -0,0 +1,155 @@
from datetime import datetime
from pathlib import Path
from typing import Tuple
import dateutil.tz
import json
import re
import os
import subprocess
import sys
import xml.etree.ElementTree as ET
# TODO maybe use https://github.com/getpelican/feedgenerator instead?
from feedgen.feed import FeedGenerator
import git
import polib
def message_dictionary(repo, ref, file: Path):
po_contents = repo.git().show(f"{ref}:{file}")
messages = polib.pofile(po_contents)
return {e.msgid: e.msgstr for e in messages}
def write_feed(
feed_path: Path,
base_ref_oid: str,
title: str,
subtitle: str,
this_pr: Tuple[str, str] | None,
):
fg = FeedGenerator()
tree_url = (
"https://raw.githubusercontent.com/fish-shell/fish-shell/fish-shell-events"
)
feed_url = f"{tree_url}/{feed_path}"
fg.id(feed_url)
fg.title(title)
fg.subtitle(subtitle)
fg.link(href=feed_url, rel="self")
generator_url = f"https://github.com/fish-shell/fish-shell/blob/{base_ref_oid}/.github/workflows/update-event-feeds.yml"
fg.link(href=generator_url, rel="alternate")
entries = {}
if feed_path.exists():
tree = ET.parse(feed_path)
root = tree.getroot()
xmlns = "{http://www.w3.org/2005/Atom}"
for child in root.findall(f"{xmlns}entry"):
pr_url = child.find(f"{xmlns}id").text
pr_title = child.find(f"{xmlns}title").text
updated = child.find(f"{xmlns}updated").text
updated = datetime.fromisoformat(updated)
entries[pr_url] = (pr_title, updated)
if this_pr is not None:
(this_pr_title, this_pr_url) = this_pr
if this_pr_url not in entries:
entries[this_pr_url] = (this_pr_title, datetime.now(dateutil.tz.tzutc()))
for pr_url, (pr_title, updated) in entries.items():
fe = fg.add_entry()
fe.id(pr_url)
fe.title(pr_title)
fe.updated(updated)
fe.link(href=pr_url)
atomfeed = fg.atom_str(pretty=True).decode()
feed_path.write_text(atomfeed)
def pull_request_data(pr_number: str):
data = json.loads(
subprocess.check_output(
(
"gh",
"pr",
"view",
"--json",
"baseRefOid,headRefOid,title,url",
str(pr_number),
),
text=True,
)
)
base_ref_oid = data["baseRefOid"]
head_ref_oid = data["headRefOid"]
this_pr_title = data["title"]
this_pr_url = data["url"]
return (base_ref_oid, head_ref_oid, this_pr_title, this_pr_url)
def main():
pr_number = sys.argv[1]
(base_ref_oid, head_ref_oid, this_pr_title, this_pr_url) = pull_request_data(
pr_number
)
repo = git.Repo()
repo.git().execute(("git", "fetch", "origin", base_ref_oid, head_ref_oid))
po_files = (
Path(file)
for file in repo.git()
.execute(("git", "ls-tree", "--name-only", base_ref_oid, ":/po/"))
.splitlines()
)
changed_files = {
Path(file)
for file in subprocess.check_output(
("git", "diff", "--name-only", base_ref_oid, head_ref_oid), text=True
).splitlines()
if re.match(r"^po/\w+\.po$", file)
}
Path("po").mkdir(exist_ok=True)
for po_file in po_files:
file_without_extension = str(po_file).removesuffix(".po")
ll_CC = os.path.basename(file_without_extension)
feed_additions_path = Path(f"{file_without_extension}-additions.atom")
feed_removals_path = Path(f"{file_without_extension}-removals.atom")
def title(verb: str):
return f"fish-shell PRs {verb} {ll_CC} translations"
def write_additions(this_pr):
subtitle = "PRs that add new translations"
write_feed(
feed_additions_path, base_ref_oid, title("adding"), subtitle, this_pr
)
def write_removals(this_pr):
subtitle = "PRs that remove translations, often due to a change in the messages source"
write_feed(
feed_removals_path, base_ref_oid, title("removing"), subtitle, this_pr
)
if not feed_additions_path.exists():
write_additions(None)
if not feed_removals_path.exists():
write_removals(None)
if po_file not in changed_files:
continue
old = message_dictionary(repo, base_ref_oid, po_file)
new = message_dictionary(repo, head_ref_oid, po_file)
if any(
new_msgstr != old.get(new_msgid) and new_msgstr != ""
for (new_msgid, new_msgstr) in new.items()
):
write_additions((this_pr_title, this_pr_url))
elif any(
old_msgstr != "" and new.get(old_msgid, "") == ""
for (old_msgid, old_msgstr) in old.items()
):
write_removals((this_pr_title, this_pr_url))
if __name__ == "__main__":
main()

View File

@@ -19,7 +19,7 @@ begin
echo ""
end
set -g workspace_root (status dirname)/..
set -g workspace_root (path resolve (status dirname)/..)
set -l rust_extraction_file
if set -l --query _flag_use_existing_template
@@ -27,10 +27,19 @@ begin
else
set rust_extraction_file (mktemp)
# We need to build to ensure that the proc macro for extracting strings runs.
FISH_GETTEXT_EXTRACTION_FILE=$rust_extraction_file cargo check --features=gettext-extract
FISH_GETTEXT_EXTRACTION_FILE=$rust_extraction_file cargo check --no-default-features --features=gettext-extract
or exit 1
end
function mark_section
set -l section_name $argv[1]
echo 'msgid "fish-section-'$section_name'"'
echo 'msgstr ""'
echo ''
end
mark_section tier1-from-rust
# Get rid of duplicates and sort.
msguniq --no-wrap --strict --sort-output $rust_extraction_file
or exit 1
@@ -39,8 +48,9 @@ begin
rm $rust_extraction_file
end
function extract_fish_script_messages --argument-names regex
function extract_fish_script_messages_impl
set -l regex $argv[1]
set -e argv[1]
# Using xgettext causes more trouble than it helps.
# This is due to handling of escaping in fish differing from formats xgettext understands
# (e.g. POSIX shell strings).
@@ -59,24 +69,74 @@ begin
# 5. Double quotes are escaped, such that they are not interpreted as the start or end of
# a msgid.
# 6. We transform the string into the format expected in a PO file.
cat $share_dir/config.fish $share_dir/completions/*.fish $share_dir/functions/*.fish |
cat $argv |
string replace --filter --regex $regex '$1' |
string unescape |
sort -u |
sed -E -e 's_\\\\_\\\\\\\\_g' -e 's_"_\\\\"_g' -e 's_^(.*)$_msgid "\1"\nmsgstr ""\n_'
end
function extract_fish_script_messages
set -l tier $argv[1]
set -e argv[1]
if not set -q argv[1]
return
end
# This regex handles explicit requests to translate a message. These are more important to translate
# than messages which should be implicitly translated.
set -l explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'
mark_section "$tier-from-script-explicitly-added"
extract_fish_script_messages_impl $explicit_regex $argv
# This regex handles descriptions for `complete` and `function` statements. These messages are not
# particularly important to translate. Hence the "implicit" label.
set -l implicit_regex '^(?:\s|and |or )*(?:complete|function).*? (?:-d|--description) (([\'"]).+?(?<!\\\\)\\2).*'
mark_section "$tier-from-script-implicitly-added"
extract_fish_script_messages_impl $implicit_regex $argv
end
set -g share_dir $workspace_root/share
# This regex handles explicit requests to translate a message. These are more important to translate
# than messages which should be implicitly translated.
set -l explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'
extract_fish_script_messages $explicit_regex
set -l tier1 $share_dir/config.fish
set -l tier2
set -l tier3
# This regex handles descriptions for `complete` and `function` statements. These messages are not
# particularly important to translate. Hence the "implicit" label.
set -l implicit_regex '^(?:\s|and |or )*(?:complete|function).*? (?:-d|--description) (([\'"]).+?(?<!\\\\)\\2).*'
extract_fish_script_messages $implicit_regex
for file in $share_dir/completions/*.fish $share_dir/functions/*.fish
# set -l tier (string match -r '^# localization: .*' <$file)
set -l tier (string replace -rf -m1 \
'^# localization: (.*)$' '$1' <$file)
if set -q tier[1]
switch "$tier"
case tier1 tier2 tier3
set -a $tier $file
case 'skip*'
case '*'
echo >&2 "$file:1 unexpected localization tier: $tier"
exit 1
end
continue
end
set -l dirname (path basename (path dirname $file))
set -l command_name (path basename --no-extension $file)
if test $dirname = functions &&
string match -q -- 'fish_*' $command_name
set -a tier1 $file
continue
end
if test $dirname != completions
echo >&2 "$file:1 missing localization tier for function file"
exit 1
end
if test -e $workspace_root/doc_src/cmds/$command_name.rst
set -a tier1 $file
else
set -a tier3 $file
end
end
extract_fish_script_messages tier1 $tier1
extract_fish_script_messages tier2 $tier2
extract_fish_script_messages tier3 $tier3
end |
# At this point, all extracted strings have been written to stdout,
# starting with the ones taken from the Rust sources,

View File

@@ -53,14 +53,14 @@ previous_minor_version=${previous_version%.*}
)
fi
printf %s "$(awk <"$workspace_root/CHANGELOG.rst" '
printf '%s\n' "$(awk <"$workspace_root/CHANGELOG.rst" '
NR <= 2 || /^\.\. ignore / { next }
/^===/ { exit }
{ print }
' | sed '$d')" |
sed -e '$s/^----*$//' # Remove spurious transitions at the end of the document.
if [ "$minor_version" != "$previous_minor_version" ]; then
if [ "$minor_version" != "$previous_minor_version" ]; then {
JoinEscaped() {
sed 's/\S/\\&/g' |
awk '
@@ -79,7 +79,7 @@ previous_minor_version=${previous_version%.*}
echo
printf "Welcome back our returning committers: "
JoinEscaped <"$relnotes_tmp/committers-returning"
fi
} fi
echo
echo "---"
echo

View File

@@ -136,7 +136,10 @@ rm -rf "$tmpdir"
cd "$fish_site"
make
git add -u
! git ls-files --others --exclude-standard | grep .
git add docs
if git ls-files --others --exclude-standard | grep .; then
exit 1
fi
git commit --message="$(printf %s "\
| Release $version (docs)
|
@@ -184,7 +187,10 @@ done
cd "$fish_site"
make new-release
git add -u
! git ls-files --others --exclude-standard | grep .
git add docs
if git ls-files --others --exclude-standard | grep .; then
exit 1
fi
git commit --message="$(printf %s "\
| Release $version (release list update)
|
@@ -195,7 +201,7 @@ done
git push git@github.com:$repository_owner/fish-site HEAD:master
)
if [ -n "$integration_branch" ]; then
if [ -n "$integration_branch" ]; then {
git push $remote "$version^{commit}":refs/heads/$integration_branch
else
changelog=$(cat - CHANGELOG.rst <<EOF
@@ -207,21 +213,6 @@ EOF
printf %s\\n "$changelog" >CHANGELOG.rst
CommitVersion ${version}-snapshot "start new cycle"
git push $remote HEAD:master
fi
# TODO This can currently require a TTY for editing and password
# prompts.
if [ "$repository_owner" = fish-shell ]; then {
mail=$(mktemp)
cat >$mail <<EOF
From: $(git var GIT_AUTHOR_IDENT | sed 's/ [0-9]* +[0-9]*$//')
Subject: fish $version released
See https://github.com/fish-shell/fish-shell/releases/tag/$version
EOF
git send-email --suppress-cc=all --confirm=always $mail \
--to="fish-users Mailing List <fish-users@lists.sourceforge.net>"
rm $mail
} fi
exit

View File

@@ -31,7 +31,6 @@
set -gx LC_ALL C.UTF-8
set -l build_tools (status dirname)
set -g tmpdir
set -l po_dir $build_tools/../po
set -l extract
@@ -46,8 +45,8 @@ if test -z $argv[1]
else
set -l po_dir_id (stat --format='%d:%i' -- $po_dir)
for arg in $argv
set -l arg_dir_id (stat --format='%d:%i' -- (dirname $arg))
if test $po_dir_id != $arg_dir_id
set -l arg_dir_id (stat --format='%d:%i' -- (dirname $arg) 2>/dev/null)
if test $po_dir_id != "$arg_dir_id"
echo "Argument $arg is not a file in the directory $(realpath $po_dir)."
echo "Non-option arguments must specify paths to files in this directory."
echo ""
@@ -99,17 +98,54 @@ if set -l --query _flag_dry_run
cp -r $po_dir/* $tmpdir
end
# This is used to identify lines which should be set here via $header_lines.
# Make sure that this prefix does not appear elsewhere in the file and only contains characters
# without special meaning in a sed pattern.
set -g header_prefix "# fish-note: "
function print_header -a po_file
set -l ll_CC (basename $po_file .po)
set -l header_lines \
"To subscribe to proposed updates, point your feed reader at:" \
https://raw.githubusercontent.com/fish-shell/fish-shell/fish-shell-events/po/$ll_CC-additions.atom \
https://raw.githubusercontent.com/fish-shell/fish-shell/fish-shell-events/po/$ll_CC-removals.atom \
"Translations are divided into sections, each starting with a fish-section-* pseudo-message." \
"The first few sections are more important." \
"Ignore the tier3 sections unless you have a lot of time."
for line in $header_lines
printf '%s%s\n' $header_prefix $line
end
end
function merge_po_files --argument-names template_file po_file
msgmerge --no-wrap --update --no-fuzzy-matching --backup=none --quiet \
$po_file $template_file
or cleanup_exit
set -l new_po_file (mktemp) # TODO Remove on failure.
# Remove obsolete messages instead of keeping them as #~ entries.
and msgattrib --no-wrap --no-obsolete -o $new_po_file $po_file
or cleanup_exit
begin
print_header $po_file
# Paste PO file without old header lines.
sed '/^'$header_prefix'/d' $new_po_file
end >$po_file
rm $new_po_file
end
for po_file in $po_files
if set --query tmpdir[1]
set po_file $tmpdir/(basename $po_file)
end
if set -l --query po
if test -e $po_file
msgmerge --no-wrap --update --no-fuzzy-matching --backup=none --quiet $po_file $template_file
and msgattrib --no-wrap --no-obsolete -o $po_file $po_file
or cleanup_exit
merge_po_files $template_file $po_file
else
cp $template_file $po_file
begin
print_header $po_file
cat $template_file
end >$po_file
end
end
end

View File

@@ -2,7 +2,7 @@
env,
ffi::OsStr,
path::{Path, PathBuf},
process::Command,
process::{Command, Stdio},
};
fn main() {
@@ -34,7 +34,11 @@ fn embed_localizations(cache_dir: &Path) {
// for the respective language.
let mut catalogs = phf_codegen::Map::new();
match Command::new("msgfmt").arg("-h").status() {
match Command::new("msgfmt")
.arg("-h")
.stdout(Stdio::null())
.status()
{
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
rsconf::warn!(
"Cannot find msgfmt to build gettext message catalogs. Localization will not work."
@@ -97,6 +101,12 @@ fn embed_localizations(cache_dir: &Path) {
.arg(&po_file_path)
.output()
.unwrap();
if !output.status.success() {
panic!(
"msgfmt failed:\n{}",
String::from_utf8(output.stderr).unwrap()
);
}
let mo_data = output.stdout;
// Extract map from MO data.

View File

@@ -72,7 +72,7 @@ Required Commands
``\e[0c``
-
- Request primary device attribute.
- Request Primary Device Attribute.
The terminal must respond with a CSI command that starts with the ``?`` parameter byte (so a sequence starting with ``\e[?``) and has ``c`` as final byte.
Failure to implement this will cause a brief pause at startup followed by a warning.

3971
po/de.po

File diff suppressed because it is too large Load Diff

3849
po/en.po

File diff suppressed because it is too large Load Diff

3849
po/fr.po

File diff suppressed because it is too large Load Diff

3849
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3849
po/sv.po

File diff suppressed because it is too large Load Diff

49685
po/zh_CN.po

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,2 @@
# localization: tier1
complete ! --wraps not

View File

@@ -1 +1,2 @@
# localization: tier1
complete [ --wraps test

View File

@@ -11,7 +11,7 @@ complete -c commandline -s t -l current-token -d "Select token under cursor"
complete -c commandline -s b -l current-buffer -d "Select entire command line (default)"
complete -c commandline -s c -l cut-at-cursor -d "Only return that part of the command line before the cursor"
complete -c commandline -s f -l function -d "Inject readline functions to reader"
complete -c commandline -s f -l function -d "execute readline function"
complete -c commandline -s x -l tokens-expanded -d "Print a list of expanded tokens"
complete -c commandline -s I -l input -d "Specify command to operate on"

View File

@@ -1,3 +1,5 @@
# localization: skip(barely-used)
set --local CONDITION '! __fish_seen_argument --short r --long required-val --short o --long optional-val'
complete --command fish_opt --no-files

View File

@@ -122,7 +122,7 @@ complete -c help -x -a exporting-variables -d "What set -x does"
complete -c help -x -a functions -d "How to define functions"
complete -c help -x -a home-directory-expansion -d "~ expansion"
complete -c help -x -a index-range-expansion -d "var[x..y] slices"
complete -c help -x -a input-output-redirection -d "< and > redirectoins"
complete -c help -x -a input-output-redirection -d "< and > redirections"
complete -c help -x -a lists -d "Variables with multiple elements"
complete -c help -x -a loops-and-blocks -d "while, for and begin"
complete -c help -x -a more-on-universal-variables

View File

@@ -1,3 +1,4 @@
function N_ --description No-op
# localization: skip(deprecated)
function N_
printf "%s" $argv
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# returns 0 only if any argument is on of the supplied arguments
function __fish_any_arg_in
set -l haystack $argv

View File

@@ -1,4 +1,5 @@
function __fish_anyeditor --description "Print a editor to use, or an error message"
# localization: tier1
function __fish_anyeditor
set -l editor
if set -q VISUAL
echo $VISUAL | read -at editor

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_anypager --description "Print a pager to use"
set -l pager
# We prefer $PAGER if we have it

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_anypython
# Try python3 first, because that's usually faster and generally nicer.
# Do not consider the stub /usr/bin/python3 that comes installed on Darwin to be Python

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_append -d "Internal completion function for appending string to the commandline" --argument-names sep
set -e argv[1]
set -l str (commandline -tc | string replace -rf "(.*$sep)[^$sep]*" '$1' | string replace -r -- '--.*=' '')

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
if not type -q apropos
function __fish_apropos
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_argcomplete_complete
set -lx _ARGCOMPLETE 1
set -lx _ARGCOMPLETE_IFS \n

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cache_put
set -l cache_file $argv[1]
touch $cache_file

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cache_sourced_completions
# Allow a `--name=foo` option which ends up in the filename.
argparse -s name= -- $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cached --description "Cache the command output for a given amount of time"
argparse --min-args 1 --max-args 1 --stop-nonopt 't/max-age=!_validate_int --min 0' 'k/cache-key=' -- $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# This is meant to be bound to something like ctrl-c
function __fish_cancel_commandline
commandline -f cancel-commandline

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_change_key_bindings --argument-names bindings
set -g __fish_active_key_bindings $bindings
# Allow the user to set the variable universally

View File

@@ -1,4 +1,5 @@
function __fish_cmd__complete_args -d 'Function to generate args'
# localization: tier3
function __fish_cmd__complete_args
set -l current_token (commandline -tc)
switch $current_token

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# TODO: This function is deprecated. It was used in fish_clipboard_paste
# which some users copied, so maybe leave it around for a few years.
function __fish_commandline_is_singlequoted --description "Return 0 if the current token has an open single-quote"

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_atool_archive_contents --description 'List archive contents'
set -l cmd (commandline -cxp)
set -e cmd[1]

View File

@@ -1,5 +1,6 @@
# localization: tier3
#
# Bittorrent commands
function __fish_complete_bittorrent
complete -c $argv -l max_uploads -x --description "Maximum uploads at once"
complete -c $argv -l keepalive_interval -x --description "Number of seconds between keepalives"

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# Helper function for completions that need to enumerate block devices.
function __fish_complete_blockdevice
set -l cmd (commandline -ct)

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This function only emits completions that might result from matches against $CDPATH. We rely on
# the core file name completion logic to include all other possible matches.
function __fish_complete_cd -d "Completions for the cd command"

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This function is compatible with clang, clang++, and variations thereof, and is shared
# by clang.fish and clang++.fish.
# We dynamically query the head at `(commandline -x)[1]` to get the correct completions.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_command --description 'Complete using all available commands'
set -l ctoken "$(commandline -ct)"
switch $ctoken

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_convert_options --description 'Complete Convert options' --argument-names what
switch $what
case format Format

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
#
# Find directories that complete $argv[1], output them as completions
# with description $argv[2] if defined, otherwise use 'Directory'.

View File

@@ -1,4 +1,5 @@
function __fish_complete_docutils -d "Completions for Docutils common options" -a cmd
# localization: tier3
function __fish_complete_docutils -a cmd
complete -x -c $cmd -k -a "(__fish_complete_suffix .rst .txt)"
# General Docutils Options

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_freedesktop_icons -d 'List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`'
# The latest `icon-theme-spec` as of 2024-08-10 is 0.13
# https://specifications.freedesktop.org/icon-theme-spec/latest/

View File

@@ -1,4 +1,5 @@
function __fish_complete_ftp -d 'Complete ftp, pftp' --argument-names ftp
# localization: tier3
function __fish_complete_ftp --argument-names ftp
# Common across all ftp implementations
complete -c $ftp -xa "(__fish_print_hostnames)" -d Hostname
complete -c $ftp -s 4 -d 'Use IPv4 only'

View File

@@ -1,3 +1,4 @@
# localization: tier3
#
# Completions for the gpg program.
#
@@ -15,7 +16,7 @@
# removed. The remaining list of completions is still quite
# impressive.
function __fish_complete_gpg -d "Internal function for gpg completion code deduplication" -a __fish_complete_gpg_command
function __fish_complete_gpg -a __fish_complete_gpg_command
if string match -q 'gpg (GnuPG) 1.*' ($__fish_complete_gpg_command --version 2>/dev/null)
complete -c $__fish_complete_gpg_command -l simple-sk-checksum -d 'Integrity protect secret keys by using a SHA-1 checksum'
complete -c $__fish_complete_gpg_command -l no-sig-create-check -d "Do not verify each signature right after creation"

View File

@@ -1,5 +1,6 @@
# Helper function for contextual autocompletion of GPG key ids
# localization: skip(private)
# Helper function for contextual autocompletion of GPG key ids
function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_complete_gpg_command list_arg
# Use user id as description
set -l keyid

View File

@@ -1,5 +1,6 @@
# Helper function for contextual autocompletion of gpg user ids
# localization: skip(private)
# Helper function for contextual autocompletion of gpg user ids
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command list_arg
# gpg doesn't seem to like it when you use the whole key name as a
# completion, so we skip the <EMAIL> part and use it as a description.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_group_ids --description "Complete group IDs with group name as description"
if command -sq getent
getent group | string replace -f -r '^([[:alpha:]_][^:]*):[^:]*:(\d+).*' '$2\t$1'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
if command -sq getent
getent group | while read -l line

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_job_pids --description "Print a list of job PIDs and their commands"
if set -l jobpids (jobs -p)
# when run at the commandline, the first line of output is a header, but

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_list --argument-names div cmd prefix iprefix
if not set -q cmd[1]
echo "Usage:

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_complete_lpr -d 'Complete lpr common options' --argument-names cmd
complete -c $cmd -s E -d 'Forces encryption when connecting to the server'
complete -c $cmd -s U -d 'Specifies an alternate username' -xa '(__fish_complete_users)'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_lpr_option --description 'Complete lpr option'
set -l optstr "$(commandline -t)"
switch $optstr

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_complete_magick
complete -c $argv -o adjoin -d 'Join images into a single multi-image file'
complete -c $argv -o affine -d 'Affine transform matrix [matrix]'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_man
# Try to guess what section to search in. If we don't know, we
# use [^)]*, which should match any section.

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_print_user_ids
if command -sq getent
for line in (getent passwd)

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_mysql_query -a query
argparse -u 'u/user=' 'P/port=' 'h/host=' 'p/password=?' 'S/socket=' -- (commandline -px)
set -l mysql_cmd mysql

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_complete_netcat
set -l nc $argv[1]
set -l flavor $argv[-1]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_path --description "Complete using path"
set -l target
set -l description

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_pg_database
psql -AtqwlXF \t 2>/dev/null | awk 'NF > 1 { print $1 }'
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_pg_user
psql -AtqwXc 'select usename from pg_user' template1 2>/dev/null
end

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_complete_pgrep -d 'Complete pgrep/pkill' --argument-names cmd
complete -c $cmd -xa '(__fish_complete_proc)'
complete -c $cmd -s f -d 'Match pattern against full command line'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
# This may be a bit slower, but it's nice - having the tty displayed is really handy
# 'tail -n +2' deletes the first line, which contains the headers

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_ppp_peer --description 'Complete isp name for pon/poff'
find /etc/ppp/peers/ -type f -printf '%f\n'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_proc
# "comm=" means "print comm field with an empty name", which causes the header to be removed.
# On many systems, comm is truncated (e.g. on Linux it's 15 chars),

View File

@@ -1,3 +1,4 @@
# localization: tier3
function __fish_complete_ssh -d "common completions for ssh commands" --argument-names command
complete -c $command -s 4 -d "IPv4 only"
complete -c $command -s 6 -d "IPv6 only"

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing
# How many non-option tokens we skip in the input commandline before completing the subcommand
# Usually 1; use "--fcs-skip=2" to make it 2 (see e.g. tmux and ssh completions)

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# Find files ending in any of the non-switch arguments and output them as completions.
# * --description provides the description that should be part of each generated completion,
# * --prefix=DIR makes __fish_complete_suffix behave as if it were called in DIR rather than $PWD

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_user_at_hosts -d "Print list host-names with user@"
for user_at in (commandline -ct | string match -r '.*@'; or echo "")(__fish_print_hostnames)
echo $user_at

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_user_ids --description "Complete user IDs with user name as description"
if command -sq getent
getent passwd | string replace -f -r '^([[:alpha:]_][^:]*):[^:]*:(\d+).*' '$2\t$1'

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This should be used where you want user names with a description. Such as in an argument
# completion. If you just want a list of user names use __fish_print_users.
# The string replace command takes into account GECOS-formatted description fields, by retaining

View File

@@ -1,3 +1,5 @@
# localization: tier3
#
# Helper functions for wireshark/tshark/dumpcap completion
function __fish_wireshark_choices

View File

@@ -1,4 +1,5 @@
function __fish_complete_zfs_mountpoint_properties -d "Completes with ZFS mountpoint properties"
# localization: tier3
function __fish_complete_zfs_mountpoint_properties
set -l OS ""
switch (uname)
case Linux

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_zfs_pools -d "Completes with available ZFS pools"
zpool list -o name,comment -H | string replace -a \t'-' ''
end

View File

@@ -1,4 +1,5 @@
function __fish_complete_zfs_ro_properties -d "Completes with ZFS read-only properties"
# localization: tier3
function __fish_complete_zfs_ro_properties
echo -e "available\tAvailable space"
echo -e "avail\tAvailable space"
echo -e "compressratio\tAchieved compression ratio"

View File

@@ -1,4 +1,5 @@
function __fish_complete_zfs_rw_properties -d "Completes with ZFS read-write properties"
# localization: tier3
function __fish_complete_zfs_rw_properties
set -l OS ""
switch (uname)
case Linux

View File

@@ -1,4 +1,5 @@
function __fish_complete_zfs_write_once_properties -d "Completes with ZFS properties which can only be written at filesystem creation, and only be read thereafter"
# localization: tier3
function __fish_complete_zfs_write_once_properties
set -l OS ""
switch (uname)
case Linux

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This function is intended to be used to generate completions in `-a "(...)"` calls for arguments that take 1..n values
# separated by commas and we dynamically or statically generated a list of n values that must be combined and permuted
# in order to appease both the `complete` machinery and the target application.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
#
# Initializations that should only be performed when entering interactive mode.
#

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_contains_opt -d "Checks if a specific option has been given in the current commandline"
set -l next_short
set -l short_opt

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# a function to obtain a list of installed packages with CRUX pkgutils
function __fish_crux_packages -d 'Obtain a list of installed packages'
pkginfo -i | string split -f1 ' '

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cursor_konsole -d 'Set cursor (konsole)'
set -l shape $argv[1]
switch "$shape"

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cursor_xterm -d 'Set cursor (xterm)'
set -l shape $argv[1]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
#
# This function is used internally by the fish command completion code
#

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
set -l erase_line "$(
if status test-feature ignore-terminfo
echo \e\[K

View File

@@ -1,3 +1,4 @@
# localization: tier1
function __fish_edit_command_if_at_cursor --description 'If cursor is at the command token, edit the command source file'
set -l tokens (commandline -xpc)
set -l command

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# Retrieves the first non-switch argument from the command line buffer
function __fish_first_token
set -l tokens (commandline -cx)

View File

@@ -1,3 +1,4 @@
# localization: skip(deprecated)
function __fish_git_prompt
# TODO: This name is deprecated, figure out a way to tell users.
fish_git_prompt $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems"
set -l is_gnu 0

View File

@@ -1,3 +1,4 @@
# localization: skip(deprecated)
function __fish_hg_prompt
fish_hg_prompt
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
set -l dir "$(path dirname -- (status fish-path 2>/dev/null))"
if command -v $dir/fish_indent >/dev/null

Some files were not shown because too many files have changed in this diff Show More