mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-12 12:01:14 -03:00
Compare commits
160 Commits
faster-git
...
raw-tokens
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42063c7bbe | ||
|
|
f8743c2b20 | ||
|
|
3e098249a5 | ||
|
|
7cd7f31a93 | ||
|
|
5e12d4e99c | ||
|
|
f98d1779dd | ||
|
|
6f18a1b314 | ||
|
|
8b102f2571 | ||
|
|
514eebb002 | ||
|
|
41eb0a2fd0 | ||
|
|
290d957ab6 | ||
|
|
08b03a733a | ||
|
|
19a17fa981 | ||
|
|
13c00c9f79 | ||
|
|
19eceff3bc | ||
|
|
6a4d3a59ab | ||
|
|
3b0d5c342b | ||
|
|
884a2d100c | ||
|
|
a4d355634d | ||
|
|
3c620f56ee | ||
|
|
7679be3126 | ||
|
|
49926cfbac | ||
|
|
963c3425a3 | ||
|
|
55bddac90a | ||
|
|
20c67692e1 | ||
|
|
1e7088fb6b | ||
|
|
0f75df7c35 | ||
|
|
edb0617d13 | ||
|
|
d2f7d238f3 | ||
|
|
a7bed39c1e | ||
|
|
06646998db | ||
|
|
096f225579 | ||
|
|
ebec8c15ab | ||
|
|
92d9646631 | ||
|
|
ab1307c63b | ||
|
|
bebf3c129f | ||
|
|
60881f1195 | ||
|
|
320ebb6859 | ||
|
|
9bf6112b60 | ||
|
|
ef1a6aba26 | ||
|
|
ba00d721f4 | ||
|
|
fe8909e8f2 | ||
|
|
d369614ad9 | ||
|
|
4f4d941760 | ||
|
|
9b19db5c5f | ||
|
|
4f46d369c4 | ||
|
|
977459949f | ||
|
|
8cbcfc0b3a | ||
|
|
77738fd646 | ||
|
|
f438e80f9b | ||
|
|
ccb9c8225f | ||
|
|
33b651ad91 | ||
|
|
a20712b51d | ||
|
|
da426a1b03 | ||
|
|
fbb2fcdb06 | ||
|
|
537b1c3dd5 | ||
|
|
b4d0538892 | ||
|
|
9222381769 | ||
|
|
f2f54919af | ||
|
|
f40e31f675 | ||
|
|
43fbfa9a0f | ||
|
|
f6dbf17446 | ||
|
|
06578bd03d | ||
|
|
6491518b97 | ||
|
|
7e03bebf97 | ||
|
|
941701da3d | ||
|
|
eb211e1d10 | ||
|
|
a317a6acd9 | ||
|
|
d3f287c520 | ||
|
|
80131acff2 | ||
|
|
85fb937a4d | ||
|
|
1e571263a0 | ||
|
|
1a0a6f544d | ||
|
|
413ce9fdb3 | ||
|
|
03e3d0aa3f | ||
|
|
00c528c13f | ||
|
|
60dbb9c8ba | ||
|
|
2104f8a18a | ||
|
|
6f18a362e6 | ||
|
|
d67fdd1f02 | ||
|
|
d92bb57418 | ||
|
|
eb4cec1fe2 | ||
|
|
ef2e30cdc1 | ||
|
|
294d589d2f | ||
|
|
415232631a | ||
|
|
e10a12c0f2 | ||
|
|
6fffb76937 | ||
|
|
36e385e1fb | ||
|
|
e598010020 | ||
|
|
eba4c906ae | ||
|
|
fbb4a8d853 | ||
|
|
10e525c49c | ||
|
|
ec27b418e4 | ||
|
|
535a09a5b3 | ||
|
|
d584f36f5d | ||
|
|
c3740b85be | ||
|
|
d840fd9a7f | ||
|
|
592b059c30 | ||
|
|
86b9a0b876 | ||
|
|
6822a772fb | ||
|
|
912d93c99d | ||
|
|
74f4742565 | ||
|
|
a47dcad1ea | ||
|
|
69bd7cc9a5 | ||
|
|
b56ee16aa9 | ||
|
|
679cef9c0e | ||
|
|
01b623efce | ||
|
|
aa627ea935 | ||
|
|
c15a900f31 | ||
|
|
1136e656e0 | ||
|
|
456c9254fa | ||
|
|
ebc16e51d7 | ||
|
|
2d7a6063b9 | ||
|
|
7c57b746d0 | ||
|
|
64442cb464 | ||
|
|
07ead04890 | ||
|
|
5346d3d491 | ||
|
|
138c6c4c40 | ||
|
|
f8751a4f97 | ||
|
|
cdc2db5eae | ||
|
|
aea9cd6165 | ||
|
|
d0a490d76b | ||
|
|
b4392f6f7d | ||
|
|
7f2f5bb2f4 | ||
|
|
c47ecf9677 | ||
|
|
cd45a8c5cc | ||
|
|
99f78fb0b1 | ||
|
|
235108e2df | ||
|
|
e66b13ac3d | ||
|
|
0c211cbffb | ||
|
|
da5a394178 | ||
|
|
59bfd3ba6c | ||
|
|
631bde1081 | ||
|
|
383d2aa3e9 | ||
|
|
cac3d0ef16 | ||
|
|
4721ffe512 | ||
|
|
df097b114c | ||
|
|
2ebe3134cf | ||
|
|
d663f553df | ||
|
|
dcde198c94 | ||
|
|
b5c393dc39 | ||
|
|
f0a54510c3 | ||
|
|
d18d414745 | ||
|
|
ac44b3da91 | ||
|
|
0903e7a8f2 | ||
|
|
894139933d | ||
|
|
1aec1d3955 | ||
|
|
a138bc328b | ||
|
|
b9583bb16a | ||
|
|
80033adcf5 | ||
|
|
51a57870eb | ||
|
|
98b3ba5e8e | ||
|
|
08bf5c92a9 | ||
|
|
a84048511e | ||
|
|
46e8f12dbf | ||
|
|
7fe92be405 | ||
|
|
366034940f | ||
|
|
6239cba1e4 | ||
|
|
75d243faaa | ||
|
|
ba86028aaa |
30
.cirrus.yml
30
.cirrus.yml
@@ -26,7 +26,7 @@ linux_task:
|
||||
- lscpu || true
|
||||
- (cat /proc/meminfo | grep MemTotal) || true
|
||||
- mkdir build && cd build
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=6 ..
|
||||
- FISH_TEST_MAX_CONCURRENCY=6 cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
|
||||
- ninja -j 6 fish
|
||||
- ninja fish_run_tests
|
||||
only_if: $CIRRUS_REPO_OWNER == 'fish-shell'
|
||||
@@ -45,7 +45,7 @@ linux_arm_task:
|
||||
- lscpu || true
|
||||
- (cat /proc/meminfo | grep MemTotal) || true
|
||||
- mkdir build && cd build
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=6 ..
|
||||
- FISH_TEST_MAX_CONCURRENCY=6 cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
|
||||
- ninja -j 6 fish
|
||||
- file ./fish
|
||||
- ninja fish_run_tests
|
||||
@@ -54,17 +54,11 @@ linux_arm_task:
|
||||
|
||||
freebsd_task:
|
||||
matrix:
|
||||
# - name: FreeBSD 14
|
||||
# freebsd_instance:
|
||||
# image_family: freebsd-14-0-snap
|
||||
- name: FreeBSD 13
|
||||
- name: FreeBSD 14
|
||||
freebsd_instance:
|
||||
image: freebsd-13-2-release-amd64
|
||||
# - name: FreeBSD 12.3
|
||||
# freebsd_instance:
|
||||
# image: freebsd-12-3-release-amd64
|
||||
image: freebsd-14-3-release-amd64-ufs
|
||||
tests_script:
|
||||
- pkg install -y cmake-core devel/pcre2 devel/ninja misc/py-pexpect git-lite terminfo-db
|
||||
- pkg install -y cmake-core devel/pcre2 devel/ninja lang/rust misc/py-pexpect git-lite
|
||||
# libclang.so is a required build dependency for rust-c++ ffi bridge
|
||||
- pkg install -y llvm
|
||||
# BSDs have the following behavior: root may open or access files even if
|
||||
@@ -77,15 +71,7 @@ freebsd_task:
|
||||
- mkdir build && cd build
|
||||
- chown -R fish-user ..
|
||||
- sudo -u fish-user -s whoami
|
||||
# FreeBSD's pkg currently has rust 1.66.0 while we need rust 1.70.0+. Use rustup to install
|
||||
# the latest, but note that it only installs rust per-user.
|
||||
- sudo -u fish-user -s fetch -qo - https://sh.rustup.rs > rustup.sh
|
||||
- sudo -u fish-user -s sh ./rustup.sh -y --profile=minimal
|
||||
# `sudo -s ...` does not invoke a login shell so we need a workaround to make sure the
|
||||
# rustup environment is configured for subsequent `sudo -s ...` commands.
|
||||
# For some reason, this doesn't do the job:
|
||||
# - sudo -u fish-user sh -c 'echo source \$HOME/.cargo/env >> $HOME/.cshrc'
|
||||
- sudo -u fish-user -s cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=1 ..
|
||||
- sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja -j 6 fish'
|
||||
- sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja fish_run_tests'
|
||||
- sudo -u fish-user -s FISH_TEST_MAX_CONCURRENCY=1 cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
|
||||
- sudo -u fish-user -s ninja -j 6 fish
|
||||
- sudo -u fish-user -s ninja fish_run_tests
|
||||
only_if: $CIRRUS_REPO_OWNER == 'fish-shell'
|
||||
|
||||
@@ -15,8 +15,8 @@ indent_style = tab
|
||||
[*.{md,rst}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{sh,ac}]
|
||||
indent_size = 2
|
||||
[*.sh]
|
||||
indent_size = 4
|
||||
|
||||
[Dockerfile]
|
||||
indent_size = 2
|
||||
|
||||
5
.github/workflows/main.yml
vendored
5
.github/workflows/main.yml
vendored
@@ -3,7 +3,7 @@ name: make fish_run_tests
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
CTEST_PARALLEL_LEVEL: "4"
|
||||
FISH_TEST_MAX_CONCURRENCY: "4"
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: "4"
|
||||
|
||||
permissions:
|
||||
@@ -32,11 +32,8 @@ jobs:
|
||||
- name: make fish_run_tests
|
||||
run: |
|
||||
make -C build VERBOSE=1 fish_run_tests
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: translation updates
|
||||
run: |
|
||||
# Required for our custom xgettext implementation.
|
||||
cargo install --locked --version 1.0.106 cargo-expand
|
||||
# Generate PO files. This should not result it a change in the repo if all translations are
|
||||
# up to date.
|
||||
# Ensure that fish is available as an executable.
|
||||
|
||||
15
.github/workflows/rust_checks.yml
vendored
15
.github/workflows/rust_checks.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: cargo fmt
|
||||
run: cargo fmt --check --all
|
||||
run: cargo fmt --check
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -32,6 +32,19 @@ jobs:
|
||||
# into automatic CI failure day, so we don't do that.
|
||||
run: cargo clippy --workspace --all-targets
|
||||
|
||||
rustdoc:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: cargo doc
|
||||
run: |
|
||||
RUSTDOCFLAGS='-D warnings' cargo doc --workspace
|
||||
- name: cargo doctest
|
||||
run: |
|
||||
cargo test --doc --workspace
|
||||
|
||||
# Disabling for now because it also checks "advisories",
|
||||
# making CI fail for reasons unrelated to the patch
|
||||
# cargo-deny:
|
||||
|
||||
6
.github/workflows/staticbuild.yml
vendored
6
.github/workflows/staticbuild.yml
vendored
@@ -7,10 +7,6 @@ on:
|
||||
# - cron: "14 13 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CTEST_PARALLEL_LEVEL: "1"
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: "4"
|
||||
|
||||
jobs:
|
||||
staticbuilds-linux:
|
||||
|
||||
@@ -36,7 +32,7 @@ jobs:
|
||||
cargo build --release --target x86_64-unknown-linux-musl
|
||||
- name: Test
|
||||
run: |
|
||||
test -e tests/test_driver.py && tests/test_driver.py -f /tmp target/x86_64-unknown-linux-musl/release/
|
||||
tests/test_driver.py target/x86_64-unknown-linux-musl/release/
|
||||
- name: Compress
|
||||
run: |
|
||||
tar -cazf fish-static-x86_64-$(git describe).tar.xz -C target/x86_64-unknown-linux-musl/release/ fish
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -38,7 +38,6 @@ Desktop.ini
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
po/template.po
|
||||
*.mo
|
||||
.directory
|
||||
.fuse_hidden*
|
||||
@@ -78,6 +77,7 @@ __pycache__
|
||||
/share/__fish_build_paths.fish
|
||||
/share/pkgconfig
|
||||
/tests/*.tmp.*
|
||||
/tests/.last-check-all-files
|
||||
|
||||
# xcode
|
||||
## Build generated
|
||||
|
||||
@@ -50,6 +50,7 @@ Interactive improvements
|
||||
- Left mouse click (as requested by `click_events <terminal-compatibility.html#click-events>`__) can now select pager items (:issue:`10932`).
|
||||
- Instead of flashing all the text to the left of the cursor, fish now flashes the matched token during history token search, the completed token during completion (:issue:`11050`), the autosuggestion when deleting it, and the full command line in all other cases.
|
||||
- Pasted commands are now stripped of any ``$`` prefix.
|
||||
- The :kbd:`alt-s` binding will now also use ``run0`` if available.
|
||||
|
||||
New or improved bindings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -219,12 +219,10 @@ Or you can run them on a fish, without involving cmake::
|
||||
|
||||
cargo build
|
||||
cargo test # for the unit tests
|
||||
tests/test_driver.py --cachedir=/tmp target/debug # for the script and interactive tests
|
||||
tests/test_driver.py target/debug # for the script and interactive tests
|
||||
|
||||
Here, the first argument to test_driver.py refers to a directory with ``fish``, ``fish_indent`` and ``fish_key_reader`` in it.
|
||||
In this example we're in the root of the git repo and have run ``cargo build`` without ``--release``, so it's a debug build.
|
||||
The ``--cachedir /tmp`` argument means it will keep the fish_test_helper binary in /tmp instead of recompiling it for every test.
|
||||
This saves some time, but isn't strictly necessary.
|
||||
|
||||
Git hooks
|
||||
---------
|
||||
@@ -297,12 +295,6 @@ Adding translations for a new language
|
||||
Creating new translations requires the Gettext tools.
|
||||
More specifically, you will need ``msguniq`` and ``msgmerge`` for creating translations for a new
|
||||
language.
|
||||
In addition, the ``cargo-expand`` tool is required.
|
||||
If you have ``cargo`` installed, run::
|
||||
|
||||
cargo install --locked --version 1.0.106 cargo-expand
|
||||
|
||||
to install ``cargo-expand`` (Note that other versions might not work correctly with our scripts).
|
||||
To create a new translation, run::
|
||||
|
||||
build_tools/update_translations.fish po/LANG.po
|
||||
|
||||
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -104,6 +104,7 @@ dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"errno",
|
||||
"fish-gettext-extraction",
|
||||
"fish-printf",
|
||||
"libc",
|
||||
"lru",
|
||||
@@ -121,6 +122,13 @@ dependencies = [
|
||||
"widestring",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fish-gettext-extraction"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fish-printf"
|
||||
version = "0.2.1"
|
||||
@@ -348,18 +356,18 @@ checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.92"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.38"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["printf"]
|
||||
members = ["printf", "gettext-extraction"]
|
||||
|
||||
[workspace.package]
|
||||
# To build revisions that use Corrosion (those before 2024-01), use CMake 3.19, Rustc 1.78 and Rustup 1.27.
|
||||
rust-version = "1.70"
|
||||
edition = "2021"
|
||||
repository = "https://github.com/fish-shell/fish-shell"
|
||||
|
||||
[profile.release]
|
||||
overflow-checks = true
|
||||
@@ -24,7 +25,6 @@ default-run = "fish"
|
||||
# see doc_src/license.rst for details
|
||||
# don't forget to update COPYING and debian/copyright too
|
||||
license = "GPL-2.0-only AND LGPL-2.0-or-later AND MIT AND PSF-2.0"
|
||||
repository = "https://github.com/fish-shell/fish-shell"
|
||||
homepage = "https://fishshell.com"
|
||||
readme = "README.rst"
|
||||
|
||||
@@ -49,6 +49,7 @@ nix = { version = "0.30.1", default-features = false, features = [
|
||||
num-traits = "0.2.19"
|
||||
once_cell = "1.19.0"
|
||||
fish-printf = { path = "./printf", features = ["widestring"] }
|
||||
fish-gettext-extraction = { path = "./gettext-extraction" }
|
||||
|
||||
# Don't use the "getrandom" feature as it requires "getentropy" which was not
|
||||
# available on macOS < 10.12. We can enable "getrandom" when we raise the
|
||||
|
||||
56
build.rs
56
build.rs
@@ -3,7 +3,16 @@
|
||||
use rsconf::{LinkType, Target};
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn canonicalize<P: AsRef<Path>>(path: P) -> PathBuf {
|
||||
std::fs::canonicalize(path).unwrap()
|
||||
}
|
||||
fn canonicalize_str<P: AsRef<Path>>(path: P) -> String {
|
||||
canonicalize(path).to_str().unwrap().to_owned()
|
||||
}
|
||||
|
||||
const MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR");
|
||||
|
||||
fn main() {
|
||||
setup_paths();
|
||||
@@ -11,23 +20,19 @@ fn main() {
|
||||
// Add our default to enable tools that don't go through CMake, like "cargo test" and the
|
||||
// language server.
|
||||
|
||||
let cargo_target_dir: PathBuf = option_env!("CARGO_TARGET_DIR")
|
||||
.map(canonicalize)
|
||||
.unwrap_or(canonicalize(MANIFEST_DIR).join("target"));
|
||||
|
||||
// FISH_BUILD_DIR is set by CMake, if we are using it.
|
||||
// OUT_DIR is set by Cargo when the build script is running (not compiling)
|
||||
let default_build_dir = env::var("OUT_DIR").unwrap();
|
||||
let build_dir = option_env!("FISH_BUILD_DIR").unwrap_or(&default_build_dir);
|
||||
let build_dir = std::fs::canonicalize(build_dir).unwrap();
|
||||
let build_dir = build_dir.to_str().unwrap();
|
||||
rsconf::set_env_value("FISH_BUILD_DIR", build_dir);
|
||||
rsconf::set_env_value(
|
||||
"FISH_BUILD_DIR",
|
||||
option_env!("FISH_BUILD_DIR").unwrap_or(cargo_target_dir.to_str().unwrap()),
|
||||
);
|
||||
|
||||
// We need to canonicalize (i.e. realpath) the manifest dir because we want to be able to
|
||||
// compare it directly as a string at runtime.
|
||||
rsconf::set_env_value(
|
||||
"CARGO_MANIFEST_DIR",
|
||||
std::fs::canonicalize(env!("CARGO_MANIFEST_DIR"))
|
||||
.unwrap()
|
||||
.as_path()
|
||||
.to_str()
|
||||
.unwrap(),
|
||||
);
|
||||
rsconf::set_env_value("CARGO_MANIFEST_DIR", &canonicalize_str(MANIFEST_DIR));
|
||||
|
||||
// Some build info
|
||||
rsconf::set_env_value("BUILD_TARGET_TRIPLE", &env::var("TARGET").unwrap());
|
||||
@@ -41,8 +46,7 @@ fn main() {
|
||||
|
||||
std::env::set_var("FISH_BUILD_VERSION", version);
|
||||
|
||||
let cman = std::fs::canonicalize(env!("CARGO_MANIFEST_DIR")).unwrap();
|
||||
let targetman = cman.as_path().join("target").join("man");
|
||||
let targetman = cargo_target_dir.join("fish-man");
|
||||
|
||||
#[cfg(feature = "embed-data")]
|
||||
#[cfg(not(clippy))]
|
||||
@@ -63,10 +67,9 @@ fn main() {
|
||||
#[cfg(not(debug_assertions))]
|
||||
rsconf::rebuild_if_paths_changed(&["doc_src", "share"]);
|
||||
|
||||
cc::Build::new()
|
||||
.file("src/libc.c")
|
||||
.include(build_dir)
|
||||
.compile("flibc.a");
|
||||
rsconf::rebuild_if_env_changed("FISH_GETTEXT_EXTRACTION_FILE");
|
||||
|
||||
cc::Build::new().file("src/libc.c").compile("flibc.a");
|
||||
|
||||
let mut build = cc::Build::new();
|
||||
// Add to the default library search path
|
||||
@@ -252,8 +255,6 @@ fn has_small_stack(_: &Target) -> Result<bool, Box<dyn Error>> {
|
||||
}
|
||||
|
||||
fn setup_paths() {
|
||||
#[cfg(unix)]
|
||||
use std::path::PathBuf;
|
||||
#[cfg(windows)]
|
||||
use unix_path::{Path, PathBuf};
|
||||
|
||||
@@ -351,8 +352,8 @@ fn get_version(src_dir: &Path) -> String {
|
||||
// or because it refused (safe.directory applies to `git describe`!)
|
||||
// So we read the SHA ourselves.
|
||||
fn get_git_hash() -> Result<String, Box<dyn std::error::Error>> {
|
||||
let gitdir = Path::new(env!("CARGO_MANIFEST_DIR")).join(".git");
|
||||
let jjdir = Path::new(env!("CARGO_MANIFEST_DIR")).join(".jj");
|
||||
let gitdir = Path::new(MANIFEST_DIR).join(".git");
|
||||
let jjdir = Path::new(MANIFEST_DIR).join(".jj");
|
||||
let commit_id = if gitdir.exists() {
|
||||
// .git/HEAD contains ref: refs/heads/branch
|
||||
let headpath = gitdir.join("HEAD");
|
||||
@@ -397,10 +398,7 @@ fn build_man(build_dir: &Path) {
|
||||
use std::process::Command;
|
||||
let mandir = build_dir;
|
||||
let sec1dir = mandir.join("man1");
|
||||
let docsrc_path = std::fs::canonicalize(env!("CARGO_MANIFEST_DIR"))
|
||||
.unwrap()
|
||||
.as_path()
|
||||
.join("doc_src");
|
||||
let docsrc_path = canonicalize(MANIFEST_DIR).join("doc_src");
|
||||
let docsrc = docsrc_path.to_str().unwrap();
|
||||
let args = &[
|
||||
"-j",
|
||||
|
||||
54
build_tools/check.sh
Executable file
54
build_tools/check.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
{
|
||||
set -ex
|
||||
|
||||
lint=true
|
||||
if [ "$FISH_CHECK_LINT" = false ]; then
|
||||
lint=false
|
||||
fi
|
||||
|
||||
cargo_args=$FISH_CHECK_CARGO_ARGS
|
||||
target_triple=$FISH_CHECK_TARGET_TRIPLE
|
||||
if [ -n "$target_triple" ]; then
|
||||
cargo_args="$cargo_args --target=$FISH_CHECK_TARGET_TRIPLE"
|
||||
fi
|
||||
|
||||
cargo() {
|
||||
subcmd=$1
|
||||
shift
|
||||
# shellcheck disable=2086
|
||||
command cargo "$subcmd" $cargo_args "$@"
|
||||
}
|
||||
|
||||
cleanup () {
|
||||
if [ -n "$template_file" ] && [ -e "$template_file" ]; then
|
||||
rm "$template_file"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT TERM HUP
|
||||
|
||||
if $lint; then
|
||||
export RUSTFLAGS="--deny=warnings ${RUSTFLAGS}"
|
||||
export RUSTDOCFLAGS="--deny=warnings ${RUSTDOCFLAGS}"
|
||||
fi
|
||||
|
||||
repo_root="$(dirname "$0")/.."
|
||||
build_dir="${CARGO_TARGET_DIR:-$repo_root/target}/${target_triple}/debug"
|
||||
|
||||
template_file=$(mktemp)
|
||||
FISH_GETTEXT_EXTRACTION_FILE=$template_file cargo build --workspace --all-targets
|
||||
if $lint; then
|
||||
PATH="$build_dir:$PATH" "$repo_root/build_tools/style.fish" --all --check
|
||||
cargo clippy --workspace --all-targets
|
||||
fi
|
||||
cargo test --no-default-features --workspace --all-targets
|
||||
cargo test --doc --workspace
|
||||
if $lint; then
|
||||
cargo doc --workspace
|
||||
fi
|
||||
FISH_GETTEXT_EXTRACTION_FILE=$template_file "$repo_root/tests/test_driver.py" "$build_dir"
|
||||
|
||||
exit
|
||||
}
|
||||
@@ -5,7 +5,8 @@
|
||||
#
|
||||
# Usage: ./diff_profiles.fish profile1.log profile2.log > profile_diff.log
|
||||
|
||||
if test (count $argv) -ne 2;
|
||||
if test (count $argv) -ne 2
|
||||
|
||||
echo "Incorrect number of arguments."
|
||||
echo "Usage: "(status filename)" profile1.log profile2.log"
|
||||
exit 1
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
#
|
||||
# Tool to generate gettext messages template file.
|
||||
# Writes to stdout.
|
||||
# Intended to be called from `update_translations.fish`.
|
||||
|
||||
argparse use-existing-template= -- $argv
|
||||
or exit $status
|
||||
|
||||
begin
|
||||
# Write header. This is required by msguniq.
|
||||
@@ -15,45 +19,25 @@ begin
|
||||
echo ""
|
||||
end
|
||||
|
||||
set -l cargo_expanded_file (mktemp)
|
||||
# This is a gigantic crime.
|
||||
# We use cargo-expand to get all our wgettext invocations.
|
||||
# This might be replaced once we have a tool which properly handles macro expansions.
|
||||
begin
|
||||
cargo expand --lib
|
||||
for f in fish fish_indent fish_key_reader
|
||||
cargo expand --bin $f
|
||||
end
|
||||
end >$cargo_expanded_file
|
||||
set -g repo_root (status dirname)/..
|
||||
|
||||
set -l rust_string_file (mktemp)
|
||||
set -l rust_extraction_file
|
||||
if set -l --query _flag_use_existing_template
|
||||
set rust_extraction_file $_flag_use_existing_template
|
||||
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
|
||||
or exit 1
|
||||
end
|
||||
|
||||
# Extract any gettext call
|
||||
grep -A1 wgettext_static_str <$cargo_expanded_file |
|
||||
grep 'widestring::internals::core::primitive::str =' |
|
||||
string match -rg '"(.*)"' |
|
||||
string match -rv '^%ls$|^$' |
|
||||
# escaping difference between gettext and cargo-expand: single-quotes
|
||||
string replace -a "\'" "'" >$rust_string_file
|
||||
# Get rid of duplicates and sort.
|
||||
msguniq --no-wrap --strict --sort-output $rust_extraction_file
|
||||
or exit 1
|
||||
|
||||
# Extract any constants
|
||||
grep -Ev 'BUILD_VERSION:|PACKAGE_NAME' <$cargo_expanded_file |
|
||||
grep -E 'const [A-Z_]*: &str = "(.*)"' |
|
||||
sed -E -e 's/^.*const [A-Z_]*: &str = "(.*)".*$/\1/' -e "s_\\\'_'_g" >>$rust_string_file
|
||||
|
||||
rm $cargo_expanded_file
|
||||
|
||||
# Sort the extracted strings and remove duplicates.
|
||||
# Then, transform them into the po format.
|
||||
# If a string contains a '%' it is considered a format string and marked with a '#, c-format'.
|
||||
# This allows msgfmt to identify issues with translations whose format string does not match the
|
||||
# original.
|
||||
sort -u $rust_string_file |
|
||||
sed -E -e '/%/ i\
|
||||
#, c-format
|
||||
' -e 's/^(.*)$/msgid "\1"\nmsgstr ""\n/'
|
||||
|
||||
rm $rust_string_file
|
||||
if not set -l --query _flag_use_existing_template
|
||||
rm $rust_extraction_file
|
||||
end
|
||||
|
||||
function extract_fish_script_messages --argument-names regex
|
||||
|
||||
@@ -75,13 +59,15 @@ 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/config.fish share/completions/*.fish share/functions/*.fish |
|
||||
cat $share_dir/config.fish $share_dir/completions/*.fish $share_dir/functions/*.fish |
|
||||
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
|
||||
|
||||
set -g share_dir $repo_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) *\).*'
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
# Script to produce an OS X installer .pkg and .app(.zip)
|
||||
|
||||
usage() {
|
||||
echo "Build macOS packages, optionally signing and notarizing them."
|
||||
echo "Usage: $0 options"
|
||||
echo "Options:"
|
||||
echo " -s Enables code signing"
|
||||
echo " -f <APP_KEY.p12> Path to .p12 file for application signing"
|
||||
echo " -i <INSTALLER_KEY.p12> Path to .p12 file for installer signing"
|
||||
echo " -p <PASSWORD> Password for the .p12 files (necessary to access the certificates)"
|
||||
echo " -e <entitlements file> (Optional) Path to an entitlements XML file"
|
||||
echo " -n Enables notarization. This will fail if code signing is not also enabled."
|
||||
echo " -j <API_KEY.JSON> Path to JSON file generated with \`rcodesign encode-app-store-connect-api-key\` (required for notarization)"
|
||||
echo
|
||||
exit 1
|
||||
echo "Build macOS packages, optionally signing and notarizing them."
|
||||
echo "Usage: $0 options"
|
||||
echo "Options:"
|
||||
echo " -s Enables code signing"
|
||||
echo " -f <APP_KEY.p12> Path to .p12 file for application signing"
|
||||
echo " -i <INSTALLER_KEY.p12> Path to .p12 file for installer signing"
|
||||
echo " -p <PASSWORD> Password for the .p12 files (necessary to access the certificates)"
|
||||
echo " -e <entitlements file> (Optional) Path to an entitlements XML file"
|
||||
echo " -n Enables notarization. This will fail if code signing is not also enabled."
|
||||
echo " -j <API_KEY.JSON> Path to JSON file generated with \`rcodesign encode-app-store-connect-api-key\` (required for notarization)"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
@@ -33,32 +33,32 @@ X86_64_DEPLOY_TARGET='MACOSX_DEPLOYMENT_TARGET=10.9'
|
||||
RUST_VERSION_X86_64=1.73.0
|
||||
|
||||
while getopts "sf:i:p:e:nj:" opt; do
|
||||
case $opt in
|
||||
s) SIGN=1;;
|
||||
f) P12_APP_FILE=$(realpath "$OPTARG");;
|
||||
i) P12_INSTALL_FILE=$(realpath "$OPTARG");;
|
||||
p) P12_PASSWORD="$OPTARG";;
|
||||
e) ENTITLEMENTS_FILE=$(realpath "$OPTARG");;
|
||||
n) NOTARIZE=1;;
|
||||
j) API_KEY_FILE=$(realpath "$OPTARG");;
|
||||
\?) usage;;
|
||||
esac
|
||||
case $opt in
|
||||
s) SIGN=1;;
|
||||
f) P12_APP_FILE=$(realpath "$OPTARG");;
|
||||
i) P12_INSTALL_FILE=$(realpath "$OPTARG");;
|
||||
p) P12_PASSWORD="$OPTARG";;
|
||||
e) ENTITLEMENTS_FILE=$(realpath "$OPTARG");;
|
||||
n) NOTARIZE=1;;
|
||||
j) API_KEY_FILE=$(realpath "$OPTARG");;
|
||||
\?) usage;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$SIGN" ] && { [ -z "$P12_APP_FILE" ] || [ -z "$P12_INSTALL_FILE" ] || [ -z "$P12_PASSWORD" ]; }; then
|
||||
usage
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -n "$NOTARIZE" ] && [ -z "$API_KEY_FILE" ]; then
|
||||
usage
|
||||
usage
|
||||
fi
|
||||
|
||||
VERSION=$(git describe --always --dirty 2>/dev/null)
|
||||
if test -z "$VERSION" ; then
|
||||
echo "Could not get version from git"
|
||||
if test -f version; then
|
||||
VERSION=$(cat version)
|
||||
fi
|
||||
echo "Could not get version from git"
|
||||
if test -f version; then
|
||||
VERSION=$(cat version)
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Version is $VERSION"
|
||||
@@ -76,7 +76,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
|
||||
# and will probably not be built universal, so the package will fail to validate/run on other systems.
|
||||
# Note CMAKE_OSX_ARCHITECTURES is still relevant for the Mac app.
|
||||
{ cd "$PKGDIR/build_arm64" \
|
||||
&& cmake \
|
||||
&& cmake \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
|
||||
-DWITH_GETTEXT=OFF \
|
||||
@@ -91,7 +91,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
|
||||
# Build for x86-64 but do not install; instead we will make some fat binaries inside the root.
|
||||
# Set RUST_VERSION_X86_64 to the last version of Rust that supports macOS 10.9.
|
||||
{ cd "$PKGDIR/build_x86_64" \
|
||||
&& cmake \
|
||||
&& cmake \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
|
||||
-DWITH_GETTEXT=OFF \
|
||||
@@ -99,7 +99,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
|
||||
-DRust_CARGO_TARGET=x86_64-apple-darwin \
|
||||
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \
|
||||
-DFISH_USE_SYSTEM_PCRE2=OFF "$SRC_DIR" \
|
||||
&& env $X86_64_DEPLOY_TARGET make VERBOSE=1 -j 12; }
|
||||
&& env $X86_64_DEPLOY_TARGET make VERBOSE=1 -j 12; }
|
||||
|
||||
# Fatten them up.
|
||||
for FILE in "$PKGDIR"/root/usr/local/bin/*; do
|
||||
|
||||
@@ -18,22 +18,22 @@ set -e
|
||||
BUILD_TOOL="make"
|
||||
BUILD_GENERATOR="Unix Makefiles"
|
||||
if command -v ninja >/dev/null; then
|
||||
BUILD_TOOL="ninja"
|
||||
BUILD_GENERATOR="Ninja"
|
||||
BUILD_TOOL="ninja"
|
||||
BUILD_GENERATOR="Ninja"
|
||||
fi
|
||||
|
||||
# We need GNU tar as that supports the --mtime and --transform options
|
||||
TAR=notfound
|
||||
for try in tar gtar gnutar; do
|
||||
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
|
||||
TAR=$try
|
||||
break
|
||||
fi
|
||||
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
|
||||
TAR=$try
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$TAR" = "notfound" ]; then
|
||||
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
|
||||
exit 1
|
||||
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the current directory, which we'll use for symlinks
|
||||
@@ -63,7 +63,7 @@ cmake -G "$BUILD_GENERATOR" -DCMAKE_BUILD_TYPE=Debug "$wd"
|
||||
$BUILD_TOOL doc
|
||||
|
||||
TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 \
|
||||
--mode=g+w,a+rX --transform s/^/$prefix\//"
|
||||
--mode=g+w,a+rX --transform s/^/$prefix\//"
|
||||
$TAR_APPEND --no-recursion user_doc
|
||||
$TAR_APPEND user_doc/html user_doc/man
|
||||
$TAR_APPEND version
|
||||
|
||||
@@ -11,15 +11,15 @@ set -e
|
||||
# We need GNU tar as that supports the --mtime and --transform options
|
||||
TAR=notfound
|
||||
for try in tar gtar gnutar; do
|
||||
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
|
||||
TAR=$try
|
||||
break
|
||||
fi
|
||||
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
|
||||
TAR=$try
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$TAR" = "notfound" ]; then
|
||||
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
|
||||
exit 1
|
||||
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the current directory, which we'll use for telling Cargo where to find the sources
|
||||
|
||||
@@ -1,38 +1,53 @@
|
||||
#!/usr/bin/env fish
|
||||
#
|
||||
# This runs C++ files and fish scripts (*.fish) through their respective code
|
||||
# formatting programs.
|
||||
# This runs Python files, fish scripts (*.fish), and Rust files
|
||||
# through their respective code formatting programs.
|
||||
#
|
||||
# `--all`: Format all eligible files instead of the ones specified as arguments.
|
||||
# `--check`: Instead of reformatting, fail if a file is not formatted correctly.
|
||||
# `--force`: Proceed without asking if uncommitted changes are detected.
|
||||
# Only relevant if `--all` is specified but `--check` is not specified.
|
||||
|
||||
set -l fish_files
|
||||
set -l python_files
|
||||
set -l rust_files
|
||||
set -l all no
|
||||
|
||||
if test "$argv[1]" = --all
|
||||
argparse all check force -- $argv
|
||||
or exit $status
|
||||
|
||||
if set -l -q _flag_all
|
||||
set all yes
|
||||
set -e argv[1]
|
||||
if set -q argv[1]
|
||||
echo "Unexpected arguments: '$argv'"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
if set -q argv[1]
|
||||
echo "Unexpected arguments: '$argv'"
|
||||
exit 1
|
||||
end
|
||||
set -l repo_root (status dirname)/..
|
||||
|
||||
if test $all = yes
|
||||
set -l files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
|
||||
if set -q files[1]
|
||||
echo
|
||||
echo 'You have uncommitted changes. Are you sure you want to restyle?'
|
||||
read -P 'y/N? ' -n1 -l ans
|
||||
if not string match -qi y -- $ans
|
||||
exit 1
|
||||
if not set -l -q _flag_force; and not set -l -q _flag_check
|
||||
# Potential for false positives: Not all fish files are formatted, see the `fish_files`
|
||||
# definition below.
|
||||
set -l relevant_uncommitted_changes (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//' | grep -E '.*\.(fish|py|rs)$')
|
||||
if set -q relevant_uncommitted_changes[1]
|
||||
for changed_file in $relevant_uncommitted_changes
|
||||
echo $changed_file
|
||||
end
|
||||
echo
|
||||
echo 'You have uncommitted changes (listed above). Are you sure you want to restyle?'
|
||||
read -P 'y/N? ' -n1 -l ans
|
||||
if not string match -qi y -- $ans
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
end
|
||||
set fish_files share/**.fish
|
||||
set fish_files $repo_root/{benchmarks,build_tools,etc,share}/**.fish
|
||||
set python_files {doc_src,share,tests}/**.py
|
||||
set rust_files fish-rust/src/**.rs
|
||||
else
|
||||
# Extract just the fish files.
|
||||
# Format the files specified as arguments.
|
||||
set -l files $argv
|
||||
set fish_files (string match -r '^.*\.fish$' -- $files)
|
||||
set python_files (string match -r '^.*\.py$' -- $files)
|
||||
set rust_files (string match -r '^.*\.rs$' -- $files)
|
||||
@@ -40,37 +55,73 @@ end
|
||||
|
||||
set -l red (set_color red)
|
||||
set -l green (set_color green)
|
||||
set -l blue (set_color blue)
|
||||
set -l yellow (set_color yellow)
|
||||
set -l normal (set_color normal)
|
||||
|
||||
# Run the fish reformatter if we have any fish files.
|
||||
if set -q fish_files[1]
|
||||
if not type -q fish_indent
|
||||
make fish_indent
|
||||
set PATH . $PATH
|
||||
echo
|
||||
echo $yellow'Could not find `fish_indent` in `$PATH`.'$normal
|
||||
echo
|
||||
else
|
||||
echo === Running "$green"fish_indent"$normal"
|
||||
if set -l -q _flag_check
|
||||
if not fish_indent --check -- $fish_files
|
||||
echo $red"Fish files are not formatted correctly."$normal
|
||||
exit 1
|
||||
end
|
||||
else
|
||||
fish_indent -w -- $fish_files
|
||||
end
|
||||
end
|
||||
echo === Running "$green"fish_indent"$normal"
|
||||
fish_indent -w -- $fish_files
|
||||
end
|
||||
|
||||
if set -q python_files[1]
|
||||
if not type -q black
|
||||
echo
|
||||
echo Please install "`black`" to style python
|
||||
echo $yellow'Please install `black` to style python'$normal
|
||||
echo
|
||||
else
|
||||
echo === Running "$blue"black"$normal"
|
||||
black $python_files
|
||||
echo === Running "$green"black"$normal"
|
||||
if set -l -q _flag_check
|
||||
if not black --check $python_files
|
||||
echo $red"Python files are not formatted correctly."$normal
|
||||
exit 1
|
||||
end
|
||||
else
|
||||
black $python_files
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if set -q rust_files[1]
|
||||
if not type -q rustfmt
|
||||
echo
|
||||
echo Please install "`rustfmt`" to style rust
|
||||
echo
|
||||
if not cargo fmt --version >/dev/null
|
||||
echo
|
||||
echo $yellow'Please install "rustfmt" to style Rust, e.g. via:'
|
||||
echo "rustup component add rustfmt"$normal
|
||||
echo
|
||||
else
|
||||
echo === Running "$green"rustfmt"$normal"
|
||||
if set -l -q _flag_check
|
||||
if set -l -q _flag_all
|
||||
if not cargo fmt --check
|
||||
echo $red"Rust files are not formatted correctly."$normal
|
||||
exit 1
|
||||
end
|
||||
else
|
||||
if set -q rust_files[1]
|
||||
if not rustfmt --check --files-with-diff $rust_files
|
||||
echo $red"Rust files are not formatted correctly."
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
echo === Running "$blue"rustfmt"$normal"
|
||||
rustfmt $rust_files
|
||||
if set -l -q _flag_all
|
||||
cargo fmt
|
||||
else
|
||||
if set -q rust_files[1]
|
||||
rustfmt $rust_files
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,20 +17,33 @@
|
||||
# - Specify the language you want to work on as an argument, which must be a file in the po/
|
||||
# directory. You can specify a language which does not have translations yet by specifying the
|
||||
# name of a file which does not yet exist. Make sure to follow the naming convention.
|
||||
# For testing:
|
||||
# - Specify `--dry-run` to see if any updates to the PO files would by applied by this script.
|
||||
# If this flag is specified, the script will exit with an error if there are outstanding
|
||||
# changes, and will display the diff. Do not specify other flags if `--dry-run` is specified.
|
||||
#
|
||||
# Specify `--use-existing-template=FILE` to prevent running cargo for extracting an up-to-date
|
||||
# version of the localized strings. This flag is intended for testing setups which make it
|
||||
# inconvenient to run cargo here, but run it in an earlier step to ensure up-to-date values.
|
||||
# This argument is passed on to the `fish_xgettext.fish` script and has no other uses.
|
||||
# `FILE` must be the path to a gettext template file generated from our compilation process.
|
||||
# It can be obtained by running:
|
||||
# set -l FILE (mktemp)
|
||||
# FISH_GETTEXT_EXTRACTION_FILE=$FILE cargo check
|
||||
|
||||
# The sort utility is locale-sensitive.
|
||||
# Ensure that sorting output is consistent by setting LC_ALL here.
|
||||
set -gx LC_ALL C.UTF-8
|
||||
|
||||
set -l build_tools (status dirname)
|
||||
set -l template_file $build_tools/../po/template.po
|
||||
set -g tmpdir
|
||||
set -l po_dir $build_tools/../po
|
||||
|
||||
set -l extract
|
||||
set -l po
|
||||
set -l mo
|
||||
|
||||
argparse --exclusive 'no-mo,only-mo' 'no-mo' 'only-mo' -- $argv
|
||||
argparse --exclusive 'no-mo,only-mo,dry-run' no-mo only-mo dry-run use-existing-template= -- $argv
|
||||
or exit $status
|
||||
|
||||
if test -z $argv[1]
|
||||
@@ -66,15 +79,52 @@ if set -l --query _flag_only_mo
|
||||
set -l --erase po
|
||||
end
|
||||
|
||||
set -g template_file (mktemp)
|
||||
# Protect from externally set $tmpdir leaking into this script.
|
||||
set -g tmpdir
|
||||
|
||||
function cleanup_exit
|
||||
set -l exit_status $status
|
||||
|
||||
rm $template_file
|
||||
|
||||
if set -g --query tmpdir[1]
|
||||
rm -r $tmpdir
|
||||
end
|
||||
|
||||
exit $exit_status
|
||||
end
|
||||
|
||||
if set -l --query extract
|
||||
$build_tools/fish_xgettext.fish >$template_file
|
||||
or exit 1
|
||||
set -l xgettext_args
|
||||
if set -l --query _flag_use_existing_template
|
||||
set xgettext_args --use-existing-template=$_flag_use_existing_template
|
||||
end
|
||||
$build_tools/fish_xgettext.fish $xgettext_args >$template_file
|
||||
or cleanup_exit
|
||||
end
|
||||
|
||||
if set -l --query _flag_dry_run
|
||||
# On a dry run, we do not modify po/ but write to a temporary directory instead and check if
|
||||
# there is a difference between po/ and the tmpdir after re-generating the PO files.
|
||||
set -g tmpdir (mktemp -d)
|
||||
|
||||
# On a dry-run, we do not update the MO files.
|
||||
set -l --erase mo
|
||||
|
||||
# Ensure tmpdir has the same initial state as the po dir.
|
||||
cp -r $po_dir/* $tmpdir
|
||||
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 --update --no-fuzzy-matching --no-wrap --backup=none $po_file $template_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
|
||||
else
|
||||
cp $template_file $po_file
|
||||
end
|
||||
@@ -86,3 +136,10 @@ for po_file in $po_files
|
||||
msgfmt --check-format --output-file=$out_dir/fish.mo $po_file
|
||||
end
|
||||
end
|
||||
|
||||
if set -g --query tmpdir[1]
|
||||
diff -ur $po_dir $tmpdir
|
||||
or cleanup_exit
|
||||
end
|
||||
|
||||
cleanup_exit
|
||||
|
||||
@@ -1,92 +1,33 @@
|
||||
# This adds ctest support to the project
|
||||
enable_testing()
|
||||
|
||||
# By default, ctest runs tests serially
|
||||
# Support CTEST_PARALLEL_LEVEL as an environment variable in addition to a CMake variable
|
||||
if(NOT CTEST_PARALLEL_LEVEL)
|
||||
set(CTEST_PARALLEL_LEVEL $ENV{CTEST_PARALLEL_LEVEL})
|
||||
if(NOT CTEST_PARALLEL_LEVEL)
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(CORES)
|
||||
math(EXPR halfcores "${CORES} / 2")
|
||||
set(CTEST_PARALLEL_LEVEL ${halfcores})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Put in a tests folder to reduce the top level targets in IDEs.
|
||||
set(CMAKE_FOLDER tests)
|
||||
|
||||
# We will use 125 as a reserved exit code to indicate that a test has been skipped, i.e. it did not
|
||||
# pass but it should not be considered a failed test run, either.
|
||||
set(SKIP_RETURN_CODE 125)
|
||||
|
||||
# Even though we are using CMake's ctest for testing, we still define our own `make fish_run_tests` target
|
||||
# rather than use its default for many reasons:
|
||||
# * CMake doesn't run tests in-proc or even add each tests as an individual node in the ninja
|
||||
# dependency tree, instead it just bundles all tests into a target called `test` that always just
|
||||
# shells out to `ctest`, so there are no build-related benefits to not doing that ourselves.
|
||||
# * CMake devs insist that it is appropriate for `make fish_run_tests` to never depend on `make all`, i.e.
|
||||
# running `make fish_run_tests` does not require any of the binaries to be built before testing.
|
||||
# * It is not possible to set top-level CTest options/settings such as CTEST_PARALLEL_LEVEL from
|
||||
# within the CMake configuration file.
|
||||
# * The only way to have a test depend on a binary is to add a fake test with a name like
|
||||
# "build_fish" that executes CMake recursively to build the `fish` target.
|
||||
# * Circling back to the point about individual tests not being actual Makefile targets, CMake does
|
||||
# not offer any way to execute a named test via the `make`/`ninja`/whatever interface; the only
|
||||
# way to manually invoke test `foo` is to to manually run `ctest` and specify a regex matching
|
||||
# `foo` as an argument, e.g. `ctest -R ^foo$`... which is really crazy.
|
||||
|
||||
# The top-level test target is "fish_run_tests".
|
||||
add_custom_target(fish_run_tests
|
||||
COMMAND env CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL} FISH_FORCE_COLOR=1
|
||||
${CMAKE_CTEST_COMMAND} --force-new-ctest-process # --verbose
|
||||
--output-on-failure --progress
|
||||
DEPENDS fish fish_indent fish_key_reader fish_test_helper
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# CMake being CMake, you can't just add a DEPENDS argument to add_test to make it depend on any of
|
||||
# your binaries actually being built before `make fish_run_tests` is executed (requiring `make all` first),
|
||||
# and the only dependency a test can have is on another test. So we make building fish
|
||||
# prerequisites to our entire top-level `test` target.
|
||||
function(add_test_target NAME)
|
||||
string(REPLACE "/" "-" NAME ${NAME})
|
||||
add_custom_target("test_${NAME}" COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R "^${NAME}$$"
|
||||
DEPENDS fish fish_indent fish_key_reader fish_test_helper USES_TERMINAL)
|
||||
endfunction()
|
||||
|
||||
add_executable(fish_test_helper tests/fish_test_helper.c)
|
||||
|
||||
FILE(GLOB FISH_CHECKS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/checks/*.fish)
|
||||
foreach(CHECK ${FISH_CHECKS})
|
||||
get_filename_component(CHECK_NAME ${CHECK} NAME)
|
||||
get_filename_component(CHECK ${CHECK} NAME_WE)
|
||||
add_test(NAME ${CHECK_NAME}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py --cachedir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
checks/${CHECK}.fish
|
||||
add_custom_target(
|
||||
test_${CHECK_NAME}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
|
||||
checks/${CHECK_NAME}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||
DEPENDS fish fish_indent fish_key_reader fish_test_helper
|
||||
USES_TERMINAL
|
||||
)
|
||||
set_tests_properties(${CHECK_NAME} PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
|
||||
set_tests_properties(${CHECK_NAME} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
|
||||
add_test_target("${CHECK_NAME}")
|
||||
endforeach(CHECK)
|
||||
|
||||
FILE(GLOB PEXPECTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/pexpects/*.py)
|
||||
foreach(PEXPECT ${PEXPECTS})
|
||||
get_filename_component(PEXPECT ${PEXPECT} NAME)
|
||||
add_test(NAME ${PEXPECT}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py --cachedir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
add_custom_target(
|
||||
test_${PEXPECT}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
|
||||
pexpects/${PEXPECT}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||
DEPENDS fish fish_indent fish_key_reader fish_test_helper
|
||||
USES_TERMINAL
|
||||
)
|
||||
set_tests_properties(${PEXPECT} PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
|
||||
set_tests_properties(${PEXPECT} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
|
||||
add_test_target("${PEXPECT}")
|
||||
endforeach(PEXPECT)
|
||||
|
||||
set(cargo_test_flags)
|
||||
# Rust stuff.
|
||||
set(cargo_test_flags)
|
||||
if(DEFINED ASAN)
|
||||
# Rust w/ -Zsanitizer=address requires explicitly specifying the --target triple or else linker
|
||||
# errors pertaining to asan symbols will ensue.
|
||||
@@ -107,10 +48,17 @@ if(DEFINED Rust_CARGO_TARGET)
|
||||
list(APPEND cargo_test_flags "--lib")
|
||||
endif()
|
||||
|
||||
add_test(
|
||||
NAME "cargo-test"
|
||||
COMMAND env ${VARS_FOR_CARGO} cargo test --no-default-features ${CARGO_FLAGS} --workspace --target-dir ${rust_target_dir} ${cargo_test_flags}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
set(max_concurrency_flag)
|
||||
if(DEFINED ENV{FISH_TEST_MAX_CONCURRENCY})
|
||||
list(APPEND max_concurrency_flag "--max-concurrency" $ENV{FISH_TEST_MAX_CONCURRENCY})
|
||||
endif()
|
||||
|
||||
# The top-level test target is "fish_run_tests".
|
||||
add_custom_target(fish_run_tests
|
||||
# TODO: This should be replaced with a unified solution, possibly build_tools/check.sh.
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${max_concurrency_flag} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND env ${VARS_FOR_CARGO} cargo test --no-default-features ${CARGO_FLAGS} --workspace --target-dir ${rust_target_dir} ${cargo_test_flags}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
DEPENDS fish fish_indent fish_key_reader fish_test_helper
|
||||
USES_TERMINAL
|
||||
)
|
||||
set_tests_properties("cargo-test" PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
|
||||
add_test_target("cargo-test")
|
||||
|
||||
@@ -8,7 +8,7 @@ Synopsis
|
||||
|
||||
.. synopsis::
|
||||
|
||||
fish_git_prompt
|
||||
fish_git_prompt [FORMAT]
|
||||
|
||||
::
|
||||
|
||||
@@ -24,6 +24,8 @@ The ``fish_git_prompt`` function displays information about the current git repo
|
||||
|
||||
`Git <https://git-scm.com>`_ must be installed.
|
||||
|
||||
It is possible to modify the output format by passing an argument. The default value is ``" (%s)"``.
|
||||
|
||||
There are numerous customization options, which can be controlled with git options or fish variables. git options, where available, take precedence over the fish variable with the same function. git options can be set on a per-repository or global basis. git options can be set with the ``git config`` command, while fish variables can be set as usual with the :doc:`set <set>` command.
|
||||
|
||||
Boolean options (those which enable or disable something) understand "1", "yes" or "true" to mean true and every other value to mean false.
|
||||
|
||||
@@ -13,7 +13,7 @@ Synopsis
|
||||
path extension GENERAL_OPTIONS [PATH ...]
|
||||
path filter GENERAL_OPTIONS [-v | --invert]
|
||||
[-d] [-f] [-l] [-r] [-w] [-x]
|
||||
[(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
|
||||
[(-t | --type) TYPE] [(-p | --perm) PERMISSION] [--all] [PATH ...]
|
||||
path is GENERAL_OPTIONS [(-v | --invert)] [(-t | --type) TYPE]
|
||||
[-d] [-f] [-l] [-r] [-w] [-x]
|
||||
[(-p | --perm) PERMISSION] [PATH ...]
|
||||
@@ -22,7 +22,7 @@ Synopsis
|
||||
path resolve GENERAL_OPTIONS [PATH ...]
|
||||
path change-extension GENERAL_OPTIONS EXTENSION [PATH ...]
|
||||
path sort GENERAL_OPTIONS [-r | --reverse]
|
||||
[-u | --unique] [--key=basename|dirname|path] [PATH ...]
|
||||
[-u | --unique] [--key=(basename | dirname | path)] [PATH ...]
|
||||
|
||||
GENERAL_OPTIONS
|
||||
[-z | --null-in] [-Z | --null-out] [-q | --quiet]
|
||||
@@ -148,7 +148,7 @@ Examples
|
||||
> echo $path$extension
|
||||
# reconstructs the original path again.
|
||||
./foo.mp4
|
||||
|
||||
|
||||
.. _cmd-path-filter:
|
||||
|
||||
"filter" subcommand
|
||||
@@ -158,7 +158,7 @@ Examples
|
||||
|
||||
path filter [-z | --null-in] [-Z | --null-out] [-q | --quiet] \
|
||||
[-d] [-f] [-l] [-r] [-w] [-x] \
|
||||
[-v | --invert] [(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
|
||||
[-v | --invert] [(-t | --type) TYPE] [(-p | --perm) PERMISSION] [--all] [PATH ...]
|
||||
|
||||
``path filter`` returns all of the given paths that match the given checks. In all cases, the paths need to exist, nonexistent paths are always filtered.
|
||||
|
||||
@@ -180,6 +180,10 @@ When a path starts with ``-``, ``path filter`` will prepend ``./`` to avoid it b
|
||||
|
||||
It returns 0 if at least one path passed the filter.
|
||||
|
||||
With ``--all``, return status 0 (true) if all paths pass the filter, and status 1 (false) if any path fails. This is equivalent to ``not path filter -v``. It produces no output, only a status.
|
||||
|
||||
When ``--all`` combined with ``--invert``, it returns status 0 (true) if all paths fail the filter and status 1 (false) if any path passes.
|
||||
|
||||
``path is`` is shorthand for ``path filter -q``, i.e. just checking without producing output, see :ref:`The is subcommand <cmd-path-is>`.
|
||||
|
||||
Examples
|
||||
@@ -211,6 +215,9 @@ Examples
|
||||
>_ path filter -fx $PATH/*
|
||||
# Prints all possible commands - the first entry of each name is what fish would execute!
|
||||
|
||||
>_ path filter --all /usr/bin /usr/argagagji
|
||||
# This returns 1 (false) because not all paths pass the filter.
|
||||
|
||||
.. _cmd-path-is:
|
||||
|
||||
"is" subcommand
|
||||
|
||||
@@ -83,7 +83,14 @@ The following options control how much is read and how it is stored:
|
||||
**-n** or **--nchars** *NCHARS*
|
||||
Makes ``read`` return after reading *NCHARS* characters or the end of the line, whichever comes first.
|
||||
|
||||
**-t** -or **--tokenize**
|
||||
**-t** -or **--tokenize** or **--tokenize-raw**
|
||||
Causes read to split the input into variables by the shell's tokenization rules.
|
||||
This means it will honor quotes and escaping.
|
||||
This option is of course incompatible with other options to control splitting like **--delimiter** and does not honor :envvar:`IFS` (like fish's tokenizer).
|
||||
The **-t** -or **--tokenize** variants perform quote removal, so e.g. ``a\ b`` is stored as ``a b``.
|
||||
However variables and command substitutions are not expanded.
|
||||
|
||||
**--tokenize-raw**
|
||||
Causes read to split the input into variables by the shell's tokenization rules. This means it will honor quotes and escaping. This option is of course incompatible with other options to control splitting like **--delimiter** and does not honor :envvar:`IFS` (like fish's tokenizer). It saves the tokens in the manner they'd be passed to commands on the commandline, so e.g. ``a\ b`` is stored as ``a b``. Note that currently it leaves command substitutions intact along with the parentheses.
|
||||
|
||||
**-a** or **--list**
|
||||
|
||||
@@ -362,7 +362,7 @@ Some bindings are common across Emacs and vi mode, because they aren't text edit
|
||||
|
||||
- :kbd:`alt-v` Same as :kbd:`alt-e`.
|
||||
|
||||
- :kbd:`alt-s` Prepends ``sudo`` to the current commandline. If the commandline is empty, prepend ``sudo`` to the last commandline.
|
||||
- :kbd:`alt-s` Prepends ``sudo`` to the current commandline. If the commandline is empty, prepend ``sudo`` to the last commandline. If ``sudo`` is not installed, various similar commands are tried: ``doas``, ``please``, and ``run0``.
|
||||
|
||||
- :kbd:`ctrl-space` Inserts a space without expanding an :ref:`abbreviation <abbreviations>`. For vi mode, this only applies to insert-mode.
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
FROM alpine:3.19
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
cargo \
|
||||
cmake \
|
||||
g++ \
|
||||
gettext-dev \
|
||||
git \
|
||||
libintl \
|
||||
musl-dev \
|
||||
ninja \
|
||||
pcre2-dev \
|
||||
py3-pexpect \
|
||||
python3 \
|
||||
@@ -40,4 +38,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -8,17 +8,13 @@ RUN cd /etc/yum.repos.d/ && \
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
|
||||
|
||||
|
||||
# install powertools to get ninja-build
|
||||
RUN dnf -y install dnf-plugins-core \
|
||||
&& dnf config-manager --set-enabled powertools \
|
||||
&& yum install --assumeyes epel-release \
|
||||
&& yum install --assumeyes \
|
||||
cargo \
|
||||
cmake \
|
||||
diffutils \
|
||||
gcc-c++ \
|
||||
git \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
openssl \
|
||||
@@ -39,4 +35,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -5,22 +5,34 @@ set -e
|
||||
# This script is copied into the root directory of our Docker tests.
|
||||
# It is the entry point for running Docker-based tests.
|
||||
|
||||
cd ~/fish-build
|
||||
echo build_tools/check.sh >>~/.bash_history
|
||||
|
||||
cd /fish-source
|
||||
git config --global --add safe.directory /fish-source
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug /fish-source "$@"
|
||||
|
||||
export CARGO_TARGET_DIR="$HOME"/fish-build
|
||||
|
||||
interactive_shell() {
|
||||
echo
|
||||
echo "+ export=CARGO_TARGET_DIR=$CARGO_TARGET_DIR"
|
||||
echo
|
||||
bash -i
|
||||
}
|
||||
|
||||
# Spawn a shell if FISH_RUN_SHELL_BEFORE_TESTS is set.
|
||||
if test -n "$FISH_RUN_SHELL_BEFORE_TESTS"
|
||||
then
|
||||
bash -i
|
||||
interactive_shell
|
||||
fi
|
||||
|
||||
(set +e; ninja && ninja fish_run_tests)
|
||||
set +e
|
||||
build_tools/check.sh
|
||||
RES=$?
|
||||
set -e
|
||||
|
||||
# Drop the user into a shell if FISH_RUN_SHELL_AFTER_TESTS is set.
|
||||
if test -n "$FISH_RUN_SHELL_AFTER_TESTS"; then
|
||||
bash -i
|
||||
interactive_shell
|
||||
fi
|
||||
|
||||
exit $RES
|
||||
|
||||
@@ -4,8 +4,9 @@ usage() {
|
||||
cat << EOF
|
||||
Usage: $(basename "$0") [--shell-before] [--shell-after] DOCKERFILE
|
||||
Options:
|
||||
--shell-before Before the tests start, run a bash shell
|
||||
--shell-after After the tests end, run a bash shell
|
||||
--shell-before Before the tests start, run a bash shell
|
||||
--shell-after After the tests end, run a bash shell
|
||||
--lint, --no-lint Enable/disable linting and failure on warnings
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
@@ -29,6 +30,12 @@ while [ $# -gt 1 ]; do
|
||||
--shell-after)
|
||||
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_RUN_SHELL_AFTER_TESTS=1"
|
||||
;;
|
||||
--lint)
|
||||
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_CHECK_LINT=true"
|
||||
;;
|
||||
--no-lint)
|
||||
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_CHECK_LINT=false"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
|
||||
@@ -2,11 +2,9 @@ FROM fedora:latest
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
RUN dnf install --assumeyes \
|
||||
cmake \
|
||||
diffutils \
|
||||
gcc-c++ \
|
||||
git-core \
|
||||
ninja-build \
|
||||
pcre2-devel \
|
||||
python3 \
|
||||
python3-pip \
|
||||
@@ -28,4 +26,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
FROM ubuntu:20.04
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV CFLAGS="-m32"
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cmake \
|
||||
g++-multilib \
|
||||
gettext \
|
||||
git \
|
||||
locales \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
@@ -38,6 +35,13 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh \
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV \
|
||||
CFLAGS=-m32 \
|
||||
PCRE2_SYS_STATIC=1 \
|
||||
FISH_CHECK_TARGET_TRIPLE=i686-unknown-linux-gnu
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD . ~/.cargo/env \
|
||||
&& rustup target add i686-unknown-linux-gnu \
|
||||
&& /fish_run_tests.sh -DFISH_USE_SYSTEM_PCRE2=OFF -DRust_CARGO_TARGET=i686-unknown-linux-gnu
|
||||
&& rustup target add ${FISH_CHECK_TARGET_TRIPLE} \
|
||||
&& /fish_run_tests.sh
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
FROM arm64v8/ubuntu:focal
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cargo \
|
||||
cmake \
|
||||
clang \
|
||||
gettext \
|
||||
git \
|
||||
libpcre2-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
rustc \
|
||||
@@ -36,4 +34,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
FROM ubuntu:20.04
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cargo \
|
||||
cmake \
|
||||
gettext \
|
||||
git \
|
||||
locales \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
@@ -35,4 +33,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
FROM arm32v7/ubuntu:jammy
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cargo \
|
||||
cmake \
|
||||
file \
|
||||
g++ \
|
||||
gettext \
|
||||
git \
|
||||
libpcre2-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
@@ -38,4 +36,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
FROM ubuntu:jammy
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cmake \
|
||||
clang \
|
||||
gettext \
|
||||
git \
|
||||
libpcre2-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
sudo \
|
||||
@@ -42,12 +40,17 @@ COPY fish_run_tests.sh /
|
||||
ENV \
|
||||
RUSTFLAGS=-Zsanitizer=address \
|
||||
RUSTDOCFLAGS=-Zsanitizer=address \
|
||||
FISH_CHECK_CARGO_ARGS='-Zbuild-std --features=tsan' \
|
||||
FISH_CHECK_TARGET_TRIPLE=x86_64-unknown-linux-gnu \
|
||||
FISH_CI_SAN=1 \
|
||||
FISH_TEST_MAX_CONCURRENCY=4 \
|
||||
CC=clang \
|
||||
CXX=clang++ \
|
||||
ASAN_OPTIONS=check_initialization_order=1:detect_stack_use_after_return=1:detect_leaks=1 \
|
||||
LSAN_OPTIONS=verbosity=0:log_threads=0:use_tls=1:print_suppressions=0:suppressions=/fish-source/build_tools/lsan_suppressions.txt \
|
||||
FISH_CI_SAN=1
|
||||
LSAN_OPTIONS=verbosity=0:log_threads=0:use_tls=1:print_suppressions=0:suppressions=/fish-source/build_tools/lsan_suppressions.txt
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD . ~/.cargo/env \
|
||||
&& ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-$(cat /.llvm-version) \
|
||||
/fish_run_tests.sh -DASAN=1 -DRust_CARGO_TARGET=x86_64-unknown-linux-gnu
|
||||
&& ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-$(cat /.llvm-version) \
|
||||
&& /fish_run_tests.sh
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
FROM ubuntu:jammy
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cmake \
|
||||
clang \
|
||||
gettext \
|
||||
git \
|
||||
libpcre2-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
sudo \
|
||||
@@ -39,7 +37,11 @@ COPY fish_run_tests.sh /
|
||||
ENV \
|
||||
RUSTFLAGS=-Zsanitizer=thread \
|
||||
RUSTDOCFLAGS=-Zsanitizer=thread \
|
||||
FISH_CI_SAN=1
|
||||
FISH_CHECK_CARGO_ARGS='-Zbuild-std --features=tsan' \
|
||||
FISH_CHECK_TARGET_TRIPLE=x86_64-unknown-linux-gnu \
|
||||
FISH_CI_SAN=1 \
|
||||
FISH_TEST_MAX_CONCURRENCY=4
|
||||
|
||||
CMD . ~/.cargo/env \
|
||||
&& /fish_run_tests.sh -DTSAN=1 -DRust_CARGO_TARGET=x86_64-unknown-linux-gnu
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD . ~/.cargo/env && /fish_run_tests.sh
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
FROM ubuntu:jammy
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cargo \
|
||||
cmake \
|
||||
clang \
|
||||
gettext \
|
||||
git \
|
||||
libpcre2-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
rustc \
|
||||
@@ -35,4 +33,6 @@ WORKDIR /home/fishuser
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD /fish_run_tests.sh
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
FROM ubuntu:noble
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
build-essential \
|
||||
cmake \
|
||||
gettext \
|
||||
git \
|
||||
libpcre2-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-pexpect \
|
||||
tmux \
|
||||
@@ -36,5 +34,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh \
|
||||
|
||||
COPY fish_run_tests.sh /
|
||||
|
||||
ENV FISH_CHECK_LINT=false
|
||||
|
||||
CMD . ~/.cargo/env \
|
||||
&& /fish_run_tests.sh
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
FROM opensuse/tumbleweed:latest
|
||||
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
RUN zypper --non-interactive install \
|
||||
bash \
|
||||
|
||||
16
gettext-extraction/Cargo.toml
Normal file
16
gettext-extraction/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "fish-gettext-extraction"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
version = "0.0.1"
|
||||
repository.workspace = true
|
||||
description = "proc-macro for extracting strings for gettext translation"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
67
gettext-extraction/src/lib.rs
Normal file
67
gettext-extraction/src/lib.rs
Normal file
@@ -0,0 +1,67 @@
|
||||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
use std::{ffi::OsString, fs::OpenOptions, io::Write};
|
||||
|
||||
fn append_po_entry_to_file(message: &TokenStream, file_name: &OsString) {
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(file_name)
|
||||
.unwrap_or_else(|e| panic!("Could not open file {file_name:?}: {e}"));
|
||||
let message_string = message.to_string();
|
||||
if message_string.contains('\n') {
|
||||
panic!("Gettext strings may not contain unescaped newlines. Unescaped newline found in '{message_string}'")
|
||||
}
|
||||
// Crude check for format strings. This might result in false positives.
|
||||
let format_string_annotation = if message_string.contains('%') {
|
||||
"#, c-format\n"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let po_entry = format!("{format_string_annotation}msgid {message_string}\nmsgstr \"\"\n\n");
|
||||
file.write_all(po_entry.as_bytes()).unwrap();
|
||||
}
|
||||
|
||||
/// The `message` is passed through unmodified.
|
||||
/// If `FISH_GETTEXT_EXTRACTION_FILE` is defined in the environment,
|
||||
/// this file is used to write the message,
|
||||
/// so that it can then be used for generating gettext PO files.
|
||||
/// The `message` must be a string literal.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This macro panics if the `FISH_GETTEXT_EXTRACTION_FILE` variable is set and `message` has an
|
||||
/// unexpected format.
|
||||
/// Note that for example `concat!(...)` cannot be passed to this macro, because expansion works
|
||||
/// outside in, meaning this macro would still see the `concat!` macro invocation, instead of a
|
||||
/// string literal.
|
||||
#[proc_macro]
|
||||
pub fn gettext_extract(message: TokenStream) -> TokenStream {
|
||||
if let Some(file_path) = std::env::var_os("FISH_GETTEXT_EXTRACTION_FILE") {
|
||||
let pm2_message = proc_macro2::TokenStream::from(message.clone());
|
||||
let mut token_trees = pm2_message.into_iter();
|
||||
let first_token = token_trees
|
||||
.next()
|
||||
.expect("gettext_extract got empty token stream. Expected one token.");
|
||||
if token_trees.next().is_some() {
|
||||
panic!("Invalid number of tokens passed to gettext_extract. Expected one token, but got more.")
|
||||
}
|
||||
if let proc_macro2::TokenTree::Group(group) = first_token {
|
||||
let mut group_tokens = group.stream().into_iter();
|
||||
let first_group_token = group_tokens
|
||||
.next()
|
||||
.expect("gettext_extract expected one group token but got none.");
|
||||
if group_tokens.next().is_some() {
|
||||
panic!("Invalid number of tokens in group passed to gettext_extract. Expected one token, but got more.")
|
||||
}
|
||||
if let proc_macro2::TokenTree::Literal(_) = first_group_token {
|
||||
append_po_entry_to_file(&message, &file_path);
|
||||
} else {
|
||||
panic!("Expected literal in gettext_extract, but got: {first_group_token:?}");
|
||||
}
|
||||
} else {
|
||||
panic!("Expected group in gettext_extract, but got: {first_token:?}");
|
||||
}
|
||||
}
|
||||
message
|
||||
}
|
||||
1585
po/pt_BR.po
1585
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
5193
po/zh_CN.po
5193
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ name = "fish-printf"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
version = "0.2.1"
|
||||
repository = "https://github.com/fish-shell/fish-shell"
|
||||
repository.workspace = true
|
||||
description = "printf implementation, based on musl"
|
||||
license = "MIT"
|
||||
|
||||
|
||||
@@ -195,6 +195,7 @@ complete -n '__fish_seen_subcommand_from sideload' -c adb -k -xa '(__fish_comple
|
||||
complete -n '__fish_seen_subcommand_from reconnect' -c adb -x -a device -d 'Kick current connection from device side and make it reconnect.'
|
||||
|
||||
# commands that accept listing device files
|
||||
complete -n '__fish_seen_subcommand_from exec-out' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
|
||||
complete -n '__fish_seen_subcommand_from shell' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
|
||||
complete -n '__fish_seen_subcommand_from pull' -c adb -F -a "(__fish_adb_list_files)" -d 'File on device'
|
||||
complete -n '__fish_seen_subcommand_from push' -c adb -ka "(__fish_adb_list_files)" -d 'File on device'
|
||||
|
||||
@@ -49,10 +49,10 @@ function __fish_clj_tools -V bb_helper
|
||||
bb -e "$bb_helper" tools
|
||||
end
|
||||
|
||||
complete -c clj -s X -x -r -k -a "(__fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply exec fn/args"
|
||||
complete -c clj -s A -x -r -k -a "(__fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath"
|
||||
complete -c clj -s M -x -r -k -a "(__fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply main opts"
|
||||
complete -c clj -s T -x -r -k -a "(__fish_complete_list : __fish_clj_tools)" -d "Invoke tool by name or via aliases ala -X"
|
||||
complete -c clj -s X -x -r -k -a "(__fish_stripprefix='^-\w*X' __fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply exec fn/args"
|
||||
complete -c clj -s A -x -r -k -a "(__fish_stripprefix='^-\w*A' __fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath"
|
||||
complete -c clj -s M -x -r -k -a "(__fish_stripprefix='^-\w*M' __fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply main opts"
|
||||
complete -c clj -s T -x -r -k -a "(__fish_stripprefix='^-\w*T' __fish_complete_list : __fish_clj_tools)" -d "Invoke tool by name or via aliases ala -X"
|
||||
|
||||
complete -c clj -f -o Sdeps -r -d "Deps data to use as the last deps file to be merged"
|
||||
complete -c clj -f -o Spath -d "Compute classpath and echo to stdout only"
|
||||
|
||||
@@ -85,7 +85,7 @@ complete -c equery -n '__fish_seen_subcommand_from f files' -s s -l timestamp -d
|
||||
complete -c equery -n '__fish_seen_subcommand_from f files' -s t -l type -d "Include file type in output"
|
||||
complete -c equery -n '__fish_seen_subcommand_from f files' -l tree -d "Display results in a tree"
|
||||
complete -c equery -n '__fish_seen_subcommand_from f files' -s f -l filter -d "Filter output by file type" \
|
||||
-xa "(__fish_complete_list , __fish_equery_files_filter_args)"
|
||||
-xa "(__fish_stripprefix='^(--filter=|-\w*f)' __fish_complete_list , __fish_equery_files_filter_args)"
|
||||
|
||||
# has + hasuse
|
||||
complete -c equery -n '__fish_seen_subcommand_from a has h hasuse' -s I -l exclude-installed -d "Exclude installed pkgs from search path"
|
||||
|
||||
@@ -58,29 +58,12 @@ function __fish_flatpak
|
||||
flatpak $argv | string replace -rf '^([^A-Z].*?)(?: +|\t)(.*?)\s*$' '$1\t$2'
|
||||
end
|
||||
|
||||
function __fish_print_flatpak_packages
|
||||
set -l xdg_cache_home (__fish_make_cache_dir)
|
||||
or return
|
||||
set -l cache_file $xdg_cache_home/flatpak
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
__fish_cache_put $cache_file
|
||||
__fish_flatpak remote-ls --columns=application,name >$cache_file &
|
||||
return 0
|
||||
end
|
||||
|
||||
complete -f -c flatpak -n "__fish_seen_subcommand_from run" -a "(__fish_flatpak list --app --columns=application,name)"
|
||||
complete -f -c flatpak -n "__fish_seen_subcommand_from info uninstall" -a "(__fish_flatpak list --columns=application,name)"
|
||||
complete -f -c flatpak -n "__fish_seen_subcommand_from enter kill" -a "(__fish_flatpak ps --columns=instance,application)"
|
||||
complete -f -c flatpak -n "__fish_seen_subcommand_from remote-info remote-ls remote-modify remote-delete" -a "(__fish_flatpak remotes --columns=name,title)"
|
||||
|
||||
complete -c flatpak -n '__fish_seen_subcommand_from install' -xa "(__fish_print_flatpak_packages)"
|
||||
complete -c flatpak -n '__fish_seen_subcommand_from install' -xa "(__fish_cached -t 250 -- '__fish_flatpak remote-ls --columns=application,name')"
|
||||
|
||||
# Plenty of the other stuff is too free-form to complete (e.g. remote-add).
|
||||
complete -f -c flatpak -s h -l help
|
||||
|
||||
@@ -16,8 +16,7 @@ function __fish_git
|
||||
end
|
||||
end
|
||||
# Using 'command git' to avoid interactions for aliases from git to (e.g.) hub
|
||||
set -l git $__fish_git_timeout git
|
||||
command $git $global_args $saved_args 2>/dev/null
|
||||
command git $global_args $saved_args 2>/dev/null
|
||||
end
|
||||
|
||||
# Print an optspec for argparse to handle git's options that are independent of any subcommand.
|
||||
@@ -67,7 +66,7 @@ function __fish_git_local_branches
|
||||
end
|
||||
|
||||
function __fish_git_remote_branches
|
||||
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
|
||||
__fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_git_unique_remote_branches
|
||||
@@ -75,7 +74,7 @@ function __fish_git_unique_remote_branches
|
||||
# if they are unambiguous.
|
||||
# E.g. if only alice has a "frobulate" branch
|
||||
# `git checkout frobulate` is equivalent to `git checkout -b frobulate --track alice/frobulate`.
|
||||
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format="%(refname:strip=3)" \
|
||||
__fish_git for-each-ref --format="%(refname:strip=3)" \
|
||||
--sort="refname:strip=3" \
|
||||
refs/remotes/ 2>/dev/null | uniq -u
|
||||
end
|
||||
@@ -95,6 +94,12 @@ function __fish_git_heads
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_git_remote_heads
|
||||
# Example of output parsed:
|
||||
# "remote.upstream.url git@github.com:fish-shell/fish-shell.git" -> "upstream\tgit@github.com:fish-shell/fish-shell.git"
|
||||
__fish_git for-each-ref --format="%(refname:strip=2)" 'refs/remotes/*/HEAD' | path dirname
|
||||
end
|
||||
|
||||
function __fish_git_refs
|
||||
__fish_git_branches
|
||||
__fish_git_tags
|
||||
@@ -107,28 +112,20 @@ function __fish_git_remotes
|
||||
__fish_git config --get-regexp 'remote\.[a-z]+\.url' | string replace -rf 'remote\.(.*)\.url (.*)' '$1\t$2'
|
||||
end
|
||||
|
||||
set -g __fish_git_extra_recent_commits false
|
||||
set -g __fish_git_recent_commits_arg
|
||||
set -g __fish_git_unqualified_unique_remote_branches false
|
||||
set -g __fish_git_filter_non_pushable 'string join \n'
|
||||
set -g __fish_git_filter_non_pushable ''
|
||||
|
||||
function __fish_git_add_revision_completion
|
||||
set -l c complete -f -c git $argv -n 'not contains -- -- (commandline -xpc)' -ka
|
||||
# The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
|
||||
$c "(__fish_git_recent_commits \$(
|
||||
if $__fish_git_extra_recent_commits
|
||||
begin
|
||||
echo HEAD
|
||||
git for-each-ref --sort=-committerdate --format='%(refname)' 2>/dev/null \
|
||||
refs/tags refs/heads
|
||||
end | string join ' '
|
||||
end
|
||||
) | $__fish_git_filter_non_pushable)"
|
||||
$c "(__fish_git_recent_commits $__fish_git_recent_commits_arg $__fish_git_filter_non_pushable)"
|
||||
$c "(__fish_git_tags)" -d Tag
|
||||
$c "(__fish_git_heads | $__fish_git_filter_non_pushable)" -d Head
|
||||
$c "(__fish_git_remotes | $__fish_git_filter_non_pushable)" -d 'Remote alias'
|
||||
$c "(__fish_git_remote_branches | $__fish_git_filter_non_pushable)"
|
||||
$c "(__fish_git_remote_heads $__fish_git_filter_non_pushable)" -d 'Remote alias'
|
||||
$c "(__fish_git_heads $__fish_git_filter_non_pushable)" -d Head
|
||||
$c "(__fish_git_remote_branches $__fish_git_filter_non_pushable)"
|
||||
if $__fish_git_unqualified_unique_remote_branches
|
||||
$c "(__fish_git_unique_remote_branches | $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
|
||||
$c "(__fish_git_unique_remote_branches $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
|
||||
end
|
||||
$c "(__fish_git_local_branches)" -d 'Local Branch'
|
||||
end
|
||||
@@ -807,7 +804,8 @@ function __fish_git_custom_commands
|
||||
# if any of these completion results match the name of the builtin git commands,
|
||||
# but it's simpler just to blacklist these names. They're unlikely to change,
|
||||
# and the failure mode is we accidentally complete a plumbing command.
|
||||
for name in (string replace -r "^.*/git-([^/]*)" '$1' $PATH/git-*)
|
||||
set -l git_subcommands $PATH/git-*
|
||||
for name in (string replace -r "^.*/git-([^/]*)" '$1' $git_subcommands)
|
||||
switch $name
|
||||
case cvsserver receive-pack shell upload-archive upload-pack
|
||||
# skip these
|
||||
@@ -1213,7 +1211,7 @@ complete -c git -n '__fish_git_using_command am' -l show-current-patch -a 'diff
|
||||
complete -F -c git -n '__fish_git_using_command checkout' -n 'contains -- -- (commandline -xpc)'
|
||||
complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch'
|
||||
begin
|
||||
set -lx __fish_git_extra_recent_commits true
|
||||
set -lx __fish_git_recent_commits_arg --all
|
||||
set -lx __fish_git_unqualified_unique_remote_branches true
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command checkout'
|
||||
end
|
||||
@@ -1386,6 +1384,35 @@ complete -f -c git -n '__fish_git_using_command clone' -s b -l branch -d 'Use a
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l depth -d 'Truncate the history to a specified number of revisions'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l recursive -d 'Initialize all submodules within the cloned repository'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l filter -ra '(__fish_git_filters)' -d 'Partial clone by requesting a subset of objects from server'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l single-branch -d 'Clone only the history leading to the tip of a single branch'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l no-single-branch -d 'Clone histories near the tips of all branches'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -s l -l local -d 'Bypass transport mechanism for local repositories'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l no-local -d 'Use Git transport for local paths'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -s s -l shared -d 'Setup .git/objects/info/alternates to share objects'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l dissociate -d 'Stop borrowing objects from reference repositories after clone'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l progress -d 'Force progress status'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l server-option -d 'Transmit string to the server when using protocol version 2'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l no-reject-shallow -d 'Do not fail if the source repository is a shallow repository'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l reject-shallow -d 'Fail if the source repository is a shallow repository'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l sparse -d 'Employ a sparse-checkout'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l also-filter-submodules -d 'Apply partial clone filter to submodules'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l revision -r -d 'Fetch history leading to the given revision'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -s u -l upload-pack -r -d 'Specify a non-default path for the command on the other end'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l template -r -d 'Specify the directory from which templates will be used'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -s c -l config -r -d 'Set a configuration variable in the new repository'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l shallow-since -r -d 'Create a shallow clone with a history after the specified time'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l shallow-exclude -r -d 'Create a shallow clone excluding commits from a specified ref'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l no-tags -d 'Do not clone tags'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l tags -d 'Clone tags'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l recurse-submodules -r -d 'Initialize and clone submodules'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l shallow-submodules -d 'Clone submodules with a depth of 1'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l no-shallow-submodules -d 'Do not clone submodules shallowly'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l remote-submodules -d 'Use submodule remote-tracking branch to update'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l no-remote-submodules -d 'Do not use submodule remote-tracking branch to update'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l separate-git-dir -r -d 'Place the cloned repository in a specified directory'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l ref-format -f -a "files reftable" -d 'Specify the ref storage format'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -s j -l jobs -r -d 'Number of submodules fetched at the same time'
|
||||
complete -f -c git -n '__fish_git_using_command clone' -l bundle-uri -r -d 'Fetch a bundle from the given URI'
|
||||
|
||||
### commit
|
||||
complete -c git -n __fish_git_needs_command -a commit -d 'Record changes to the repository'
|
||||
@@ -1475,7 +1502,7 @@ complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between com
|
||||
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
|
||||
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
|
||||
begin
|
||||
set -lx __fish_git_extra_recent_commits true
|
||||
set -lx __fish_git_recent_commits_arg --all
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command diff'
|
||||
end
|
||||
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
|
||||
@@ -1963,8 +1990,7 @@ complete -f -c git -n '__fish_git_using_command range-diff' -l no-dual-color -d
|
||||
complete -f -c git -n __fish_git_needs_command -a push -d 'Push changes elsewhere'
|
||||
complete -f -c git -n '__fish_git_using_command push' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
|
||||
begin
|
||||
# TODO
|
||||
set -lx __fish_git_filter_non_pushable 'string replace -r "(\t.*)?\$" ":\$1"'
|
||||
set -lx __fish_git_filter_non_pushable '| string replace -r "(\t.*)?\$" ":\$1"'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command push' -n __fish_git_branch_for_remote
|
||||
end
|
||||
# The "refspec" here is an optional "+" to signify a force-push
|
||||
@@ -2070,7 +2096,7 @@ complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_branche
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s c -l create -d 'Create a new branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s C -l force-create -d 'Force create a new branch'
|
||||
begin
|
||||
set -lx __fish_git_extra_recent_commits true
|
||||
set -lx __fish_git_recent_commits_arg --all
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command switch' -s d -l detach -r
|
||||
end
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -d 'Switch to a commit for inspection and discardable experiment' -rka '(__fish_git_refs)'
|
||||
@@ -2616,7 +2642,8 @@ end
|
||||
|
||||
# source git-* commands' autocompletion file if exists
|
||||
set -l __fish_git_custom_commands_completion
|
||||
for file in (path filter -xZ $PATH/git-* | path basename)
|
||||
set -l git_subcommands $PATH/git-*
|
||||
for file in (path filter -xZ $git_subcommands | path basename)
|
||||
# Already seen this command earlier in $PATH.
|
||||
contains -- $file $__fish_git_custom_commands_completion
|
||||
and continue
|
||||
@@ -2628,6 +2655,6 @@ for file in (path filter -xZ $PATH/git-* | path basename)
|
||||
end
|
||||
|
||||
functions --erase __fish_git_add_revision_completion
|
||||
set -eg __fish_git_extra_recent_commits
|
||||
set -eg __fish_git_recent_commits_arg
|
||||
set -eg __fish_git_unqualified_unique_remote_branches
|
||||
set -eg __fish_git_filter_non_pushable
|
||||
|
||||
@@ -4,5 +4,5 @@ complete -c gpasswd -s d -l delete -d 'Remove user from group' -xa '(__fish_comp
|
||||
complete -c gpasswd -s h -l help -d 'Print help'
|
||||
complete -c gpasswd -s r -l remove-password -d 'Remove the GROUP\'s password'
|
||||
complete -c gpasswd -s R -l restrict -d 'Restrict access to GROUP to its members'
|
||||
complete -c gpasswd -s M -l members -d 'Set the list of members of GROUP' -xa '(__fish_complete_list , __fish_complete_users)'
|
||||
complete -c gpasswd -s A -l administrators -d 'set the list of administrators for GROUP' -xa '(__fish_complete_list , __fish_complete_users)'
|
||||
complete -c gpasswd -s M -l members -d 'Set the list of members of GROUP' -xa "(__fish_stripprefix='^(--members=|-\w*M)' __fish_complete_list , __fish_complete_users)"
|
||||
complete -c gpasswd -s A -l administrators -d 'set the list of administrators for GROUP' -xa "(__fish_stripprefix='^(--administrators=|-\w*A)' __fish_complete_list , __fish_complete_users)"
|
||||
|
||||
@@ -36,7 +36,7 @@ complete -c $command -s x -x \
|
||||
-n $compile_condition
|
||||
|
||||
complete -c $command -s W -l warning \
|
||||
-a '(__fish_complete_list , __fish_guild__complete_warnings)' \
|
||||
-a "(__fish_stripprefix='^(--warning=|-\w*W)' __fish_complete_list , __fish_guild__complete_warnings)" \
|
||||
-d 'Specify the warning level for a compilation' \
|
||||
-n $compile_condition
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ complete -c $command -o ds \
|
||||
-d 'Treat the last -s option as if it occurred at this point'
|
||||
|
||||
complete -c $command -l use-srfi \
|
||||
-a '(__fish_complete_list , __fish_guile__complete_srfis)' \
|
||||
-a "(__fish_stripprefix='^--use-srfi=' __fish_complete_list , __fish_guile__complete_srfis)" \
|
||||
-d 'Specify the SRFI modules to load'
|
||||
|
||||
for standard in 6 7
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
complete -c gzip -s c -l stdout -d "Compress to stdout"
|
||||
complete -c gzip -s d -l decompress -k -x -a "(__fish_complete_suffix .gz .tgz)"
|
||||
complete -c gzip -s d -l decompress -d Decompress -k -x -a "(__fish_complete_suffix .gz .tgz)"
|
||||
|
||||
complete -c gzip -s f -l force -d Overwrite
|
||||
complete -c gzip -s h -l help -d "Display help and exit"
|
||||
|
||||
@@ -58,7 +58,7 @@ complete -c hashcat -l restore -d "Restore session from --session"
|
||||
complete -c hashcat -l restore-disable -d "Do not write restore file"
|
||||
complete -c hashcat -l restore-file-path -rF -d "Specific path to restore file"
|
||||
complete -c hashcat -s o -l outfile -rF -d "Define outfile for recovered hash"
|
||||
complete -c hashcat -l outfile-format -xa "(__fish_complete_list , __fish_hashcat_outfile_formats)" -d "Outfile formats to use"
|
||||
complete -c hashcat -l outfile-format -xa "(__fish_stripprefix='^--outfile-format=' __fish_complete_list , __fish_hashcat_outfile_formats)" -d "Outfile formats to use"
|
||||
complete -c hashcat -l outfile-autohex-disable -d "Disable the use of \$HEX[] in output plains"
|
||||
complete -c hashcat -l outfile-check-timer -x -d "Sets seconds between outfile checks"
|
||||
complete -c hashcat -l wordlist-autohex-disable -d "Disable the conversion of \$HEX[] from the wordlist"
|
||||
@@ -106,7 +106,7 @@ complete -c hashcat -l backend-ignore-metal -d "Do not try to open Metal interfa
|
||||
complete -c hashcat -l backend-ignore-opencl -d "Do not try to open OpenCL interface on startup"
|
||||
complete -c hashcat -s I -l backend-info -d "Show info about detected backend API devices"
|
||||
complete -c hashcat -s d -l backend-devices -x -d "Backend devices to use"
|
||||
complete -c hashcat -s D -l opencl-device-types -xa "(__fish_complete_list , __fish_hashcat_device_types)" -d "OpenCL device-types to use"
|
||||
complete -c hashcat -s D -l opencl-device-types -xa "(__fish_stripprefix='^(--opencl-device-types=|-\w*D)' __fish_complete_list , __fish_hashcat_device_types)" -d "OpenCL device-types to use"
|
||||
complete -c hashcat -s O -l optimized-kernel-enable -d "Enable optimized kernels (limits password length)"
|
||||
complete -c hashcat -s M -l multiply-accel-disable -d "Disable multiply kernel-accel with processor count"
|
||||
complete -c hashcat -s w -l workload-profile -d "Enable a specific workload profile" -xa "
|
||||
|
||||
@@ -9,7 +9,7 @@ function __fish_john_formats --description "Print JohnTheRipper hash formats"
|
||||
end
|
||||
|
||||
complete -c john -l help -d "print usage summary"
|
||||
complete -c john -l single -fa "(__fish_complete_list , __fish_john_rules)" -d "single crack mode"
|
||||
complete -c john -l single -fa "(__fish_stripprefix='^--single=' __fish_complete_list , __fish_john_rules)" -d "single crack mode"
|
||||
complete -c john -l single-seed -rf -d "add static seed word(s) for all salts in single mode"
|
||||
complete -c john -l single-wordlist -rF -d "short wordlist with static seed words/morphemes"
|
||||
complete -c john -l single-user-seed -rF -d "wordlist with seeds per username"
|
||||
@@ -35,8 +35,8 @@ complete -c john -l prince-case-permute -d "permute case of first letter"
|
||||
complete -c john -l prince-mmap -d "memory-map infile"
|
||||
complete -c john -l prince-keyspace -d "just show total keyspace that would be produced"
|
||||
complete -c john -l encoding -l input-encoding -fa "$__fish_john_encodings" -d "input encoding"
|
||||
complete -c john -l rules -fa "(__fish_complete_list , __fish_john_rules)" -d "enable word mangling rules"
|
||||
complete -c john -l rules-stack -fa "(__fish_complete_list , __fish_john_rules)" -d "stacked rules"
|
||||
complete -c john -l rules -fa "(__fish_stripprefix='^--rules=' __fish_complete_list , __fish_john_rules)" -d "enable word mangling rules"
|
||||
complete -c john -l rules-stack -fa "(__fish_stripprefix='^--rules-stack=' __fish_complete_list , __fish_john_rules)" -d "stacked rules"
|
||||
complete -c john -l rules-skip-nop -d "skip any NOP rules"
|
||||
complete -c john -l incremental -fa "(john --list=inc-modes 2>/dev/null)" -d "incremental mode"
|
||||
complete -c john -l incremental-charcount -rf -d "override CharCount for incremental mode"
|
||||
@@ -97,4 +97,4 @@ complete -c john -l internal-codepage -fa "$__fish_john_encodings" -d "codepage
|
||||
complete -c john -l target-encoding -fa "$__fish_john_encodings" -d "output encoding"
|
||||
complete -c john -l tune -fa "auto report N" -d "tuning options"
|
||||
complete -c john -l force-tty -d "set up terminal for reading keystrokes"
|
||||
complete -c john -l format -fa "(__fish_complete_list , __fish_john_formats)" -d "force hash type"
|
||||
complete -c john -l format -fa "(__fish_stripprefix='^--format=' __fish_complete_list , __fish_john_formats)" -d "force hash type"
|
||||
|
||||
@@ -30,6 +30,7 @@ complete -c journalctl -f -l version -d 'Prints a short version string and exits
|
||||
complete -c journalctl -f -l no-pager -d 'Do not pipe output into a pager'
|
||||
complete -c journalctl -f -s a -l all -d 'Show all fields in full'
|
||||
complete -c journalctl -f -s f -l follow -d 'Show live tail of entries'
|
||||
complete -c journalctl -f -s e -l pager-end -d 'Skip to the end of the journal'
|
||||
complete -c journalctl -f -s n -l lines -d 'Controls the number of journal lines'
|
||||
complete -c journalctl -f -l no-tail -d 'Show all lines, even in follow mode'
|
||||
complete -c journalctl -f -s o -l output -d 'Controls the formatting' -xa '(printf %s\t\n (command journalctl --output=help))'
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
# Light is a program to control backlight controllers under GNU/Linux.
|
||||
# See: https://github.com/haikarainen/light
|
||||
|
||||
function __fish_print_light_controllers
|
||||
command light -L
|
||||
end
|
||||
|
||||
complete -c light -s h -d 'Print help and exit'
|
||||
complete -c light -s h -s -H -d 'Print help and exit'
|
||||
complete -c light -s V -d 'Print version info and exit'
|
||||
complete -c light -s G -d 'Get value (default)'
|
||||
complete -c light -s S -x -d 'Set value'
|
||||
complete -c light -s L -d 'List controllers'
|
||||
complete -c light -s A -x -d 'Add value'
|
||||
complete -c light -s U -x -d 'Subtract value'
|
||||
complete -c light -s L -d 'List controllers'
|
||||
complete -c light -s I -d 'Restore brightness'
|
||||
complete -c light -s T -d 'Save brightness'
|
||||
complete -c light -s S -x -d 'Set value'
|
||||
complete -c light -s G -d 'Get value (default)'
|
||||
complete -c light -s N -d 'Set minimum brightness'
|
||||
complete -c light -s P -d 'Get minimum brightness'
|
||||
complete -c light -s O -d 'Save brightness'
|
||||
complete -c light -s b -d 'Brightness (default)'
|
||||
complete -c light -s m -d 'Maximum brightness'
|
||||
complete -c light -s c -d 'Minimum cap'
|
||||
complete -c light -s a -d 'Selects controller automatically (default)'
|
||||
complete -c light -s s -a '(__fish_print_light_controllers)' -x -d 'Specify controller to use'
|
||||
complete -c light -s p -d 'Interpret & output values in percent'
|
||||
complete -c light -s I -d 'Restore brightness after saving'
|
||||
|
||||
complete -c light -s r -d 'Interpret & output values in raw mode'
|
||||
complete -c light -s s -a '(command light -L)' -x -d 'Specify controller to use'
|
||||
complete -c light -s v -x -d 'Sets the verbosity level' -a '0\tRead\ values 1\tRead\ values\ \&\ errors 2\tRead\ values,\ errors\ \&\ warnings 3\tRead\ values,\ errors,\ warnings\ \&\ notices'
|
||||
|
||||
@@ -41,7 +41,7 @@ complete -c losetup -s v -l verbose -d "Verbose mode"
|
||||
complete -c losetup -s J -l json -d "Use JSON --list output format"
|
||||
complete -c losetup -s l -l list -d "List info about all or specified"
|
||||
complete -c losetup -s n -l noheadings -d "Don't print headings for --list output"
|
||||
complete -c losetup -s O -l output -x -a "(__fish_complete_list , __fish_print_losetup_list_output)" -d "Specify columns to output for --list"
|
||||
complete -c losetup -s O -l output -x -a "(__fish_stripprefix='^(--output=|-\w*O)' __fish_complete_list , __fish_print_losetup_list_output)" -d "Specify columns to output for --list"
|
||||
complete -c losetup -l output-all -d "Output all columns"
|
||||
complete -c losetup -l raw -d "Use raw --list output format"
|
||||
complete -c losetup -s h -l help -d "Display help"
|
||||
|
||||
@@ -25,7 +25,7 @@ complete -c lpadmin -s o -xa printer-is-shared=true -d 'Sets dest to shared/publ
|
||||
complete -c lpadmin -s o -xa printer-is-shared=false -d 'Sets dest to shared/published or unshared/unpublished'
|
||||
complete -c lpadmin -s o -d 'Set IPP operation policy associated with dest' -xa "printer-policy=(test -r /etc/cups/cupsd.conf; and string replace -r --filter '<Policy (.*)>' '$1' < /etc/cups/cupsd.conf)"
|
||||
|
||||
complete -c lpadmin -s u -xa 'allow:all allow:none (__fish_complete_list , __fish_complete_users allow:)' -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa '(__fish_complete_list , __fish_complete_groups allow: @)' -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa 'deny:all deny:none (__fish_complete_list , __fish_complete_users deny:)' -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa '(__fish_complete_list , __fish_complete_groups deny: @)' -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa "allow:all allow:none (__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users allow:)" -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_groups allow: @)" -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa "deny:all deny:none (__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users deny:)" -d 'Sets user-level access control on a destination'
|
||||
complete -c lpadmin -s u -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_groups deny: @)" -d 'Sets user-level access control on a destination'
|
||||
|
||||
@@ -12,7 +12,7 @@ complete -c lsblk -s h -l help -d "usage information (this)"
|
||||
complete -c lsblk -s i -l ascii -d "use ascii characters only"
|
||||
complete -c lsblk -s m -l perms -d "output info about permissions"
|
||||
complete -c lsblk -s n -l noheadings -d "don't print headings"
|
||||
complete -c lsblk -s o -l output -d "output columns" -xa '( __fish_complete_list , __fish_print_lsblk_columns )'
|
||||
complete -c lsblk -s o -l output -d "output columns" -xa "(__fish_stripprefix='^(--output=|-\w*o)' __fish_complete_list , __fish_print_lsblk_columns)"
|
||||
complete -c lsblk -s P -l pairs -d "use key='value' output format"
|
||||
complete -c lsblk -s r -l raw -d "use raw output format"
|
||||
complete -c lsblk -s t -l topology -d "output info about topology"
|
||||
|
||||
@@ -11,9 +11,9 @@ i\t"ignore the device cache file"
|
||||
r\t"read the device cache file"
|
||||
u\t"read and update the device cache file"'
|
||||
|
||||
complete -c lsof -s g -d 'select by group (^ - negates)' -xa '(__fish_complete_list , __fish_complete_groups)'
|
||||
complete -c lsof -s g -d 'select by group (^ - negates)' -xa "(__fish_stripprefix='^-\w*g' __fish_complete_list , __fish_complete_groups)"
|
||||
complete -c lsof -s l -d 'Convert UIDs to login names'
|
||||
complete -c lsof -s p -d 'Select or exclude processes by pid' -xa '(__fish_complete_list , __fish_complete_pids)'
|
||||
complete -c lsof -s p -d 'Select or exclude processes by pid' -xa "(__fish_stripprefix='^-\w*p' __fish_complete_list , __fish_complete_pids)"
|
||||
complete -c lsof -s R -d 'Print PPID'
|
||||
complete -c lsof -s t -d 'Produce terse output (pids only, no header)'
|
||||
complete -c lsof -s u -d 'select by user (^ - negates)' -xa '(__fish_complete_list , __fish_complete_users)'
|
||||
complete -c lsof -s u -d 'select by user (^ - negates)' -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users)"
|
||||
|
||||
@@ -35,7 +35,7 @@ function __fish_complete_openssl_ciphers
|
||||
printf "%s\tCipher String\n" $cs
|
||||
end
|
||||
end
|
||||
complete -c ncat -l ssl-ciphers -x -a "(__fish_complete_list : __fish_complete_openssl_ciphers)" -d "Specify SSL ciphersuites"
|
||||
complete -c ncat -l ssl-ciphers -x -a "(__fish_stripprefix='^--ssl-ciphers=' __fish_complete_list : __fish_complete_openssl_ciphers)" -d "Specify SSL ciphersuites"
|
||||
complete -c ncat -l ssl-servername -x -a "(__fish_print_hostnames)" -d "Request distinct server name"
|
||||
complete -c ncat -l ssl-alpn -x -d "Specify ALPN protocol list"
|
||||
|
||||
|
||||
@@ -92,11 +92,11 @@ function __fish_complete_nmap_script
|
||||
end
|
||||
echo -e $__fish_nmap_script_completion_cache
|
||||
end
|
||||
complete -c nmap -l script -r -a "(__fish_complete_list , __fish_complete_nmap_script)"
|
||||
complete -c nmap -l script -r -a "(__fish_stripprefix='^--script=' __fish_complete_list , __fish_complete_nmap_script)"
|
||||
complete -c nmap -l script -r -d 'Runs a script scan'
|
||||
complete -c nmap -l script-args -d 'provide arguments to NSE scripts'
|
||||
complete -c nmap -l script-args-file -r -d 'load arguments to NSE scripts from a file'
|
||||
complete -c nmap -l script-help -r -a "(__fish_complete_list , __fish_complete_nmap_script)"
|
||||
complete -c nmap -l script-help -r -a "(__fish_stripprefix='^--script-help=' __fish_complete_list , __fish_complete_nmap_script)"
|
||||
complete -c nmap -l script-help -r -d "Shows help about scripts"
|
||||
complete -c nmap -l script-trace
|
||||
complete -c nmap -l script-updatedb
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# TODO: POSIX patch
|
||||
#
|
||||
|
||||
|
||||
# No effect on POSIX systems that don't use O_BINARY/O_TEXT
|
||||
uname -s | string match -q CYGWIN\*
|
||||
and complete -c patch -l binary -d "Read & write data in binary mode"
|
||||
|
||||
@@ -10,7 +10,7 @@ if test "$gnu_linux" -eq 1
|
||||
# Some short options are GNU-only
|
||||
complete -c ps -s a -d "Select all processes except session leaders and terminal-less"
|
||||
complete -c ps -s A -d "Select all"
|
||||
complete -c ps -s C -d "Select by command" -ra '(__fish_complete_list , __fish_complete_proc)'
|
||||
complete -c ps -s C -d "Select by command" -ra "(__fish_stripprefix='^-\w*C' __fish_complete_list , __fish_complete_proc)"
|
||||
complete -c ps -s c -d 'Show different scheduler information for the -l option'
|
||||
complete -c ps -s d -d "Select all processes except session leaders"
|
||||
complete -c ps -s e -d "Select all"
|
||||
@@ -24,9 +24,9 @@ if test "$gnu_linux" -eq 1
|
||||
complete -c ps -s m -d 'Show threads after processes'
|
||||
complete -c ps -s N -d "Invert selection"
|
||||
complete -c ps -s n -d "Set namelist file" -r
|
||||
complete -c ps -s s -l sid -d "Select by session ID" -x -a "(__fish_complete_list , __fish_complete_pids)"
|
||||
complete -c ps -s s -l sid -d "Select by session ID" -x -a "(__fish_stripprefix='^(--sid=|-\w*s)' __fish_complete_list , __fish_complete_pids)"
|
||||
complete -c ps -s T -d "Show threads. With SPID"
|
||||
complete -c ps -s u -l user -d "Select by user" -x -a "(__fish_complete_list , __fish_complete_users)"
|
||||
complete -c ps -s u -l user -d "Select by user" -x -a "(__fish_stripprefix='^(--script=|-\w*u)' __fish_complete_list , __fish_complete_users)"
|
||||
complete -c ps -s V -l version -d "Display version and exit"
|
||||
complete -c ps -s y -d "Do not show flags"
|
||||
|
||||
@@ -39,7 +39,7 @@ if test "$gnu_linux" -eq 1
|
||||
complete -c ps -l info -d "Display debug info"
|
||||
complete -c ps -l lines -l rows -d "Set screen height" -r
|
||||
complete -c ps -l no-headers -d 'Print no headers'
|
||||
complete -c ps -l ppid -d "Select by parent PID" -x -a "(__fish_complete_list , __fish_complete_pids)"
|
||||
complete -c ps -l ppid -d "Select by parent PID" -x -a "(__fish_stripprefix='^--ppid=' __fish_complete_list , __fish_complete_pids)"
|
||||
complete -c ps -l sort -d 'Specify sort order' -r
|
||||
else
|
||||
# Assume BSD options otherwise
|
||||
@@ -81,6 +81,6 @@ end
|
||||
complete -c ps -s o -lformat$bsd_null -d "User defined format" -x
|
||||
complete -c ps -s Z -lcontext$bsd_null -d "Include security info"
|
||||
complete -c ps -s t -ltty$bsd_null -d "Select by tty" -r
|
||||
complete -c ps -s G -lgroup$bsd_null -d "Select by group" -x -a "(__fish_complete_list , __fish_complete_groups)"
|
||||
complete -c ps -s U -luser$bsd_null -d "Select by user" -x -a "(__fish_complete_list , __fish_complete_users)"
|
||||
complete -c ps -s p -lpid$bsd_null -d "Select by PID" -x -a "(__fish_complete_list , __fish_complete_pids)"
|
||||
complete -c ps -s G -lgroup$bsd_null -d "Select by group" -x -a "(__fish_stripprefix='^(--group=|-\w*G)' __fish_complete_list , __fish_complete_groups)"
|
||||
complete -c ps -s U -luser$bsd_null -d "Select by user" -x -a "(__fish_stripprefix='^(--user=|-\w*U)' __fish_complete_list , __fish_complete_users)"
|
||||
complete -c ps -s p -lpid$bsd_null -d "Select by PID" -x -a "(__fish_stripprefix='^(--pid=|-\w*p)' __fish_complete_list , __fish_complete_pids)"
|
||||
|
||||
@@ -15,7 +15,7 @@ complete -c setxkbmap -o keycodes -d 'Specifies keycodes component name' -xa "(s
|
||||
complete -c setxkbmap -o keymap -d 'Specifies name of keymap to load' -xa "(sed -r $filter /usr/share/X11/xkb/keymap.dir)"
|
||||
complete -c setxkbmap -o layout -d 'Specifies layout used to choose component names' -xa "(__fish_complete_setxkbmap layout)"
|
||||
complete -c setxkbmap -o model -d 'Specifies model used to choose component names' -xa "(__fish_complete_setxkbmap model)"
|
||||
complete -c setxkbmap -o option -d 'Adds an option used to choose component names' -xa "(__fish_complete_list , '__fish_complete_setxkbmap option')"
|
||||
complete -c setxkbmap -o option -d 'Adds an option used to choose component names' -xa "(__fish_stripprefix='^--option=' __fish_complete_list , '__fish_complete_setxkbmap option')"
|
||||
complete -c setxkbmap -o print -d 'Print a complete xkb_keymap description and exit'
|
||||
complete -c setxkbmap -o query -d 'Print the current layout settings and exit'
|
||||
complete -c setxkbmap -o rules -d 'Name of rules file to use' -x
|
||||
|
||||
@@ -25,7 +25,7 @@ complete -c ssh -s k -d "Disables forwarding of GSSAPI credentials"
|
||||
complete -c ssh -s L -d "Specify local port forwarding" -x
|
||||
complete -c ssh -s l -x -a "(__fish_complete_users)" -d User
|
||||
complete -c ssh -s M -d "Places the ssh client into master mode"
|
||||
complete -c ssh -s m -d "MAC algorithm" -xa "(__fish_complete_list , __fish_ssh_macs)"
|
||||
complete -c ssh -s m -d "MAC algorithm" -xa "(__fish_stripprefix='^-\w*m' __fish_complete_list , __fish_ssh_macs)"
|
||||
complete -c ssh -s N -d "Do not execute remote command"
|
||||
complete -c ssh -s n -d "Prevent reading from stdin"
|
||||
complete -c ssh -s O -d "Control an active connection multiplexing master process" -x
|
||||
|
||||
@@ -12,6 +12,6 @@ complete -c su -s G -l supp-group -x -a "(__fish_complete_groups)" -d "Specify a
|
||||
complete -c su -s m -s p -l preserve_environment -d "Preserve environment"
|
||||
complete -c su -s P -l pty -d "Create pseudo-terminal for the session"
|
||||
complete -c su -s s -l shell -x -a "(cat /etc/shells)" -d "Run the specified shell"
|
||||
complete -c su -s w -l whitelist-environment -x -a "(__fish_complete_list , __fish_complete_su_env_whitelist)" -d "Don't reset these environment variables"
|
||||
complete -c su -s w -l whitelist-environment -x -a "(__fish_stripprefix='^(--whitelist-environment=|-\w*w)' __fish_complete_list , __fish_complete_su_env_whitelist)" -d "Don't reset these environment variables"
|
||||
complete -c su -s h -l help -d "Display help and exit"
|
||||
complete -c su -s V -l version -d "Display version and exit"
|
||||
|
||||
@@ -40,6 +40,6 @@ complete -c systemd-cryptenroll -l fido2-with-user-presence -xa "yes no" -d "Req
|
||||
complete -c systemd-cryptenroll -l fido2-with-user-verification -xa "yes no" -d "Require user verification when unlocking the volume"
|
||||
complete -c systemd-cryptenroll -l tpm2-device -kxa "(__fish_cryptenroll_tpm2_devices)" -d "Enroll a TPM2 security chip"
|
||||
complete -c systemd-cryptenroll -l tpm2-pcrs -x -d "Bind the enrollment of TPM2 device to specified PCRs"
|
||||
complete -c systemd-cryptenroll -l wipe-slot -kxa "(__fish_complete_list , __fish_cryptenroll_complete_wipe)" -d "Wipes one or more LUKS2 key slots"
|
||||
complete -c systemd-cryptenroll -l wipe-slot -kxa "(__fish_stripprefix='^--wipe-slot=' __fish_complete_list , __fish_cryptenroll_complete_wipe)" -d "Wipes one or more LUKS2 key slots"
|
||||
complete -c systemd-cryptenroll -l help -s h -d "Print a short help"
|
||||
complete -c systemd-cryptenroll -l version -d "Print a short version string"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
# Returns 0 if the command has not had a subcommand yet
|
||||
# Does not currently account for -chdir
|
||||
function __fish_tofu_needs_command
|
||||
|
||||
@@ -5,7 +5,7 @@ complete -c usermod -s d -l home -d "Change user's login directory" -r
|
||||
complete -c usermod -s e -l expiredate -d "Date (YYYY-MM-DD) on which the user account will be disabled" -x
|
||||
complete -c usermod -s f -l inactive -d "Number of days after a password expires until the account is locked" -xa "(seq 0 365)"
|
||||
complete -c usermod -s g -l gid -d "Group name or number of the user's new initial login group" -xa "(__fish_complete_groups)"
|
||||
complete -c usermod -s G -l groups -d "List of groups which the user is also a member of" -xa "(__fish_complete_list , __fish_complete_groups)"
|
||||
complete -c usermod -s G -l groups -d "List of groups which the user is also a member of" -xa "(__fish_stripprefix='^(--groups=|-\w*G)' __fish_complete_list , __fish_complete_groups)"
|
||||
complete -c usermod -s l -l login -d "Change user's name" -x
|
||||
complete -c usermod -s L -l lock -d "Lock user's password" -f
|
||||
complete -c usermod -s m -l move-home -d "Move the content of the user's home directory to the new location" -f
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function __fish_winetricks__complete_verbs
|
||||
winetricks list-all 2>/dev/null |
|
||||
__fish_cached -t 3600 -- 'winetricks list-all 2>/dev/null' |
|
||||
string match --invert --regex '^==' |
|
||||
string match --invert --regex '^(apps|dlls|fonts|games|settings)$' |
|
||||
string replace --regex '(\S+)\s+(.+)' '$1\t$2'
|
||||
|
||||
@@ -50,7 +50,7 @@ complete -c $progname -s d -d 'Enable extra debugging shown to stderr'
|
||||
complete -c $progname -s h -d 'Show the help message'
|
||||
complete -c $progname -s i -d 'Ignore repositories defined in configuration files'
|
||||
complete -c $progname -s M -d 'For remote repositories, the data is fetched and stored in memory only'
|
||||
complete -c $progname -s p -d 'Match one or more package properties' -xa "(__fish_complete_list , __fish_print_xbps_pkg_props)"
|
||||
complete -c $progname -s p -d 'Match one or more package properties' -xa "(__fish_stripprefix='^-\w*p' __fish_complete_list , __fish_print_xbps_pkg_props)"
|
||||
complete -c $progname -s R -d 'Enable repository mode'
|
||||
complete -c $progname -l repository -d 'Append the specified repository to the top of the list'
|
||||
complete -c $progname -l regex -d 'Use Extended Regular Expressions'
|
||||
|
||||
44
share/functions/__fish_cached.fish
Normal file
44
share/functions/__fish_cached.fish
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
or return
|
||||
|
||||
if set -q _flag_cache_key
|
||||
set -f cache_key $_flag_cache_key
|
||||
else
|
||||
set -f cache_key (string trim "$argv" | string split ' ')[1]
|
||||
end
|
||||
if not string match -q --regex '^[\w+-]+$' -- "$cache_key"
|
||||
return 1
|
||||
end
|
||||
|
||||
if set -q _flag_max_age
|
||||
set -f max_age $_flag_max_age
|
||||
else
|
||||
set -f max_age -1
|
||||
end
|
||||
set -l cache_dir (__fish_make_cache_dir)
|
||||
or return
|
||||
set -l cache_file (path normalize $cache_dir/$cache_key)
|
||||
set -l cache_age (path mtime --relative $cache_file)
|
||||
|
||||
if not test -f $cache_file
|
||||
__fish_cache_put $cache_file
|
||||
sh -c "{ $argv; } >$cache_file || rm $cache_file 2>/dev/null" &
|
||||
|
||||
if test -n "$last_pid"
|
||||
# wait for at most 1 second if supported
|
||||
command --search waitpid &>/dev/null
|
||||
and waitpid --exited --timeout 1 $last_pid
|
||||
and test -f $cache_file
|
||||
and cat $cache_file
|
||||
end
|
||||
else
|
||||
cat $cache_file
|
||||
|
||||
if test $cache_age -gt $max_age
|
||||
__fish_cache_put $cache_file
|
||||
sh -c "{ $argv; } >$cache_file || rm $cache_file 2>/dev/null" &
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -14,15 +14,17 @@ where:
|
||||
set -q prefix[1]
|
||||
or set -l prefix ""
|
||||
set -l pat "$(commandline -t)"
|
||||
#set -l pat $argv[5]
|
||||
if set -q __fish_stripprefix[1]
|
||||
set pat "$(string replace -r -- "$__fish_stripprefix" "" $pat)"
|
||||
end
|
||||
switch $pat
|
||||
case "*$div*"
|
||||
for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
|
||||
string unescape -- $i
|
||||
for i in (string unescape -- $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
|
||||
printf %s\n $i
|
||||
end
|
||||
case '*'
|
||||
for i in $prefix$iprefix(eval $cmd)
|
||||
string unescape -- $i
|
||||
printf %s\n $i
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
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'
|
||||
complete -c $cmd -s g -d 'Only match processes in the process group' -xa '(__fish_complete_list , __fish_complete_groups)'
|
||||
complete -c $cmd -s G -d "Only match processes whose real group ID is listed. Group 0 is translated into $cmd\'s own process group" -xa '(__fish_complete_list , __fish_complete_groups)'
|
||||
complete -c $cmd -s g -d 'Only match processes in the process group' -xa "(__fish_stripprefix='^-\w*g' __fish_complete_list , __fish_complete_groups)"
|
||||
complete -c $cmd -s G -d "Only match processes whose real group ID is listed. Group 0 is translated into $cmd\'s own process group" -xa "(__fish_stripprefix='^-\w*G' __fish_complete_list , __fish_complete_groups)"
|
||||
complete -c $cmd -s n -d 'Select only the newest process'
|
||||
complete -c $cmd -s o -d 'Select only the oldest process'
|
||||
complete -c $cmd -s P -d 'Only match processes whose parent process ID is listed' -xa '(__fish_complete_list , __fish_complete_pids)'
|
||||
complete -c $cmd -s P -d 'Only match processes whose parent process ID is listed' -xa "(__fish_stripprefix='^-\w*P' __fish_complete_list , __fish_complete_pids)"
|
||||
complete -c $cmd -s s -d "Only match processes whose process session ID is listed. Session ID 0 is translated into $cmd\'s own session ID."
|
||||
complete -c $cmd -s t -d 'Only match processes whose controlling terminal is listed. The terminal name should be specified without the "/dev/" prefix' -r
|
||||
complete -c $cmd -s u -d 'Only match processes whose effective user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)'
|
||||
complete -c $cmd -s U -d 'Only match processes whose real user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)'
|
||||
complete -c $cmd -s u -d 'Only match processes whose effective user ID is listed' -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users)"
|
||||
complete -c $cmd -s U -d 'Only match processes whose real user ID is listed' -xa "(__fish_stripprefix='^-\w*U' __fish_complete_list , __fish_complete_users)"
|
||||
complete -c $cmd -s v -d 'Negates the matching'
|
||||
complete -c $cmd -s x -d ' Only match processes whose name (or command line if -f is specified) exactly match the pattern'
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ function __fish_complete_ssh -d "common completions for ssh commands" --argument
|
||||
complete -c $command -s 6 -d "IPv6 only"
|
||||
complete -c $command -s A -d "Enables forwarding of the authentication agent"
|
||||
complete -c $command -s C -d "Compress all data"
|
||||
complete -c $command -s c -d "Encryption algorithm" -xa "(__fish_complete_list , __fish_ssh_ciphers)"
|
||||
complete -c $command -s c -d "Encryption algorithm" -xa "(__fish_stripprefix='^-\w*c' __fish_complete_list , __fish_ssh_ciphers)"
|
||||
complete -c $command -s F -d "Configuration file" -rF
|
||||
complete -c $command -s i -d "Identity key file" -rF
|
||||
complete -c $command -s J -d 'ProxyJump host' -xa "(__fish_complete_user_at_hosts)"
|
||||
|
||||
@@ -4,41 +4,16 @@ function __fish_print_eopkg_packages
|
||||
argparse i/installed -- $argv
|
||||
or return 1
|
||||
|
||||
set -l xdg_cache_home (__fish_make_cache_dir)
|
||||
or return
|
||||
|
||||
# If the cache is less than max_age, we do not recalculate it
|
||||
# Determine whether to print installed/available packages
|
||||
|
||||
if set -q _flag_installed
|
||||
set -l cache_file $xdg_cache_home/eopkg-installed
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 500
|
||||
if test $age -lt $max_age
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
__fish_cache_put $cache_file
|
||||
# Remove package version information from output and pipe into cache file
|
||||
eopkg list-installed -N | cut -d ' ' -f 1 >$cache_file &
|
||||
__fish_cached -t 500 -k eopkg-installed -- "eopkg list-installed -N | cut -d ' ' -f 1"
|
||||
return 0
|
||||
else
|
||||
set -l cache_file $xdg_cache_home/eopkg-available
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 500
|
||||
if test $age -lt $max_age
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
__fish_cache_put $cache_file
|
||||
# Remove package version information from output and pipe into cache file
|
||||
eopkg list-available -N | cut -d ' ' -f 1 >$cache_file &
|
||||
__fish_cached -t 500 -k eopkg-available -- "eopkg list-available -N | cut -d ' ' -f 1"
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
|
||||
@@ -5,22 +5,8 @@ function __fish_print_pacman_packages
|
||||
argparse i/installed -- $argv
|
||||
or return 1
|
||||
|
||||
set -l xdg_cache_home (__fish_make_cache_dir)
|
||||
or return
|
||||
|
||||
if not set -q _flag_installed
|
||||
set -l cache_file $xdg_cache_home/pacman
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
__fish_cache_put $cache_file
|
||||
# prints: <package name> Package
|
||||
pacman -Ssq | sed -e 's/$/\t'Package'/' >$cache_file &
|
||||
__fish_cached -t 250 -- "pacman -Ssq | sed -e 's/\$/\\tPackage/'"
|
||||
return 0
|
||||
else
|
||||
pacman -Q | string replace ' ' \t
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
function __fish_print_port_packages
|
||||
type -q -f port || return 1
|
||||
|
||||
# port needs caching, as it tends to be slow
|
||||
set -l xdg_cache_home (__fish_make_cache_dir)
|
||||
or return
|
||||
|
||||
set -l cache_file $xdg_cache_home/port
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
__fish_cache_put $cache_file
|
||||
# Remove trailing whitespace and pipe into cache file
|
||||
printf "all\ncurrent\nactive\ninactive\ninstalled\nuninstalled\noutdated" >$cache_file
|
||||
port echo all | awk '{$1=$1};1' >>$cache_file &
|
||||
cat $cache_file
|
||||
__fish_cached -t 250 -k port '
|
||||
printf "all\ncurrent\nactive\ninactive\ninstalled\nuninstalled\noutdated\n"
|
||||
port echo all | awk \'{$1=$1};1\'
|
||||
'
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -5,44 +5,17 @@ function __fish_print_rpm_packages
|
||||
argparse i/installed -- $argv
|
||||
or return 1
|
||||
|
||||
set -l xdg_cache_home (__fish_make_cache_dir)
|
||||
or return
|
||||
|
||||
if type -q -f /usr/share/yum-cli/completion-helper.py
|
||||
# If the cache is less than six hours old, we do not recalculate it
|
||||
set -l cache_file $xdg_cache_home/yum
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 21600
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
__fish_cache_put $cache_file
|
||||
# Remove package version information from output and pipe into cache file
|
||||
/usr/share/yum-cli/completion-helper.py list all -d 0 -C | sed "s/\..*/\tPackage/" >$cache_file &
|
||||
__fish_cached -t 21600 -k yum-completion-helper -- '/usr/share/yum-cli/completion-helper.py list all -d 0 -C | sed "s/\\..*/\\tPackage/"'
|
||||
return
|
||||
end
|
||||
|
||||
# Rpm is too slow for this job, so we set it up to do completions
|
||||
# as a background job and cache the results.
|
||||
if type -q -f rpm
|
||||
# If the cache is less than five minutes old, we do not recalculate it
|
||||
set -l cache_file $xdg_cache_home/rpm
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# Remove package version information from output and pipe into cache file
|
||||
__fish_cache_put $cache_file
|
||||
rpm -qa | sed -e 's/-[^-]*-[^-]*$/\t'Package'/' >$cache_file &
|
||||
__fish_cached -t 250 -- "rpm -qa | sed -e 's/-[^-]*-[^-]*\$/\\t'Package'/'"
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,22 +5,9 @@ function __fish_print_xbps_packages
|
||||
argparse i/installed -- $argv
|
||||
or return 1
|
||||
|
||||
set -l xdg_cache_home (__fish_make_cache_dir)
|
||||
or return
|
||||
|
||||
if not set -q _flag_installed
|
||||
set -l cache_file $xdg_cache_home/xbps
|
||||
if test -f $cache_file
|
||||
set -l age (path mtime -R -- $cache_file)
|
||||
set -l max_age 300
|
||||
if test $age -lt $max_age
|
||||
cat $cache_file
|
||||
return
|
||||
end
|
||||
end
|
||||
__fish_cache_put $cache_file
|
||||
# prints: <package name> Package
|
||||
xbps-query -Rs "" | sed 's/^... \([^ ]*\)-.* .*/\1/; s/$/\t'Package'/' | tee $cache_file
|
||||
__fish_cached -t 250 -- "xbps-query -Rs '' | sed 's/^... \\([^ ]*\\)-.* .*/\\1/; s/\$/\\t'Package'/'"
|
||||
return 0
|
||||
else
|
||||
xbps-query -l | sed 's/^.. \([^ ]*\)-.* .*/\1/' # TODO: actually put package versions in tab for locally installed packages
|
||||
|
||||
@@ -91,7 +91,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
||||
bind --preset $argv alt-d 'if test "$(commandline; printf .)" = \n.; __fish_echo dirh; else; commandline -f kill-word; end'
|
||||
bind --preset $argv ctrl-d delete-or-exit
|
||||
|
||||
bind --preset $argv alt-s 'for cmd in sudo doas please; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end'
|
||||
bind --preset $argv alt-s 'for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end'
|
||||
|
||||
# Allow reading manpages by pressing f1 (many GUI applications) or Alt+h (like in zsh).
|
||||
bind --preset $argv f1 __fish_man_page
|
||||
|
||||
@@ -10,7 +10,6 @@ function alias --description 'Creates a function wrapping a command'
|
||||
|
||||
set -l name
|
||||
set -l body
|
||||
set -l prefix
|
||||
|
||||
if not set -q argv[1]
|
||||
# Print the known aliases.
|
||||
@@ -51,9 +50,9 @@ function alias --description 'Creates a function wrapping a command'
|
||||
# $body starts with the same command as $name.
|
||||
if test $first_word = $name
|
||||
if contains $name (builtin --names)
|
||||
set prefix builtin
|
||||
set body "builtin $body"
|
||||
else
|
||||
set prefix command
|
||||
set body "command $body"
|
||||
end
|
||||
end
|
||||
set -l cmd_string (string escape -- "alias $argv")
|
||||
@@ -67,8 +66,8 @@ function alias --description 'Creates a function wrapping a command'
|
||||
set wraps --wraps (string escape -- $body)
|
||||
end
|
||||
|
||||
echo "function $name $wraps --description $cmd_string; $prefix $body \$argv
|
||||
end" | source # The function definition in split in two lines to ensure that a '#' can be put in the body.
|
||||
# The function definition in split in two lines to ensure that a '#' can be put in the body.
|
||||
echo "function $name $wraps --description $cmd_string"\n" $body \$argv"\n"end" | source
|
||||
if set -q _flag_save
|
||||
funcsave $name
|
||||
end
|
||||
|
||||
@@ -316,7 +316,7 @@ function fish_config --description "Launch fish's web based configuration"
|
||||
if string match -qr '^tools/' -- $file
|
||||
set content (status get-file $file)
|
||||
else
|
||||
read -z content < $file
|
||||
read -z content <$file
|
||||
end
|
||||
|
||||
printf %s\n $content | while read -lat toks
|
||||
|
||||
@@ -200,16 +200,17 @@ function fish_git_prompt --description "Prompt function for Git"
|
||||
if functions -q __fish_git_prompt_ready && not __fish_git_prompt_ready
|
||||
return 1
|
||||
end
|
||||
set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree HEAD 2>/dev/null)
|
||||
set -l repo_info (command git rev-parse --git-dir --git-common-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree HEAD 2>/dev/null)
|
||||
test -n "$repo_info"
|
||||
or return
|
||||
|
||||
set -l git_dir $repo_info[1]
|
||||
set -l inside_gitdir $repo_info[2]
|
||||
set -l bare_repo $repo_info[3]
|
||||
set -l inside_worktree $repo_info[4]
|
||||
set -q repo_info[5]
|
||||
and set -l sha $repo_info[5]
|
||||
set -l git_common_dir $repo_info[2]
|
||||
set -l inside_gitdir $repo_info[3]
|
||||
set -l bare_repo $repo_info[4]
|
||||
set -l inside_worktree $repo_info[5]
|
||||
set -q repo_info[6]
|
||||
and set -l sha $repo_info[6]
|
||||
|
||||
set -l rbc (__fish_git_prompt_operation_branch_bare $repo_info)
|
||||
set -l r $rbc[1] # current operation
|
||||
@@ -280,7 +281,7 @@ function fish_git_prompt --description "Prompt function for Git"
|
||||
contains -- "$__fish_git_prompt_show_informative_status" yes true 1
|
||||
and test "$dirty" != false
|
||||
end
|
||||
set informative_status (untracked=$untracked __fish_git_prompt_informative_status $git_dir)
|
||||
set informative_status (untracked=$untracked __fish_git_prompt_informative_status $git_common_dir)
|
||||
if test -n "$informative_status"
|
||||
set informative_status "$space$informative_status"
|
||||
end
|
||||
@@ -310,12 +311,12 @@ function fish_git_prompt --description "Prompt function for Git"
|
||||
end
|
||||
|
||||
if contains -- "$__fish_git_prompt_showstashstate" yes true 1
|
||||
and test -r $git_dir/logs/refs/stash
|
||||
and test -r $git_common_dir/logs/refs/stash
|
||||
# If we have informative status but don't want to actually
|
||||
# *compute* the informative status, we might still count the stash.
|
||||
if contains -- "$__fish_git_prompt_show_informative_status" yes true 1
|
||||
set stashstate (count < $git_dir/logs/refs/stash)
|
||||
else
|
||||
set stashstate (count < $git_common_dir/logs/refs/stash)
|
||||
else if test -s $git_common_dir/logs/refs/stash
|
||||
set stashstate 1
|
||||
end
|
||||
end
|
||||
@@ -461,10 +462,10 @@ end
|
||||
function __fish_git_prompt_operation_branch_bare --description "fish_git_prompt helper, returns the current Git operation and branch"
|
||||
# This function is passed the full repo_info array
|
||||
set -l git_dir $argv[1]
|
||||
set -l inside_gitdir $argv[2]
|
||||
set -l bare_repo $argv[3]
|
||||
set -q argv[5]
|
||||
and set -l sha $argv[5]
|
||||
set -l inside_gitdir $argv[3]
|
||||
set -l bare_repo $argv[4]
|
||||
set -q argv[6]
|
||||
and set -l sha $argv[6]
|
||||
|
||||
set -l branch
|
||||
set -l operation
|
||||
|
||||
@@ -244,7 +244,9 @@ def parse_color(color_str):
|
||||
underline = "single"
|
||||
elif comp.startswith("--underline="):
|
||||
underline = comp.stripprefix("--underline=")
|
||||
elif comp.startswith("-u"): # Multiple short options like "-rucurly" are not yet supported.
|
||||
elif comp.startswith(
|
||||
"-u"
|
||||
): # Multiple short options like "-rucurly" are not yet supported.
|
||||
underline = comp.stripprefix("-u")
|
||||
elif comp == "--italics" or comp == "-i":
|
||||
italics = True
|
||||
@@ -253,7 +255,10 @@ def parse_color(color_str):
|
||||
elif comp == "--reverse" or comp == "-r":
|
||||
reverse = True
|
||||
else:
|
||||
def parse_opt(current_best: str, i: int, long_opt: str, short_opt: str | None) -> str:
|
||||
|
||||
def parse_opt(
|
||||
current_best: str, i: int, long_opt: str, short_opt: str | None
|
||||
) -> str:
|
||||
if comp.startswith(long_opt):
|
||||
c = comp[len(long_opt) :]
|
||||
parsed_c = parse_one_color(c)
|
||||
@@ -269,13 +274,18 @@ def parse_color(color_str):
|
||||
c = comps[i + 1]
|
||||
i += 1
|
||||
else:
|
||||
c = comp[len(short_opt):]
|
||||
c = comp[len(short_opt) :]
|
||||
parsed_c = parse_one_color(c)
|
||||
if better_color(current_best, parsed_c) == parsed_c:
|
||||
return True, c, i
|
||||
return False, current_best, i
|
||||
is_bg, background_color, i = parse_opt(background_color, i, "--background", "-b")
|
||||
is_ul, underline_color, i = parse_opt(underline_color, i, "--underline-color", None)
|
||||
|
||||
is_bg, background_color, i = parse_opt(
|
||||
background_color, i, "--background", "-b"
|
||||
)
|
||||
is_ul, underline_color, i = parse_opt(
|
||||
underline_color, i, "--underline-color", None
|
||||
)
|
||||
if not (is_bg or is_ul):
|
||||
# Regular color
|
||||
parsed_c = parse_one_color(comp)
|
||||
|
||||
@@ -1745,7 +1745,7 @@ macro_rules! parse_error_range {
|
||||
$(,)?
|
||||
) => {
|
||||
let text = if $self.out_errors.is_some() && !$self.unwinding {
|
||||
Some(wgettext_maybe_fmt!($fmt $(, $args)*))
|
||||
Some(wgettext_fmt!($fmt $(, $args)*))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
use std::fs::File;
|
||||
use std::os::unix::prelude::*;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use std::{env, ops::ControlFlow};
|
||||
@@ -319,7 +318,7 @@ fn fish_parse_opt(args: &mut [WString], opts: &mut FishCmdOpts) -> ControlFlow<i
|
||||
// A little extra space.
|
||||
name_width += 2;
|
||||
for cat in cats.iter() {
|
||||
let desc = wgettext_str(cat.description);
|
||||
let desc = cat.description.localize();
|
||||
// this is left-justified
|
||||
printf!("%-*ls %ls\n", name_width, cat.name, desc);
|
||||
}
|
||||
@@ -520,7 +519,7 @@ fn throwing_main() -> i32 {
|
||||
reader_init(true);
|
||||
|
||||
// Construct the root parser!
|
||||
let env = Rc::new(EnvStack::globals().create_child(true /* dispatches_var_changes */));
|
||||
let env = EnvStack::globals().create_child(true /* dispatches_var_changes */);
|
||||
let parser = &Parser::new(env, CancelBehavior::Clear);
|
||||
parser.set_syncs_uvars(!opts.no_config);
|
||||
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
|
||||
const VAR_NAME_PREFIX: &wstr = L!("_flag_");
|
||||
|
||||
const BUILTIN_ERR_INVALID_OPT_SPEC: &str = "%ls: Invalid option spec '%ls' at char '%lc'\n";
|
||||
localizable_consts!(
|
||||
BUILTIN_ERR_INVALID_OPT_SPEC
|
||||
"%ls: Invalid option spec '%ls' at char '%lc'\n"
|
||||
);
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum ArgCardinality {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use super::prelude::*;
|
||||
use super::read::TokenOutputMode;
|
||||
use crate::ast::{self, Kind, Leaf};
|
||||
use crate::common::{unescape_string, UnescapeFlags, UnescapeStringStyle};
|
||||
use crate::complete::Completion;
|
||||
@@ -44,12 +45,6 @@ enum AppendMode {
|
||||
Append,
|
||||
}
|
||||
|
||||
enum TokenOutputMode {
|
||||
Expanded,
|
||||
Raw,
|
||||
Unescaped,
|
||||
}
|
||||
|
||||
/// Replace/append/insert the selection with/at/after the specified string.
|
||||
///
|
||||
/// \param begin beginning of selection
|
||||
@@ -223,13 +218,15 @@ fn write_part(
|
||||
if cut_at_cursor && token.end() >= pos {
|
||||
break;
|
||||
}
|
||||
let is_redirection_target = in_redirection;
|
||||
in_redirection = token.type_ == TokenType::redirect;
|
||||
if is_redirection_target && token.type_ == TokenType::string {
|
||||
continue;
|
||||
}
|
||||
if token.type_ != TokenType::string {
|
||||
continue;
|
||||
if token_mode != TokenOutputMode::Raw {
|
||||
let is_redirection_target = in_redirection;
|
||||
in_redirection = token.type_ == TokenType::redirect;
|
||||
if is_redirection_target && token.type_ == TokenType::string {
|
||||
continue;
|
||||
}
|
||||
if token.type_ != TokenType::string {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let token_text = tok.text_of(&token);
|
||||
|
||||
@@ -97,10 +97,7 @@ pub fn fg(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Built
|
||||
job_pos = Some(pos);
|
||||
job = if !j.wants_job_control() {
|
||||
streams.err.append(wgettext_fmt!(
|
||||
concat!(
|
||||
"%ls: Can't put job %d, '%ls' to foreground because ",
|
||||
"it is not under job control\n"
|
||||
),
|
||||
"%ls: Can't put job %d, '%ls' to foreground because it is not under job control\n",
|
||||
cmd,
|
||||
raw_pid,
|
||||
j.command()
|
||||
|
||||
@@ -354,7 +354,9 @@ pub fn function(
|
||||
let props = function::FunctionProperties {
|
||||
func_node,
|
||||
named_arguments: opts.named_arguments,
|
||||
description: opts.description,
|
||||
// Function descriptions are extracted from scripts in `share` via
|
||||
// `build_tools/fish_xgettext.fish`.
|
||||
description: LocalizableString::from_external_source(opts.description),
|
||||
inherit_vars: inherit_vars.into_boxed_slice(),
|
||||
shadow_scope: opts.shadow_scope,
|
||||
is_autoload: RelaxedAtomicBool::new(false),
|
||||
|
||||
@@ -243,11 +243,19 @@ pub fn functions(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -
|
||||
streams.out.appendln(shadow);
|
||||
|
||||
let desc = match props.as_ref() {
|
||||
Some(p) if !p.description.is_empty() => escape_string(
|
||||
&p.description,
|
||||
EscapeStringStyle::Script(EscapeFlags::NO_PRINTABLES | EscapeFlags::NO_QUOTED),
|
||||
),
|
||||
Some(p) if p.description.is_empty() => L!("").to_owned(),
|
||||
Some(p) => {
|
||||
let localized_description = p.description.localize();
|
||||
if localized_description.is_empty() {
|
||||
L!("").to_owned()
|
||||
} else {
|
||||
escape_string(
|
||||
localized_description,
|
||||
EscapeStringStyle::Script(
|
||||
EscapeFlags::NO_PRINTABLES | EscapeFlags::NO_QUOTED,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
_ => L!("n/a").to_owned(),
|
||||
};
|
||||
streams.out.appendln(desc);
|
||||
|
||||
@@ -32,7 +32,7 @@ fn cpu_use(j: &Job) -> f64 {
|
||||
let mut u = 0.0;
|
||||
for p in j.external_procs() {
|
||||
let now = timef();
|
||||
let jiffies = proc_get_jiffies(p.pid.load().unwrap());
|
||||
let jiffies = proc_get_jiffies(*p.pid.get().unwrap());
|
||||
let last_jiffies = p.last_times.get().jiffies;
|
||||
let since = now - last_jiffies as f64;
|
||||
if since > 0.0 && jiffies > last_jiffies {
|
||||
@@ -99,7 +99,7 @@ fn builtin_jobs_print(j: &Job, mode: JobsPrintMode, header: bool, streams: &mut
|
||||
}
|
||||
|
||||
for p in j.external_procs() {
|
||||
out += &sprintf!("%d\n", p.pid.load().unwrap())[..];
|
||||
out += &sprintf!("%d\n", *p.pid.get().unwrap())[..];
|
||||
}
|
||||
streams.out.append(out);
|
||||
}
|
||||
|
||||
@@ -154,6 +154,9 @@ struct Options<'args> {
|
||||
|
||||
no_ext_valid: bool,
|
||||
no_ext: bool,
|
||||
|
||||
all_valid: bool,
|
||||
all: bool,
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -201,14 +204,13 @@ fn construct_short_opts(opts: &Options) -> WString {
|
||||
if opts.no_ext_valid {
|
||||
short_opts.push('E');
|
||||
}
|
||||
|
||||
short_opts
|
||||
}
|
||||
|
||||
/// Note that several long flags share the same short flag. That is okay. The caller is expected
|
||||
/// to indicate that a max of one of the long flags sharing a short flag is valid.
|
||||
/// Remember: adjust the completions in share/completions/ when options change
|
||||
const LONG_OPTIONS: [WOption<'static>; 11] = [
|
||||
const LONG_OPTIONS: [WOption<'static>; 12] = [
|
||||
wopt(L!("quiet"), NoArgument, 'q'),
|
||||
wopt(L!("null-in"), NoArgument, 'z'),
|
||||
wopt(L!("null-out"), NoArgument, 'Z'),
|
||||
@@ -220,6 +222,7 @@ fn construct_short_opts(opts: &Options) -> WString {
|
||||
wopt(L!("unique"), NoArgument, 'u'),
|
||||
wopt(L!("key"), RequiredArgument, NON_OPTION_CHAR),
|
||||
wopt(L!("no-extension"), NoArgument, 'E'),
|
||||
wopt(L!("all"), NoArgument, '\x02'),
|
||||
];
|
||||
|
||||
fn parse_opts<'args>(
|
||||
@@ -339,6 +342,11 @@ fn parse_opts<'args>(
|
||||
opts.key = w.woptarg;
|
||||
continue;
|
||||
}
|
||||
|
||||
'\x02' if opts.all_valid => {
|
||||
opts.all = true;
|
||||
continue;
|
||||
}
|
||||
_ => {
|
||||
path_unknown_option(parser, streams, cmd, args_read[w.wopt_index - 1]);
|
||||
return Err(STATUS_INVALID_ARGS);
|
||||
@@ -846,6 +854,7 @@ fn path_filter_maybe_is(
|
||||
opts.types_valid = true;
|
||||
opts.perms_valid = true;
|
||||
opts.invert_valid = true;
|
||||
opts.all_valid = true;
|
||||
let mut optind = 0;
|
||||
|
||||
parse_opts(&mut opts, &mut optind, 0, args, parser, streams)?;
|
||||
@@ -873,18 +882,35 @@ fn path_filter_maybe_is(
|
||||
None
|
||||
};
|
||||
|
||||
for (arg, _) in arguments.filter(|(f, _)| {
|
||||
(opts.perms.is_none() && opts.types.is_none())
|
||||
|| (filter_path(&opts, f, uid, gid) != opts.invert)
|
||||
}) {
|
||||
// Collect arguments into a Vec so we can use .len()
|
||||
let arguments_vec: Vec<_> = arguments.collect();
|
||||
|
||||
for (arg, _) in arguments_vec
|
||||
.iter()
|
||||
.filter(|&(f, _)| {
|
||||
(opts.perms.is_none() && opts.types.is_none())
|
||||
|| (filter_path(&opts, f, uid, gid) != opts.invert)
|
||||
})
|
||||
.cloned()
|
||||
{
|
||||
// If we don't have filters, check if it exists.
|
||||
if opts.perms.is_none() && opts.types.is_none() {
|
||||
let ok = waccess(&arg, F_OK) == 0;
|
||||
if ok == opts.invert {
|
||||
// For --all, fail early if any path does not match the filter.
|
||||
if opts.all {
|
||||
return Err(STATUS_CMD_ERROR);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
n_transformed += 1;
|
||||
|
||||
if opts.all {
|
||||
// For --all, do not output paths, just check all must match.
|
||||
continue;
|
||||
}
|
||||
// We *know* this is a filename,
|
||||
// and so if it starts with a `-` we *know* it is relative
|
||||
// to $PWD. So we can add `./`.
|
||||
@@ -895,12 +921,16 @@ fn path_filter_maybe_is(
|
||||
} else {
|
||||
path_out(streams, &opts, arg);
|
||||
}
|
||||
n_transformed += 1;
|
||||
if opts.quiet {
|
||||
return Ok(SUCCESS);
|
||||
};
|
||||
}
|
||||
|
||||
if opts.all && n_transformed != arguments_vec.len() {
|
||||
// We have a filter and some paths didn't match.
|
||||
// Return Err if we have a filter and some paths didn't match.
|
||||
return Err(STATUS_CMD_ERROR);
|
||||
}
|
||||
if n_transformed > 0 {
|
||||
Ok(SUCCESS)
|
||||
} else {
|
||||
@@ -922,7 +952,6 @@ pub fn path(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> Bui
|
||||
return Err(STATUS_INVALID_ARGS);
|
||||
};
|
||||
let argc = args.len();
|
||||
|
||||
if argc <= 1 {
|
||||
streams
|
||||
.err
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user