Commit graph

1184 commits

Author SHA1 Message Date
David Guyot
dcf9ce6fc5 Added completions/translations for zfs and zpool 2017-12-21 16:39:06 +01:00
Fabian Homborg
5acbd32c2e Fix "Unknown argument -s" error in fish_vi_key_bindings
This was caused by it prepending "-s" to argv always,
and later checking $argv[1].

As it turns out, that is kinda superfluous, so we can just add "-s" to
the `bind` calls.

Also adjust the tests so the vi-bindings are enabled via the function,
which would have caught this.

Fixes #4494.
2017-12-21 16:17:21 +01:00
Fabian Homborg
4ca9953114 Skip unusable paths in __fish_print_hostnames
See
https://github.com/fish-shell/fish-shell/issues/4511#issuecomment-343022740.

This would try to `cd` to ~/.ssh even if it didn't exist. That's
clearly bogus.
2017-12-13 13:18:25 +01:00
Aaron Bieber
bfd2885279 add package parsing for OpenBSD 2017-12-12 19:18:53 +01:00
Aaron Bieber
440df37b41 parse *BSD interface names 2017-12-12 19:18:53 +01:00
Aaron Bieber
277cd30520 add ffs to known filesystems 2017-12-12 19:18:47 +01:00
Mahmoud Al-Qudsi
ae700c8707
Merge pull request #4581 from mqudsi/help_section_workaround
Work around OS X issue with dropped #fragment in launched URLs
2017-12-07 18:59:16 -06:00
ArkBriar
5faa425df1 fix #4521 (#4575) 2017-12-04 22:51:20 -08:00
Aaron Gyes
fa57565c42 Fix fish_opt --help showing nextd manpage. 2017-11-14 01:56:58 -08:00
WEBER Logan
11cebe9483 feat(share:git-prompt): be able to truncate the branch name with a defined max length 2017-11-13 10:57:42 +01:00
Judson
37e0fbb5e4 Paginating last command
Often, I want to paginate the command I just ran.

Easy enough to <up><alt-p>, but this patch saves a keystroke.
2017-11-01 07:35:26 +08:00
Fabian Homborg
720f4ad742 Also allow "sles" as OS-ID for command-not-found-handler
"Suse Linux Enterprise Server".

Fixes #4447.
2017-10-19 19:09:29 +02:00
Mahmoud Al-Qudsi
80b658e247 Work around OS X issue with dropped #fragment in launched URLs
The previous hack used to work around an OS X issue/bug where launching
a URL with a #fragment appended would drop the fragment by using
`osascript` does not seem to work any more. Append the section name as a
query string (in addition to, not instead of #section) and then use some
basic javascript appended to the user doc HTML template to parse that
and jump to the correct section (if the section was dropped).

Closes #4480
2017-10-18 12:11:20 -05:00
Fabian Homborg
d18b0be518 Revert "Fix cd completions if a directory exists in $CDPATH and $PWD"
That's not what happens - I had set CDPATH to start with ".".

See #4484.

This reverts commit 1af38d69a8.
2017-10-16 19:33:38 +02:00
Aaron Gyes
fb8ae04f80 Rename $FISH_VERSION back to the original $version.
Order is restored in the universe. Fixes #4414
2017-10-14 08:33:02 -07:00
Fabian Homborg
1af38d69a8 Fix cd completions if a directory exists in $CDPATH and $PWD
E.g. if "foo" is in CDPATH, and both "foo/bar" and "./bar" exist, `cd
bar` will go to ./bar.

The completions described "bar" as going to "foo/bar" ("CDPATH foo").

This fixes it by checking for ./bar's existence.

See #4475.
2017-10-13 18:32:36 +02:00
madblobfish
649e244092 fish_update_completions: error when python not found (#4454) 2017-10-12 06:00:50 -07:00
Mahmoud Al-Qudsi
46d1334f95 Silence bind errors in default key bindings
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.

Closes #4188, #4431, and obviates the original fix for #1155

It was necessary to re-implement builtin_bind as a class in order to
avoid passing around the options array from function to function and
as adding an opts parameter to `get_terminfo_sequence` would require
otps to be passed to all other builtin_bind_ functions so they could, in
turn, pass it to `get_terminfo_sequence`.
2017-10-03 11:20:17 +02:00
Aaron Gyes
1ef310c3a8 Fix export returning 1 on success
Fixes #4435
2017-10-01 01:11:17 -07:00
Fabian Homborg
281d468285 Rewrite systemctl completion with argparse
This

- Offers more candidates

- Is more reactive (it'll always incorporate "--state=" and "--type="

- Is faster (about 800ms to about 120ms)

- Needs fewer function files

All __fish_systemctl_* functions except __fish_systemctl_services have
been removed.
2017-09-29 20:07:18 +02:00
Mahmoud Al-Qudsi
338311af1e Install custom LSS script to /usr/local/share/fish on make install
Decided to move doc_src/fish.lss to share/lynx.lss, which just makes
more sense all around. Accordingly, now using {$__fish_datadir} instead
of {$__fish_help_dir} in help.fish.

Makefile now installs the custom lss on make install
2017-09-26 14:31:11 -05:00
Mahmoud Al-Qudsi
8b858f2fcc Use a custom Lynx style sheet (LSS file) to work around Lynx bug
Lynx uses a very naïve method of applying styles to HTML elements by
hashing the element type and the class name to generate a map of
hash:style. After the hash is calculated, Lynx does not go back and
check whether or not the actual string values match the LSS properties.

See the following links on the Links mailing list:
 * http://lists.gnu.org/archive/html/lynx-dev/2015-12/msg00037.html
 * http://lists.gnu.org/archive/html/lynx-dev/2015-12/msg00039.html

This patch copies the default Lynx stylesheet but removes highlighting
and other styles that would result in unreadable text (due to not enough
contrast with the background color), and if the `help` builtin detects
that the best web browser to use is Lynx, it instructs it to use this
modified stylesheet.
2017-09-26 13:44:19 -05:00
Mahmoud Al-Qudsi
2b425ad221 Don't use xdg-open if running in terminal mode (i.e. no Xorg)
If the $DISPLAY environment variable is not set, xdg-open should not be
used to load the web browser. Just because it is installed does not mean
that the user exclusively runs in an X session.

Needed for Lynx detection to work around #4170
2017-09-26 13:42:40 -05:00
Mahmoud Al-Qudsi
3b3bcc998e Speed up __fish_print_hostnames for faster completions
Thanks to @ThomasAH, as per #4378. Tested on many platforms (OS X,
FreeBSD, Linux, and Solaris). Works with IPv4 and IPv6 as well as
host names and loopback addresses.
2017-09-26 09:21:16 -05:00
Mahmoud Al-Qudsi
6513db35c1 Support colored ls output on Solaris 11
Closes #1223
2017-09-26 08:55:28 -05:00
oddwheel
a05bcc6a63 Suppress git prompt CRLF warnings noise
Drawing prompt in repo with text=auto attribute and mixed line endings in files was spawning crlf conversion warnings to terminal from unsilenced stderr of git diff
2017-09-22 18:57:36 +02:00
Aaron Gyes
25d83ed0d7 seq fallback speedup
Using `string match` instead of `grep -E` resulted in a 2x-3x speedup according
to $CMD_DURATION.
2017-09-22 00:30:26 -07:00
Kurtis Rader
67946b5509 Drop deprecated history search --with-time flag (#4403)
This flag was only documented for a few weeks before being renamed
`--show-time` and has been deprecated for a long time. Fish 3.0 is a good
opportunity to remove it.
2017-09-15 19:28:44 -07:00
Kurtis Rader
ee1d310651 Implement history search --reverse (#4375)
* Implement `history search --reverse`

It should be possible to have `history search` output ordered oldest to
newest like nearly every other shell including bash, ksh, zsh, and csh.
We can't make this the default because too many people expect the
current behavior. This simply makes it possible for people to define
their own abbreviations or functions that provide behavior they are
likely used to if they are transitioning to fish from another shell.

This also fixes a bug in the `history` function with respect to how it
handles the `-n` / `--max` flag.

Fixes #4354

* Fix comment for format_history_record()
2017-09-14 15:44:17 -07:00
David Adam
725febb669 Revert "convert popd and pushd to use argparse"
This reverts commit 05aae4764b.

Closes #4398.
2017-09-14 12:36:37 +08:00
ridiculousfish
a5fd0b317e Revert "Switch to bare vars in our math invocations"
This reverts commit bd18736ee5.

Bare variables should only be used in commands that must
manipulate the variable stack, such as `set`.
2017-09-09 23:35:47 -07:00
Fabian Homborg
b00daebec2 __fish_print_hostnames: Use string replace -f
Saves one `string match` invocation.

Also removes a useless-use-of-cat.

(cherry picked from commit 4437e8d8d6)
2017-09-07 16:30:17 +02:00
daniel-surename
ed475ab24b fix: git status in __fish_git_prompt_informative_status (#4365)
Added and staged files weren't shown in the prompt,
had a missing $ to denote variables
2017-08-29 23:50:27 -07:00
Kurtis Rader
bd18736ee5 Switch to bare vars in our math invocations
Using bare vars is more efficient because it makes the builtin `math`
expression cache more useful. That's because if you prefix each var with
a dollar-sign then the fish parser expands it before `math` is run.
Something like `math x + 1` can be cached since the expression is the
same each time it is run. But if you do `math $x + 1` and x==1 then you're
effectively executing `math 1 + 1`. And if x==2 the next time then you're
running `math 2 + 1`. Which makes the expression cache much less effective.
2017-08-24 12:38:10 -07:00
Kurtis Rader
d10decabda Make builtin math the default implementation
Remove our `math` function that wraps `bc`. Our math builtin is now good
enough that it can be the default implementation.

Another step in resolving #3157.
2017-08-23 17:32:49 -07:00
Kurtis Rader
6e02ec83d1 Fix typo in xdg-mime completion functions 2017-08-17 10:54:05 -07:00
MoritzKn
5eb0b34da1 Update xdg-mime helper
This will respect the `/usr/local/share/applications/` directory when
fetching mime infos.

Update xdg-mime helper to comply with the xdg spec.

This also makes sure __fish_print_xdg_applications_directories only prints
directories that exist.

Relevant specs:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
https://specifications.freedesktop.org/desktop-entry-spec/latest/ape.html
2017-08-17 10:50:06 -07:00
sentriz
72173a93a7 Accept return as a valid answer to 'Edit the file again?'
Also, check for affirmative answer so a random string isn't taken as a
"yes" response.
2017-08-14 18:18:41 -07:00
Fabian Homborg
4e2b11f2e0 help: Fix error if no argument is given 2017-08-14 18:18:10 -07:00
Sam Yu
d87c0424d8 Speedup git prompt
Fix __fish_git_prompt too slow under repo with lots of untracked
files when __fish_git_prompt_showuntrackedfiles enabled.
2017-08-06 13:24:33 -07:00
Kurtis Rader
8b79f4e5c9 use the new set -a and set -p in our scripts 2017-08-04 18:02:24 -07:00
Kurtis Rader
d4fb75e9f3 fix bug in abbr function
I introduced a bug in the `abbr` function with commit 17dff8c by
referencing the undefined `$cmd` variable. This fixes that.
2017-08-03 23:52:07 -07:00
Kurtis Rader
17dff8c569 rewrite abbr function
Rewrite the `abbr` function to store each abbreviation in a separate
variable. This greatly improves the efficiency. For the common case
it is 5x faster. For pathological cases it is upwards of 100x faster.
Most people should be able to unconditionally define abbreviations in
their config.fish without a noticable slow down.

Fixes #4048
2017-08-03 14:35:06 -07:00
Kurtis Rader
1a55e9ba60 Merge branch 'master' into major 2017-07-29 21:58:15 -07:00
Kurtis Rader
4e026588f4 modify prev commit to use builtin cd
Using the `cd` function can have undesirable side effects like mucking
with the directory history. So force the use of the builtin cd.
2017-07-27 14:36:32 -07:00
Kurtis Rader
defdc92b57 fix ssh config Include file handling
Fixes #4253
2017-07-27 14:36:32 -07:00
Kurtis Rader
92f39f7b89 fix bug introduced by commit 86af63cd3 2017-07-25 14:03:40 -07:00
Kurtis Rader
35a7db50a2 fix bug introduced by commit 86af63cd3 2017-07-25 14:02:50 -07:00
Kurtis Rader
8e87d595b7 remove some uses of $IFS
This is a step towards resolving issue #4156. It replaces uses of `$IFS`
with other solutions.
2017-07-24 20:45:43 -07:00
Kurtis Rader
d068f846e8 simplify history function
The fix for #4232 allows us to simplify the `history` function slightly.
2017-07-21 16:26:15 -07:00
Kurtis Rader
d376cb316f simplify history function
The fix for #4232 allows us to simplify the `history` function slightly.
2017-07-21 16:25:03 -07:00
Fabian Homborg
e0f0164b16 Quote $USER when used with switch or test
Common in prompts, this would fail if $USER is empty.

See #4229.
2017-07-20 19:45:32 +02:00
Kurtis Rader
0dc92fbb2d a make style-all cleanup 2017-07-18 22:40:25 -07:00
Kurtis Rader
69ecda5082 update math to use the new argparse validation 2017-07-18 15:03:08 -07:00
Kurtis Rader
4e1303823b add ability for argparse to validate args
Fixes #4211
2017-07-18 14:42:50 -07:00
Kurtis Rader
403d9691cb fix handling of ssh aliases
Fixes #4213
2017-07-17 21:13:21 -07:00
Kurtis Rader
8f22def8f7 return to psub --file being the default
The recent change to switch `psub` to use `argparse` caused it to use
a fifo by default because it inadvertently fixed a long standing bug in
the fish script. This changes the behavior back to `psub --file` being
the default behavior and introduces a `--fifo` flag. It also updates the
documentation to make it clearer when and why `--fifo` mode should not
be used.

Fixes #4222
2017-07-17 14:33:51 -07:00
Kurtis Rader
3e226f0a5e implement a new implicit int option spec
While updating the `history` function to use `argparse` I realized it is
useful to define an option that can be used in three ways. First by
using the short flag; e.g., `-n NNN`. Second by using the long flag;
e.g., `--max NNN`. Third, as an implicit int flag; e.g., `-NNN`. This
use case is now supported by a spec of the form `n#max`.
2017-07-16 18:27:41 -07:00
Kurtis Rader
c22df3b823 update history to use argparse 2017-07-16 15:13:39 -07:00
Kurtis Rader
f2c8e73891 add more alias unit tests
A recent regression to the `alias` command points out the need for more
unit tests of its behavior. I also decided to use it as an opportunity
to normalize the output of just `alias` to list aliases.
2017-07-15 17:36:36 -07:00
Kurtis Rader
98449fec51 fix math regression
The previous change to use `argparse` for parity with every other
builtin and function introduced a regression. Invocations that start
with a negative number can fail because the negative value looks like an
invalid flag.
2017-07-14 16:03:31 -07:00
Kurtis Rader
ff4d275f22 remove left over debug statement 2017-07-14 08:18:41 -07:00
Kurtis Rader
49a0841533 update type to use argparse 2017-07-13 15:19:02 -07:00
Kurtis Rader
51bbecc419 update realpath to use argparse 2017-07-13 14:33:11 -07:00
Kurtis Rader
3e6c57d5d3 update psub to use argparse 2017-07-13 14:12:51 -07:00
Kurtis Rader
30940916bd update prompt_pwd to use argparse 2017-07-13 14:12:51 -07:00
Kurtis Rader
51a52a7286 update open to use argparse 2017-07-13 14:12:51 -07:00
Kurtis Rader
e8243af20b update math to use argparse 2017-07-13 14:12:47 -07:00
Kurtis Rader
140e6204be update help to use argparse 2017-07-13 13:49:15 -07:00
Kurtis Rader
86af63cd39 update funcsave to use argparse 2017-07-13 13:35:26 -07:00
Kurtis Rader
6ecd0bcb32 update funced to use argparse 2017-07-13 13:29:35 -07:00
Kurtis Rader
df65ed8696 update dirs to use argparse 2017-07-13 11:53:29 -07:00
Kurtis Rader
30baf8d101 convert dirh to use argparse 2017-07-13 11:50:57 -07:00
Kurtis Rader
f156bea1b7 convert alias to use argparse 2017-07-13 11:47:41 -07:00
Kurtis Rader
05aae4764b convert popd and pushd to use argparse 2017-07-13 11:31:08 -07:00
Kurtis Rader
5ac8c42fad convert nextd to use argparse
Also fix a bug I introduce in `prevd` when I converted it to use `argparse`.
2017-07-13 11:30:48 -07:00
Kurtis Rader
3a782003ed have argparse report the proper command name 2017-07-12 22:38:32 -07:00
Kurtis Rader
abef2cc422 convert nextd to use argparse 2017-07-12 22:38:32 -07:00
Kurtis Rader
5cf2a50269 convert isatty to use argparse 2017-07-12 22:38:32 -07:00
Kurtis Rader
3c4e3035fd switch from getopt to argparse
Convert our two functions that use `getopt` to use our new `argparse`
builtin.

Fixes #4190
2017-07-12 22:38:32 -07:00
Kurtis Rader
a4dc2b872b implement fish_opt helper command
This implements a `fish_opt` command that provides a way for people
to create option specs for the `argparse` command as an alternative to
creating such strings by hand.

Fixes #4190
2017-07-12 22:38:32 -07:00
David Marchal
e1951a32bb Fixed __fish_complete_users to better format GECOS 2017-07-11 17:00:08 +02:00
Kurtis Rader
8cc4639ea6 implement cdh command
Fixes #2847
2017-07-05 13:25:18 -07:00
tamanugi
170f11771b Add function __fish_complete_user_at_hosts
This function list hostnames;
if commandline hoge@~ , it list hoge@(hostname)
2017-07-05 16:24:45 +02:00
Kurtis Rader
4853ec0281 harden psub again an undef TMPDIR 2017-07-04 16:35:32 -07:00
Kurtis Rader
8caab103d8 harden man against undef vars 2017-07-04 13:56:35 -07:00
Kurtis Rader
2df89f4b0f check if $fish_color_cancel is set before using it 2017-07-04 13:56:35 -07:00
Fabian Homborg
9fb7037174 fish_key_reader: Add --version option
This should be there anyway, and we try to find fish_key_reader for
.app bundles, so this stops us from defining aliases to the command.

See #4179.
2017-07-04 22:55:47 +02:00
Kurtis Rader
f6d101e7ad fix undef var reference in history
The change for issue #4163 brought to light the pointless attempt to use
`$_` in the `history` function.
2017-07-03 16:26:27 -07:00
Kurtis Rader
0ec9acf0f0 harden abbr against undef vars
This is only needed if we make undefined vars an error as proposed in
issue #4163 but it's a good idea anyway.
2017-07-03 13:05:50 -07:00
Kurtis Rader
763063e741 more changes to better handle undef vars
This is only needed if we make undefined vars an error as proposed in
issue #4163 but it's a good idea anyway.
2017-07-03 10:16:31 -07:00
Kurtis Rader
ea38519a12 fix var name in __fish_git_prompt
Var `___git_ps_color_suffix_done` is supposed to be
`___fish_git_prompt_color_suffix_done`. This bug was found by an
experimental change to detect the use of undefined variables (#4163).

Similarly, we should simply test whether `__fish_git_prompt_showcolorhints`
is set rather than set to a non-empty string.
2017-07-02 20:49:40 -07:00
Kurtis Rader
85b42b22f4 define __fish_active_key_bindings before using it 2017-07-02 13:41:40 -07:00
Kurtis Rader
3284393aba cleanup some undefined var references
Testing a fix for #4163 revealed some questionable dereferencing of
variables that are not certain to be defined.
2017-07-02 13:41:40 -07:00
Fabian Homborg
db529f06b8 type: Use command -a 2017-06-28 23:13:36 +02:00
Kurtis Rader
bb29f9f990 replace __fish_urlencode with string escape
We now have a builtin that can do URL escaping so use it. I can't find
any uses of our private `__fish_urlencode` function in any Oh-My-Fish or
Fisherman code so remove it.
2017-06-23 22:46:36 -07:00
Kurtis Rader
30368d5526 implement status function when in a breakpoint
Another step to fixing #1310. This changes means that `status -L0
function` reports the correct function when inside a breakpoint.
2017-06-23 22:14:21 -07:00
Kurtis Rader
df01547eab implement the fish_breakpoint_prompt function
This is another step to resolving issue #1310. It makes
`fish_breakpoint_prompt` a replacement for `fish_prompt` if it is defined
and we're presenting a prompt in the context of a `breakpoint` command.
2017-06-20 17:18:59 -07:00
Kurtis Rader
af22bf3501 style cleanups (make style-all) 2017-06-16 21:01:57 -07:00
Fabian Homborg
cec2999983 Allow help to open the tutorial
This is unambiguous because all the anchors in tutorial.html begin
with "tut".
2017-06-14 13:52:24 +02:00