Commit Graph

13469 Commits

Author SHA1 Message Date
Akatsuki Rui
1a9835f55e
completions/mtr: init (#7638)
* completions/mtr: init

Add mtr completion.

[ci skip]

* completions/mtr: edit descriptions
2021-01-19 18:09:09 +01:00
Fabian Homborg
89962da059 CHANGELOG: More 3.2.0 2021-01-19 13:45:00 +01:00
ridiculousfish
ef3b6750ba Add some additional packges to our Docker image based tests
This allows using sudo and openssl
2021-01-18 15:51:03 -08:00
ridiculousfish
7f15ec51fd Add a password for fishuser accounts in some Docker images
The password is fish
2021-01-18 15:37:13 -08:00
Mahmoud Al-Qudsi
e2273bacb2 Separate completions for GNU and BSD ps command
It's not just -F; the majority of options are actually not portable
between the two.

Closes #7545
2021-01-18 14:23:39 -06:00
Fabian Homborg
88a84bd988 reader: Force ONLCR on for fish and external commands
Just like OPOST this just breaks output for anything not prepared for
it. Fish itself might work with it (and #4505 recommends it), but external commands are broken.

You'll see output like

foo
   ⏎

from `echo foo`.

Fixes #4873.

Continuation of #7133.
2021-01-18 21:00:08 +01:00
Fabian Homborg
bc6414aaa8
!fixup fish_git_prompt: Fix variable name
This missed one use of $user_variable
2021-01-18 12:37:30 +01:00
Fabian Homborg
8b133833fa Don't inherit windows paths for $PWD
If given a windows path like `F:\foo`, this currently ends up
assert()ing in path_normalize_for_cd.

Instead, since these paths violate a bunch of assumptions we make, we
reject them and fall back on getting $PWD via getcwd() (which should
give us a nice proper unixy path).

Fixes #7636.

This isn't tested because it would require a system where a windowsy
path passes paths_are_same_file, and on the unix systems we run our
tests that's impossible as far as I can tell?
2021-01-17 23:08:04 +01:00
Fabian Homborg
dbfd3b5c39 fish_git_prompt: Remove a few unneeded variables 2021-01-17 21:04:16 +01:00
Fabian Homborg
1285957703 docs: Add glob example to variable overrides
And clarify that it'll still run the same things
2021-01-17 10:31:23 +01:00
Fabian Homborg
e2fb645c0c docs: Don't add rst sources
This used to add a "_sources" directory with all the ".rst" files
renamed to ".rst.txt".

That took up ~0.7M of the total size for very little use.
2021-01-16 19:33:12 +01:00
Fabian Homborg
fa9c233065 Add a simple git test
Just checks two completions and the prompt for now, but shows what is possible.

Work on #4249.
2021-01-16 13:30:04 +01:00
Fabian Homborg
5ca27ac565 Update littlecheck
From commit b1369a52c24336da2d2d6d5dc6707a7834065d43

This adds the "REQUIRES" directive that allows specifying
preconditions for tests, which allows us to add tests that don't have
to run on all systems.

Now, I don't want to just make all tests specific to an OS or
something, but e.g. a `git` test would be a honkin' great idea, and we
can't ask everyone to have `git`!
2021-01-16 13:26:01 +01:00
Fabian Homborg
932074f06c escape_string_script: Escape DEL as \x7f
This used to print a literal DEL character in the output for `bind`,
which wouldn't actually show up and made it hard to figure out what
the key was.

So we just escape it back to how we actually used it - `\x7f`.

Fixes #7631.
2021-01-16 12:49:49 +01:00
Fabian Homborg
a4f5dd5054 set: Move the new values
A C++ special!

This makes

```fish
set -l var (seq 1 10000)
set -l v
for f in $var
    set -a v $f
end
```

~15% faster by removing allocations.
2021-01-15 21:00:25 +01:00
Johannes Altmanninger
f176503c0f Remove the explicit undo group in fish_clipboard_paste
It doesn't change the behavior, see
7669e8e497 (r45675920)
2021-01-15 20:23:59 +01:00
Johannes Altmanninger
692a8aef03 completions/xargs: provide subcommand completions 2021-01-15 20:23:59 +01:00
Fabian Homborg
e192066e98 Add $fish_handle_reflow to disable winch handler
Overriding event handlers is annoying.
2021-01-15 18:37:06 +01:00
Fabian Homborg
48082daad4 Turn off reflowing for Konsole >= 21.04 as well
See https://bugs.kde.org/show_bug.cgi?id=196998, https://invent.kde.org/utilities/konsole/-/merge_requests/321

Part of #7491.
2021-01-15 18:37:06 +01:00
David Adam
d0167634e7 CHANGELOG: work on 3.2.0 2021-01-13 21:52:31 +08:00
Ben Woods
1890c848e0
completions: Add support for lightdm and dm-tool commands (#7624) 2021-01-13 14:37:42 +01:00
Henrik Hermansen
1d1e8a54a0 Properly fix git diff check 2021-01-13 14:36:41 +01:00
Henrik Hermansen
eaf7431c38 Fix Git status in Acidhub prompt
Fix 1: The --quiet flag must be at the end of the command. The way it was I would never get any status symbol in my prompt as the command failed.
Fix 2: After adding files to git, but before committing them, git status is unsorted. This gave me the output "M A M A" after `uniq`, which resulted in 4 status symbols instead of 2. Sorting them before filtering them fixed the problem.
2021-01-13 14:36:41 +01:00
Clément Martinez
c76074b1d6 Add losetup completions 2021-01-12 08:22:28 +01:00
ridiculousfish
7a0bddfcfa Teach string repeat to handle multiple arguments
Each argument in string repeat is handled independently, except that the
--no-newline option applies only to the last newline.

Fixes #5988
2021-01-11 17:00:06 -08:00
ridiculousfish
290d1f2cd6 Mild refactoring of builtin_string repeat
Preparation for fixing issue 5988; no behavior change expected here.
2021-01-11 16:52:39 -08:00
ridiculousfish
1d4883d810 Remove an unnecessary 'using' declaration
This was just redundant with the struct tag.
2021-01-11 15:23:52 -08:00
ridiculousfish
7207a205f2 Switch history races test to use threads instead of processes
This avoids issues with ASan and TSan whose allocators do not properly
clean up in atfork, leading to deadlocks in child processes.
2021-01-11 12:44:21 -08:00
ridiculousfish
2709467b73 Add a Ubuntu bionic asan clang dockerfile test
This may be run with:

    ./docker/docker_run_tests.sh ./docker/bionic-asan-clang.Dockerfile
2021-01-11 12:44:21 -08:00
Fabian Homborg
32c65aa32c Lock threads only once a day
This ran hourly, and that's really not necessary anymore.
2021-01-11 21:03:10 +01:00
Fabian Homborg
3fc9c0b38c tests: Increase cancellation delay
This sometimes fails on github actions with ASAN. I am assuming that's
because the ctrl-c happens *before* the process has had a chance to
start.

So we do what we do and increase the delay.
2021-01-11 21:00:33 +01:00
Fabian Homborg
7bf2b9fd43 output: Rename some variables
These are a foreground and a background color. Now I see the point in
not naming them "foreground_color" and "background_color", but at
least "fg" and "bg" should do, right?
2021-01-11 20:56:15 +01:00
Fabian Homborg
f7b2bf8229 output: Simplify some duplicated code
Becomes a bit boring after a while
2021-01-11 20:53:11 +01:00
Fabian Homborg
19efd22468 env: Setup $HOME/$USER *before* the config directories
They are based on $HOME, so setting $HOME has to be done first.

Fixes #7620

(untested because I'm assuming common CI systems have weird $HOME settings)
2021-01-11 18:51:47 +01:00
exploide
20d91c6be2 added completion script for alternatives 2021-01-10 18:35:46 +01:00
Fabian Homborg
bb3b6e3329 completions/timedatectl: Add missing quotes
Oops!

Supersedes #7617.
2021-01-10 18:33:31 +01:00
Collin Styles
f496b07c7c Fix completion for --exact option to fzf
These double hyphens will make the completion resolve to `----exact`
which isn't a valid option.
2021-01-10 09:17:21 +01:00
ridiculousfish
e8c9da100c Track histories with shared_ptr
Prior to this change, histories were immortal and allocated with either
unique_ptr or just leaked via new. But this can result in races in the
path detection test, as the destructor races with the pointer-captured
history. Switch to using shared_ptr.
2021-01-09 17:02:11 -08:00
ridiculousfish
e062a07a97 Revert "Stop using unique_ptr to store histories"
This reverts commit 6f91195f40.
This triggered ASan complaints due to leaks.
2021-01-09 17:02:11 -08:00
ridiculousfish
87dacc0e95 Improve formatting and layout of history path detection test 2021-01-09 17:02:11 -08:00
ridiculousfish
884eb2b198 Remove an unused static variable 2021-01-09 17:02:11 -08:00
Fabian Homborg
7fc72e46b3 docs: Add more about $PATH being imported to the tutorial
Fixes #7539.
2021-01-09 22:45:03 +01:00
ridiculousfish
89687e7db7 Fix a warning building on Linux
Initialize saved_errno
2021-01-09 13:14:54 -08:00
Fabian Homborg
168677f8b3 Use disown with $last_pid
As mentioned in 5b706faa73, bare
`disown` has a problem: It disowns the last *existing* job.

Unfortunately, it's easy to see cases where that won't happen:

    sleep 5m &
    /bin/true & # will exit immediately
    disown # will most likely disown *sleep*, not true

So what we do is to pass $last_pid.

In help especially this is likely to occur because many graphical
browsers fork immediately to avoid blocking the terminal (we only
added the backgrounding and disown because some weren't).

Note that it's *possible* this doesn't occur if used in the same
function, but I don't want to rely on those semantics.

It might be worth doing this as the default - see #7210.
2021-01-09 13:44:48 +01:00
Fabian Homborg
b489137fa9 docs: Link to fish_key_reader 2021-01-09 13:13:48 +01:00
Fabian Homborg
f22fe44c79 CHANGELOG 7614 2021-01-09 12:13:24 +01:00
Fabian Homborg
1dd776ec99 echo: Don't interpret and print options
A weird interaction between grouped short options and our weird option
parsing that puts unknown options back:

```
echo "-n foo"
```

would see the `-n`, turn off printing newlines, interpret the " " as
another grouped short option, see that there is no short option for
space and put the entire token back on the arguments pile.

So it would print "-n foo" *without a newline*.

Fix this by keeping an old state of the options around and reverting
it when putting options back.

The alternative is *probably* to forbid the " " short option in
wgetopt, then check if an option group contains it and error out, but
this should only really be a problem in `echo` because that is,
AFAICT, the only thing that puts the options back.

Fixes #7614
2021-01-09 08:50:30 +01:00
ridiculousfish
3c3d09b65f Fix a tsan warning in features_t 2021-01-08 19:36:56 -08:00
ridiculousfish
6f91195f40 Stop using unique_ptr to store histories
These register shutdown dtors, which cause tsan to complain.
2021-01-08 14:14:05 -08:00
ridiculousfish
bee8e8f6f7 Expand more when performing history path detection
When adding a command to history, we first expand its arguments to see
if any arguments are paths which refer to files. If so, we will only
autosuggest that command from history if the files are still valid. For
example, if the user runs `rm ./file.txt` then we will remember that
`./file.txt` referred to a file, and then only autosuggest that if the file
is present again.

Prior to this change we only performed simple expansion relative to the
working directory. This change extends it to variables and tilde
expansion. For example we will now apply the same hinting for
`rm ~/file.txt`

Fixes #7582
2021-01-08 12:58:34 -08:00