Commit Graph

9006 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
e8b6705067 Add OS check to pkg completions 2018-06-07 12:22:47 -05:00
Mahmoud Al-Qudsi
c133cb2f1a Log addition of serve completions 2018-06-05 13:35:37 -05:00
Twinkle
3b1806a904 Add completions for serve
See: https://github.com/zeit/serve
2018-06-05 16:36:22 +02:00
Sabine Maennel
b347b44d9e added 2 sections to the tutorial
Added 2 sections to the tutorial:
- getting started
- switching to fish

This fixes issue #475
2018-06-04 20:39:08 -07:00
Mahmoud Al-Qudsi
086d088e1b Fix scp completions to support bidirectional transfer
Also hardcode standard /bin/ls to avoid issues with `ls` aliases on the
target, and inherit the (improved) list of remotes from `ssh`.
2018-06-04 07:32:21 -05:00
Mahmoud Al-Qudsi
c8c3265cb8 Fix completions for service
I'm not sure what was up with the old completions,
`$__fish_service_commands` is not set anywhere and completions for the
command (not the service) were not being generated on my machine.
2018-06-04 07:32:21 -05:00
Mahmoud Al-Qudsi
fd14e459cf Add completions for xsv 2018-06-04 07:32:21 -05:00
Mahmoud Al-Qudsi
f6a1bc1489 Fix unzip completions for non Info-ZIP versions
macOS and (AFAICT) most Linux distributions ship with the Info-ZIP
version of unzip, which has the `unzip -h` flag; but other
implementations of unzip do not necessarily have it (i.e. FreeBSD).

`unzip` under FreeBSD does not support `unzip -h`. Under both Linux and
FreeBSD, `unzip -v` presents the list of options, though. Using this
instead of `unzip -h` to detect the Debian-patched version of the
Info-ZIP unzip program.
2018-06-03 14:57:11 -05:00
Fabian Homborg
8de5af5f9e Fix off-by-one in complete_cmd_desc
The substring constructor (string(str, pos)) includes pos, so we need
to add one. Also be careful not to go over the length again.
2018-06-03 19:17:02 +02:00
kewl fft
ebc5e18956 add xclip support for clipboard copy and paste functions 2018-06-03 00:39:07 +02:00
Mahmoud Al-Qudsi
56198818b0 Work around compiler warning regarding C++17 name mangling
[9/13] Building CXX object CMakeFiles/fishlib.dir/src/builtin_string.cpp.o
../src/builtin_string.cpp:1221:12: warning: mangled name of 'string_transform' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
static int string_transform(parser_t &parser, io_streams_t &streams, int argc, wchar_t **argv, decltype(std::towlower) func) {
           ^
1 warning generated.
2018-06-01 22:53:33 -05:00
Fabian Homborg
39905d4135 Skip fish_vi_cursor when not interactive
This prints an escape sequence, so it can break scp or similar when
someone has an unqualified

    fish_vi_key_bindings

in config.fish and happens to run a terminal that can set the cursor.
2018-06-01 20:26:54 +02:00
Fabian Homborg
72e9d41dcc [complete] Fix crash with __fish_describe_command
Our completion machinery calls our `__fish_describe_command` function
to describe commands via apropos. Only it trusts the output a bit too
much, so it crashes when any line from that is shorter than the
original string.

Fix this by skipping any string that is shorter than the original,
since it can't be a match anyway.

Also stop doing wcslen so often - std::strings are nice!

Fixes #5014.
2018-06-01 20:16:23 +02:00
Fabian Homborg
44d68f99ea [completions/gcc] Improve wording
These completions are apparently based on an auto-generated version,
so there's a whole bunch of rewording to be done here.

Also for some reason some of the options are mentioned more than once?
2018-06-01 20:16:23 +02:00
Mahmoud Al-Qudsi
f741968d6d Drop hard dependency on bash from git_version_gen.sh again
I can't seem to find a reason why the shell interpreter needs to be bash
and not just sh here. Needed to replace `BASH_SOURCE[0]` with the legacy
`$0` supported by sh, but otherwise it seems to still work.

Many non-Linux platforms do not ship with bash out-of-the-box (and as a
shell, I don't think we need to encourage the further proliferation of
bash ;-), this lets fish build on a clean install of FreeBSD, which does
not have bash.
2018-06-01 12:48:03 -05:00
Mahmoud Al-Qudsi
e26d5418af Revert "Blow away existing $fish_data_dir on (re)install"
This reverts commit e35983438e.
Reopens #4314. Closes #5007.

# Conflicts:
#	share/config.fish
2018-05-31 22:41:49 -05:00
David Adam
8a6fe77f71 docs: remove unneeded dashes 2018-05-31 13:07:02 +08:00
David Adam
84f5d2082a Mark arguments as optional in read docs synopsis 2018-05-31 13:07:02 +08:00
Fabian Homborg
fa8248f170 [completions/git] Don't run __fish_git_refs twice for "log"
That's already included in `__fish_git_ranges`, so we don't need to do
it again.

Mentioned in #4117.
2018-05-30 18:10:52 +02:00
Fabian Homborg
0f4126c115 Silence winch handler
Fixes #4876.
2018-05-29 18:40:29 +02:00
Fabian Homborg
93d40f9143 [input] Only timeout if the last character was escape
There really is no need to

- Timeout just because the _first_ character was a control character

- Timeout because of any control character other than escape

The reason to timeout because the '\e' sequence can appear by itself (signifying
pressing the escape key) and still make
sense - e.g. vi-mode has it bound to a rather important function!

But a \c can't appear by itself, so we can just block.

This allows binding sequences like \cx\ce and inputting them at a
leisurely pace rather than the frantic escape_timeout one.

It should also improve sequences that _include_ escape somewhere else.

E.g. something like a\eb ("a, then alt+b") should now time out for the "\eb" part,
allowing users to bind a\e ("a, then escape") to something else. Why you'd want to do
that, I have no idea. But it's more consistent, and that's nice!
2018-05-29 18:40:29 +02:00
David Adam
725062d360 fish.spec: switch to cmake builds 2018-05-29 13:46:14 +08:00
Gustaf Johansson
23eb63eb2f completions: [git] Added git help completions
This patch adds completions for the help subcommand of git.
2018-05-28 12:15:19 +02:00
Fabian Homborg
88e6930b57 [string] Be explicit about nextstr() type 2018-05-28 12:10:40 +02:00
Fabian Homborg
ca897807eb Add some tests for string and NUL 2018-05-28 12:10:40 +02:00
Fabian Homborg
49c736f407 [string] Move split/repeat to wcstring 2018-05-28 12:10:40 +02:00
Fabian Homborg
e468c767b5 [String] Partially switch match/replace to string
For regex-mode, this should be enough to read NUL-delimited strings to act on, but not
quite patterns and replacements.

Glob-mode requires more work - it uses wcscmp internally, which is unsuitable.
2018-05-28 12:10:40 +02:00
Fabian Homborg
1e2fa80d3e Switch (un)escape to wcstring
Also the various styles have one function each with barely any
difference - mostly passing the corresponding STYLE argument.

Pack them into one function for escape and one for unescape to save
about 100 lines.
2018-05-28 12:10:40 +02:00
Fabian Homborg
0cfe722a93 Switch lower/upper to wcstring
Also, these are different only in that one uses "towlower", the other
"towupper". So just make one function that both call.
2018-05-28 12:10:40 +02:00
Fabian Homborg
191ca21092 Switch trim to wcstring 2018-05-28 12:10:40 +02:00
Fabian Homborg
4cc0c3bfa7 Switch string sub to wcstring 2018-05-28 12:10:40 +02:00
Fabian Homborg
583d771b10 Fix escape_string_var for UTF-16
We're now actually handling wchar_t here, so comparing the 0x80 bit
would break for UTF-16, causing ASCII false-positives.

Also simplifies a bit, since we no longer need a second variable.
2018-05-28 12:10:40 +02:00
Fabian Homborg
b2b4ab4bab constref more things
Thanks @ridiculousfish!
2018-05-28 12:10:40 +02:00
Fabian Homborg
4dc1c6ca39 [string] Allow url/var escaping to handle NULs
Fixes #4605.
2018-05-28 12:10:40 +02:00
Fabian Homborg
485fdbde41 [string] Allow length to handle NULs
printf 'a\0b' | string length

used to print "1". Now it prints "3".

Note that this switches to using C++'s std::string::length, which
might give differing results.
2018-05-28 12:10:40 +02:00
Fabian Homborg
bcd23ff971 [string] Allow join to handle NULs 2018-05-28 12:10:40 +02:00
Fabian Homborg
aedb8dc327 [string] Allow string escape to handle NULs
TODO: This currently only works for the "script" escaping style.

Work towards #4605.
2018-05-28 12:10:40 +02:00
Fabian Homborg
a229f703ae Allow escape_string_url from escape_string with wcstring
This was an oversight.
2018-05-28 12:10:39 +02:00
Fabian Homborg
338b40bb43 Trust the passed size in escape_string_script
This allows it to handle NULs.
2018-05-28 12:10:39 +02:00
ridiculousfish
ba69f8f71d Remove an unused variable 2018-05-27 15:46:30 -07:00
ridiculousfish
5492a16719 Clean up some env.cpp export code
Adopt some modern practices.
2018-05-27 15:45:30 -07:00
Swayam Raina
eb0539af60 Don't update CMD_DURATION if no command is requested
Fixes issue #4926
2018-05-27 11:37:36 -07:00
Luca Weiss
c1af560753 pacman: Recognize *.pkg.tar as valid package extension (#5005)
* pacman: Recognize *.pkg.tar as valid package extension
2018-05-26 15:41:46 -07:00
Mahmoud Al-Qudsi
b7db397f61 Fix zfs completions under FreeBSD
Under FreeBSD, as annoying as it is, switches must directly follow the
command or subcommand in question, and cannot come after actual payload
argument. Calling `zpool get all -H` instead of `zpool get -H all`
caused error messages to be spewed to the console under FreeBSD when
simply completing `zfs <TAB>`, this should fix that. The change should
also be compatible with other operating systems (namely Linux) that
don't have this requirement, as they (generally) allow arguments to come
before _or_ after the primary non-switch argument (though I do not have
access to a zfs-enabled Linux machine to test this).
2018-05-26 12:20:04 -05:00
Mahmoud Al-Qudsi
46bd0e66b6 fixup! Clean up completions a little bit
Reverts some changes that broke sudo completions, and adds comments
clarifying the purpose behind sudo completions.

Closes #5004.
2018-05-22 17:44:52 -05:00
Mahmoud Al-Qudsi
6401906288 Fix missing -- in string match in __fish_complete_suffix
Caused completion to fail when current token begins with -
2018-05-22 09:59:16 -05:00
ridiculousfish
1b3154e50e Add fish_feature_flags.cpp to Xcode project
Fixes #4998
2018-05-21 21:53:01 -07:00
Mahmoud Al-Qudsi
7d33372d20 Fix __fish_complete_suffix behavior per __fish_complete_directories test 2018-05-20 14:35:52 -05:00
Mahmoud Al-Qudsi
0a337a9d8e Clean up completions a little bit 2018-05-20 14:07:56 -05:00
Mahmoud Al-Qudsi
fd4b3f2c26 Fix __fish_complete_directories test failure
The `sort -u` was applied only conditionally in __fish_complete_suffix,
now applied universally at the final step.
2018-05-20 13:50:28 -05:00