Commit Graph

11621 Commits

Author SHA1 Message Date
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
Johannes Altmanninger
3de95038b0 Make "time" a job prefix
In particular, this allows `true && time true`, or `true; and time true`,
and both `time not true` as well as `not time true` (like bash).

time is valid only as job _prefix_, so `true | time true` could call
`/bin/time` (same in bash)

See discussion in #6442
2020-01-03 01:07:49 -06:00
Aaron Gyes
c1140bc436 Improve kill completions
Use string split instead of cut - which we'd fork for 2*signal
count times in a loop when tab was first pressed. Noticably faster

If giving a signal num, what works everywhere is -NUM, if giving
a signal name, what works everywhere is -s NAME - don't show -sNUM
or -NAME completions; that only works on GNU and it's redundant
anyhow as we show the signal number in the description field for -s
or the signal name for the -NUM case in the pager.

Sort -sNAME completions by the signal number not alphabetical

Shorten descriptions
2020-01-02 22:53:28 -08:00
David Adam
4ccd33a9d0 debian packaging: slight bump in Debian standards version
No changes required between 3.9.4 and 3.9.7 for fish packages.

[ci skip]
2020-01-02 22:37:36 +08:00
David Adam
5df84c1998 cmake: use correct variable for C++ compiler flags
Broken in 8ca936aea6
2020-01-02 22:08:59 +08:00
ridiculousfish
89880891d0 Revert "fish_tests to set HOME and other variables to temporary dir"
This reverts commit cca57a7a87.

The tests target already sets some variables - backing this out.
2020-01-01 17:24:14 -08:00
ridiculousfish
cca57a7a87 fish_tests to set HOME and other variables to temporary dir
Rather than placing files in the user's home directory, have fish_tests
manipulate HOME to be a temporary directory.
2020-01-01 16:34:56 -08:00
ridiculousfish
65e9f31c7a Use autoclose_fd_t more pervasively in history 2020-01-01 13:49:10 -08:00
ridiculousfish
5aa22adccc Make history_filename return a maybe_t<wcstring>
This function can fail, so rather than forcing clients to check the return
value as empty, allow it to return none().
2020-01-01 12:34:42 -08:00
ridiculousfish
efa9d5dd6a Port cd tests to littlecheck 2019-12-31 14:16:20 -08:00
ridiculousfish
91404f1762 Rename job_ids check to job-ids
Other tests use a dash.
2019-12-31 13:32:04 -08:00
ridiculousfish
9a11c03097 Correct the job_ids test on the Mac
The Mac doesn't provide CPU percentages so the column is omitted, causing
the test to fail. Use a regex to cover both cases.
2019-12-31 13:17:26 -08:00
ridiculousfish
b691d3130e Don't give job IDs to block processes either
Extend the commit 8e17d29e04 to block processes, for example:

    begin ; stuff ; end

or if/while blocks as well.

Note there's an existing optimization where we do not create a job for a
block if it has no redirections.
2019-12-31 13:12:24 -08:00
ridiculousfish
a6e5583b5b Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:

    std::rotate(begin, job, end)

However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].

Correct this by replacing it with:

    std::rotate(begin, job, job+1);

now we get the desired [2, 1, 3].

Also add a test.
2019-12-31 12:41:11 -08:00