Commit Graph

11784 Commits

Author SHA1 Message Date
ridiculousfish
6705a2efc6 Migrate a bunch of code out of common.h
Put it into wcstringutil, path, or a new file null_terminated_array.
2020-01-15 13:16:43 -08:00
ridiculousfish
273afca3da Remove some dead code 2020-01-15 11:59:40 -08:00
ridiculousfish
4f01eef88d Default some ivars in wildcard_expander_t 2020-01-15 11:43:10 -08:00
ridiculousfish
5f130c2d6d Give wildcard_expand_result_t a real return value
Use an enum instead of an int.
2020-01-15 11:11:43 -08:00
David Adam
607b40f4c6 CHANGELOG: further work on 3.1.0
[ci skip]
2020-01-16 00:32:59 +08:00
ridiculousfish
7e1270ae70 Be more disciplined about cancellation signals
Rather than storing a "should cancel" flag in the parser, store the
actual signal which triggered cancellation.
2020-01-14 15:20:04 -08:00
Shun Sakai
a7442207c2 CHANGELOG: add hwinfo and chronyc completions 2020-01-14 17:17:28 +01:00
Shun Sakai
8c725c7d54 Add chronyc completions 2020-01-14 17:17:28 +01:00
Shun Sakai
316bb88ee7 Add hwinfo completions 2020-01-14 17:17:28 +01:00
ridiculousfish
47b87dbeb7 Factor internal process short-circuiting together
When executing a buffered block or builtin, the usual approach is to
execute, collect output in a string, and then output that string to
stdout or whatever the redirections say. Similarly for stderr.

If we get no output, then we can elide the outputting which means
skipping the background thread. In this case we just mark the process as
finished immediately.

We do this in multiple locations which is confusing. Factor them all
together into a new function run_internal_process_or_short_circuit.
2020-01-13 14:46:31 -08:00
ridiculousfish
fe4f7fea5c run_internal_process can no longer fail, remove its bool return 2020-01-13 14:40:24 -08:00
ridiculousfish
1efa641105 Move some fflushes around in handle_builtin_output 2020-01-13 14:35:20 -08:00
ridiculousfish
7b25787e52 Mild refactoring of exec_block_or_func_process
Reduce some code duplication.
2020-01-13 14:28:28 -08:00
ridiculousfish
399062c219 Rationalize a bit of how failed exec() works
We don't need to mark the job as completed in this case, because the
caller will remove the job.
2020-01-13 14:18:43 -08:00
ridiculousfish
8d598dcffc Use handle_child_status when reaping internal procs
This reduces the number of distinct locations where we mark a process as
completed.
2020-01-13 14:12:05 -08:00
Fabian Homborg
69b464bc37 Run fish_indent on all our fish scripts
It's now good enough to do so.

We don't allow grid-alignment:

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z              -a '(something)'
```

becomes

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```

It's just more trouble than it is worth.

The one part I'd change:

We align and/or'd parts of an if-condition with the in-block code:

```fish
if true
   and false
    dosomething
end
```

becomes

```fish
if true
    and false
    dosomething
end
```

but it's not used terribly much and if we ever fix it we can just
reindent.
2020-01-13 20:34:22 +01:00
Fabian Homborg
31e6ae0099 Ignore EPERM for setpgid
In case we are a session leader, we get a harmless EPERM, yet we used
to quit. Stop doing that.

Fixes #6499.
2020-01-13 18:57:19 +01:00
Fabian Homborg
759d5a1fb3 Fix uvar error message
This used a wstring format when it was a narrow string.
2020-01-13 17:48:09 +01:00
239
56f52bc693 Add completions for cryptsetup (#6488) 2020-01-13 10:47:52 +01:00
Johannes Altmanninger
0c92c7d8ac Fix remote path escaping for rsync and scp completions
They need to be escaped twice, for the local and the remote shell.
Also don't suggest local files as rsync remote paths (-a -> -xa) and
fix completion for remote paths containing multiple consecutive spaces.

Fixes #1872
[ci skip]
2020-01-13 10:30:57 +01:00
Johannes Altmanninger
e3782603ec Load vendor configuration from $XDG_DATA_DIRS/vendor_*.d
$XDG_DATA_DIRS/vendor_{completions,conf,functions}.d
Additionally, CMake variables extra_{completions,conf,functions}dir are
appended, if they are not already contained in $XDG_DATA_DIRS.

If XDG_DATA_DIRS is not defined, we fall back to

$__fish_datadir/vendor_completions.d:${extra_completionsdir}

for completions. Same for conf and functions.
2020-01-12 16:12:41 +01:00
David Adam
577dd1ccf1 CHANGELOG: work on 3.1.0
Updates to f136d634eb
2020-01-12 22:39:26 +08:00
239
0acaf766a2 Update Keybase completions (#6479)
* Update Keybase completions

* Apply suggested change for filtering options
2020-01-10 17:12:12 +01:00
Frederik Gladhorn
19a320caa8 Clarify how to redirect stderr into stdout in tutorial 2020-01-09 18:39:20 +01:00
Fabian Homborg
eb7172458b Add .desktop file and logo for appimage
The logo is actually extracted from the site, but since it's just for
the appimage (I don't even know where it shows it, tbh) it's okay for
now.

Progress towards #6475.

[ci skip]
2020-01-08 19:50:46 +01:00
Johannes Altmanninger
9a355d5482 complete: replace confusing comment with test case 2020-01-08 17:53:46 +01:00
Johannes Altmanninger
75fa3b6bae unbreak missing argument error on long option 2020-01-08 17:33:36 +01:00
Johannes Altmanninger
fdf398e435 show missing argument error only for last flag
closes #6483
2020-01-08 14:59:26 +01:00
Johannes Altmanninger
0e707b88f0 argparse: fix error message for missing option argument
case #1 in #6483
2020-01-08 14:38:05 +01:00
Johannes Altmanninger
d8e93a5956 fix sphinx warning
[ci skip]
2020-01-08 09:38:54 +01:00
Johannes Altmanninger
992c864f26 Don't overwrite unrelated variables with for-loop-variables
for-loops that were not inside a function could overwrite global
and universal variables with the loop variable.  Avoid this by making
for-loop-variables local variables in their enclosing scope.

This means that if someone does:

    set a global
    for a in local; end
    echo $a

The local $a will shadow the global one (but not be visible in child
scopes). Which is surprising, but less dangerous than the previous
behavior.

The detection whether the loop is running inside a function was failing
inside command substitutions. Remove this special handling of functions
alltogether, it's not needed anymore.

Fixes #6480
2020-01-08 09:10:14 +01:00
ridiculousfish
e0cdea9bb6 Correct the usleep calculation in fish_test_helper
'fish_test_helper print_pid_then_sleep' tried to sleep for .5 seconds,
but instead it divided by .5 so it actually slept for 2 seconds.

This exceeds the maximum value on NetBSD so it wasn't sleeping at all
there.

Fixes #6476
2020-01-07 17:07:51 -08:00
Norio Nomura
cc7618985a Don't override exit status when stderr is closed by 2>&-
fixes #6470
2020-01-07 19:57:35 +01:00
Fabian Homborg
b7a0031174 docs/faq: Some minor extensions
[ci skip]
2020-01-06 21:48:35 +01:00
Fabian Homborg
f637b81fb6 sample_prompts/acidhub: Use prompt_pwd
This removes a call to `sed` and allows the user to specify shortening
via the variable.

We still default to disabling shortening because this prompt never
did.

[ci skip]
2020-01-06 18:41:50 +01:00
Guilhem Saurel
9910ee26cd disable virtualenv prompt update in nim prompt
As this information is already wrapped into a _nim_prompt_wrapper
2020-01-06 17:06:24 +01:00
Fabian Homborg
4bfc7318e9 docs/time: Add a note about time command
[ci skip]
2020-01-05 22:28:39 +01:00
Fabian Homborg
484e590b7b Readd unconst cast to tparm calls
Removed in 0dfa7421f3, breaks build with NetBSD curses.
2020-01-05 22:28:39 +01:00
ridiculousfish
f1ce967dfa Do not allow empty items to be added to history
Empty items are used as sentinels to indicate that we've reached the end of
history, so they should not be added as actual items. Enforce this.

Fixes #6032
2020-01-05 12:47:02 -08:00
Fabian Homborg
24970bb549 checks: Use "sleep" without "s" suffix
FreeBSD's sleep doesn't accept it.
2020-01-05 18:41:56 +01:00
Fabian Homborg
611a6589ea Disable command descriptions on macOS 10.15.X
We just do a cheesy version check and hope it works out.

If this is fixed in 10.15.4, we have to reenable it. If it still isn't
fixed in 10.16, we need to adjust it.

Fixes #6270
2020-01-05 18:35:59 +01:00
Fabian Homborg
0f362b4bb2 Change c{begin,end} to begin,end
Unfortunately old distributions are old.

Fixes build failures on GCC 4.8 (RHEL6/7).
2020-01-05 15:44:05 +01:00
Fabian Homborg
23bf9661b2 Document time
This is a bit barebones, but `time` isn't super complicated to use and
it should explain the basics.

Fixes #6442

[ci skip]
2020-01-05 14:50:54 +01:00
Fabian Homborg
f3dbede2a5 Document variable overrides
[ci skip]
2020-01-05 14:44:48 +01:00
Fabian Homborg
0a379135a4 exec_job: Only call getpgrp() once
This reduces the syscall count for `fish -c exit` from 651 to 566.

We don't attempt to *cache* the pgrp or anything, we just call it once
when we're about to execute the job to see if we are in foreground and
to assign it to the job, instead of once for checking foreground and
once to give it to the job.

Caching it with a simple `static` would get the count down to 480, but
it's possible for fish to have its pgroup changed.
2020-01-05 09:41:06 +01:00
Aaron Gyes
d0b0c9a77e minor pcre2_matcher_t cleanup 2020-01-03 16:17:41 -08:00
Aaron Gyes
5281aca659 builtin_string.cpp: remove effectively dead variable 2020-01-03 16:17:41 -08:00
Mahmoud Al-Qudsi
038084b8bf Optimize generation, filtering, and sort of completions 2020-01-03 17:54:14 -06:00
ridiculousfish
62302ee172 Properly print leading comments and indentation in functions
Store the entire function declaration, not just its job list.
This allows us to extract the body of the function complete with any
leading comments and indents.

Fixes #5285
2020-01-03 14:40:28 -08:00
Johannes Altmanninger
c3374edc59 Reject time with background jobs
This check could probably done earlier in the parser but it works.
2020-01-03 01:07:49 -06:00