Commit Graph

7260 Commits

Author SHA1 Message Date
Kurtis Rader
ec1e9ac98d standardize on builtin_missing_argument() 2017-07-01 14:03:47 -07:00
Kurtis Rader
68f4e005e4 fix handling of empty read history session ID 2017-07-01 13:23:24 -07:00
Kurtis Rader
c6093ad782 make read honor FISH_HISTORY
The `read` command `-m` and `--mode-name` vars are now deprecated and do
nothing other than result in a warning message. The `read` command now
honors the `FISH_HISTORY` var that is used to control where commands are
read from and written to. You can set that var to the empty string to
suppress the use of both history files. Or you can set it to a history
session ID in which case that will limit the `read` history that is
available.

Fixes #1504
2017-06-30 21:03:05 -07:00
Kurtis Rader
ec14527545 don't import bash history if not default fish hist
Don't import the bash history if the user has specified that a non-default
fish history file should be used. Also, rename the var that specifies
the fish history session ID from `FISH_HISTFILE` to `FISH_HISTORY`.

Fixes #4172
2017-06-30 20:24:55 -07:00
Kurtis Rader
2cc0107dbf document new FISH_HISTORY var in changelog 2017-06-30 17:24:24 -07:00
tomassedovic
aec0973196 Make the history session configurable
Using the FISH_HISTFILE variable will let people customise the session
to use for the history file. The resulting history file is:

    `$XDG_DATA_HOME/fish/name_history`

Where `name` is the name of the session. The default value is `fish`
which results in the current history file.

If it's set to an empty string, the history will not be stored to a
file.

Fixes #102
2017-06-30 17:13:02 -07:00
Sam Yu
6f6a4a842c Fix typo in zypper.fish 2017-06-30 14:46:43 +02:00
Nick Tzaperas
eaa0fdaeba fish_bind_mode variable documentation 2017-06-29 22:11:31 -07:00
Kurtis Rader
dd191a9d4b more wgetopt_long() normalization 2017-06-29 21:49:57 -07:00
Charles Ferguson
bf2a9f3835 Fix for bad-switch test failing on Darwin; system-specific output.
Because the 'getopt' library differs between systems, it's likely
that there will be different output. This is the case between the
GNU-based Linux and the BSD-based Darwin, for the 'getopt' library,
it seems. It causes the tests to produce different results.

To allow us to test, and check for regressions, on the different
platforms, the invocation code has been updated to allow a
system-specific suffix to be used on the test files. If this suffix
is found, the test will also be flagged as being system-specific
which should ensure the change in behaviour is noted.
2017-06-29 21:00:08 -07:00
Charles Ferguson
8d83c967d3 Support reporting diffs even when colordiff is not present.
The Travis macOS test systems do not appear to have colordiff present, so any
failures would mean that no output would be shown. This may also be a
problem for the other test scripts as well, but the invocation tests are
the ones being affected here.

We change our behaviour to downgrade to the plain diff tool if colordiff is
not present.
2017-06-29 21:00:08 -07:00
Charles Ferguson
b48cfbefba Updated CHANGELOG.md to reflect new -C/--init-command. 2017-06-29 21:00:08 -07:00
Charles Ferguson
cc24485503 Add documentation into the 'tests/invocation.sh' script.
The invocation tests were not especially clear on how they should be
used, without reading the code. And who really wants to do that? So,
a description of what the test does (and thus what each file is) is
now present in the file prologue comment.
2017-06-29 21:00:08 -07:00
Charles Ferguson
eb8b92fce7 Add tests for some other command line option invocations.
Some more of the invocations are tested in this change:

  - bad switches
  - errors in configuration files
  - regular command, configuration and init command ordering
  - persistence of variables over command invocation.
  - interactive and login switch use
  - terminal exit code return
  - version request

There are sure to be other invocations that should be tested, but
these give a fair number of them a go.
2017-06-29 21:00:08 -07:00
Charles Ferguson
3f129b570c Add test harness for fish command invocation, and tests for init command.
The new '-C' initial command needs some tests, and as there are no
tests just yet for the command invocation, this change adds a harness
and calls it from the high-level tests in the Makefile.

The tests are similar in style to the other high level tests, in that
we capture the output and compare it to that which we expect. The
harness itself is written in bash - sorry - because we're testing the
fish shell's invocation, and trying to do that with the fish we've
just built wouldn't actually make for a very useful test when things
go wrong.

The 'tests/invocation.sh' script can be executed manually, or as part
of the 'make test' target, to make it easy to use both as part of the
development and as part of automation.

The harness has only been tested on linux with bash 4.3.11, and requires
grep and sed. Although not tested with OS X, I believe I have avoided
the syntax which is inconsistent.

The tests added here cover just the initial command's basic execution,
and when it is mixed with the regular '-c' command.
2017-06-29 21:00:08 -07:00
Charles Ferguson
053d940d0a Add '--init-command', '-C' to the command line switches.
In order to allow the execution of commands before dropping to an
interactive prompt, a new switch, '-C' or '--init-command' has been
added to those switches that we accept.

The documentation has been updated correspondingly.

The original code only supported a single command list to be executed,
and this command list terminates the shell when it completes. To allow
the new command list to preceed the original one, both have been
wrapped in a new container class 'command_line_switches_t'. This is
then passed around in place of the list of strings we used previously.

I had considered moving the interactive, login and other command line
switch states into this container, but doing so would change far more
of the code, moving the structure to be available globally, and I
wasn't confident of the impact. However, this might be a useful thing
to do in the future.

A new function, run_command_list, was lifted from the prior execution
code, and re-used for both the initial command and the regular command
execution.
2017-06-29 20:59:58 -07:00
Fabian Homborg
3b5fdc3fb0 git completions: Fix aliases with weird characters
A use for the new `string escape --style=var`.

Fixes #4147.
2017-06-28 23:21:33 +02:00
Fabian Homborg
db529f06b8 type: Use command -a 2017-06-28 23:13:36 +02:00
ridiculousfish
502deda376 Use DWARF instead of dSYM files in Debug Xcode builds
This allows symbols to embed in the executable, so they don't get
lost if the executable is copied.
2017-06-28 10:21:32 -07:00
ridiculousfish
08dd04c527 Update Xcode project to reflect new builtin sources 2017-06-28 10:20:51 -07:00
Kurtis Rader
4ef14ea6e2 another make style-all cleanup 2017-06-23 23:19:09 -07: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
f3cb625802 implement string unescape
Fixes #3543
2017-06-23 22:23:01 -07:00
Kurtis Rader
60bca14b37 implement string escape --style=xxx
We need a way to encode arbitrary strings into valid fish variable
names. It would also be nice if we could convert strings to valid URLs
without using the slow and hard to understand `__fish_urlencode` function.
In particular, eliminating the need to manipulate the locale.

Fixes #4150
2017-06-23 22:23:01 -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
1bee66548a don't mangle empty elements in MANPATH
Fixes #4158
2017-06-23 17:31:28 -07:00
Kurtis Rader
c31b9f430f implement command -a
Fixes #2778
2017-06-23 15:43:37 -07:00
Hector Sanjuan
2d42baac35 Fix last status report (it's always 0)
It seems something is overwriting the status before it is
saved to a variable. Fixed by setting the last_status variable
at the very beginning.
2017-06-22 14:01:19 +02:00
Kurtis Rader
e26f7aacc4 provide shorter status subcommands
As part of addressing #1310 I decided it makes more sense to replace
`current-function` with just `function`, etc., because I'm going to add
flags to let the user specify which stack level they are interested in.
With the default being zero or the "current" level.
2017-06-20 21:10:15 -07:00
Kurtis Rader
0ffc2899dc document previous two changes 2017-06-20 17:59:50 -07:00
Fabian Homborg
897dba9f07 Ignore too large indices in parse_slice
Fixes #4127.
2017-06-20 17:52:31 -07:00
Fabian Homborg
44f2f37bd4 Remove "Array index out of bounds" errors
This just removes every invalid index.

That means with `set foo a b c` and the "show" function from tests/expand.in:

- `show $foo[-5..-1]` prints "3 a b c"
- `show $foo[-10..1]` prints "1 a"
- `show $foo[2..5]` prints "2 b c"
- `show $foo[1 3 7 2]` prints "3 a c b"

and similar for command substitutions.

Fixes #826.
2017-06-20 17:52:23 -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
bd299e96b2 implement status is-breakpoint
This implements `status is-breakpoint` that returns true if the current
shell prompt is displayed in the context of a `breakpoint` command.

This also fixes several bugs. Most notably making `breakpoint` a no-op if
the shell isn't interactive. Also, typing `breakpoint` at an interactive
prompt should be an error rather than creating a new nested debugging
context.

Partial fix for #1310
2017-06-20 17:18:59 -07:00
Rabah Meradi
d234a1870b Aucompletion for jest CLI 2017-06-19 23:27:22 -07:00
Fabian Homborg
1a135aa0b0 git completions: Make checking aliases faster
See #4117.
2017-06-19 11:04:40 +02:00
Kurtis Rader
0ed2af464c document new as completion 2017-06-18 23:33:30 -07:00
Clément Martinez
d5e1405cbe Add as completions 2017-06-18 23:10:23 -07:00
Kurtis Rader
2302db4dc7 add unit test for echo -h 2017-06-18 22:25:00 -07:00
Kurtis Rader
82f5fb507d fix echo -h
In addition to fixing `echo -h` this includes some debugging related
cleanups I made while investigating the issue.

Fixes #4120
2017-06-18 22:10:19 -07:00
Kurtis Rader
59a11188df fixes for previous commit
Turns out the Travis environments are less forgiving than my system. Add
missing include. Change subsystem init order in fkr.
2017-06-18 16:42:26 -07:00
Kurtis Rader
93dad29ec6 set COLUMNS and LINES earlier
Fixes #4141
2017-06-18 15:38:52 -07:00
Kurtis Rader
385e40540c fix issues with builtin_function()
This does several things. It fixes `builtin_function()` so that errors it
emits are displayed. As part of doing that I've removed the unnecessary
`out_err` parameter to make the interface like every other builtin.

This also fixes a regression introduced by #4000 which was attempting to
fix a bug introduced by #3649.

Fixes #4139
2017-06-18 12:55:14 -07:00
Alan Somers
0e954e4764 Fix the build on FreeBSD with Clang
NULL expands to nullptr which cannot be cast to an int.  Replace it with
0 in wcsfilecmp.

Fixes issue #4136
2017-06-17 22:51:25 -07:00
Alan Somers
652faa1a13 Rename __assert to __fish_assert
FreeBSD and possibly other platforms define __assert in their C
libraries.

Fixes #4133
2017-06-17 22:41:24 -07:00
Kurtis Rader
e44934cf87 remove leftover debug printf 2017-06-17 18:39:16 -07:00
Kurtis Rader
1e9c9e01e5 refactor wgetopt.cpp to reduce complexity 2017-06-17 17:09:01 -07:00
Kurtis Rader
a312abdeb8 fix wgetopt_long() handling of short opts
Fixes #4131
2017-06-17 16:00:33 -07:00
Kurtis Rader
af22bf3501 style cleanups (make style-all) 2017-06-16 21:01:57 -07:00
Kurtis Rader
d22743dad0 change help only cmd opts interface 2017-06-16 21:01:57 -07:00