Commit Graph

760 Commits

Author SHA1 Message Date
David Adam
7b7bb5803f docs: update language in read documentation 2017-08-14 17:59:50 -07:00
Kurtis Rader
263cdc50db document special value zero for FISH_READ_BYTE_LIMIT 2017-08-14 17:58:13 -07:00
Fabian Homborg
4dbb274d8a Clarify docs on $status with and/or/begin/end
See #4311.
2017-08-11 15:06:03 +02:00
David Adam
9b6256d0fc docs: improve set -Ux language and example
By far the most common problem with universal variables being overridden
by global variables is other values being imported from the environment;
the `set -q; or set -gx` is much more of an edge case.
2017-08-10 13:20:25 +08:00
Elliott Beach
9fa0edcbc9 document bind behavior when mixing command types
Fixes 3683
2017-08-06 20:49:30 -07:00
Kurtis Rader
38024a50dc backport set --show from fish 3.0
I decided this was just too useful not to include in our final fish 2.x
release. And since it does not modify any existing behavior it is safe
to include at this late date in the process of creating 2.7.
2017-08-03 18:56:25 -07:00
Kurtis Rader
8e2d165756 document need for double-quotes around test args 2017-07-25 17:04:41 -07:00
Rabah Meradi
f8fa69f817 Document how to erase a path from $PATH variable
Fixes #3161
2017-07-22 21:29:41 -07:00
Kurtis Rader
9ef47a43a4 change how argparse handles boolean flags
When reporting whether a boolean flag was seen report the actual flags
rather than a summary count. For example, if you have option spec `h/help`
and we parse `-h --help -h` don't do the equivalent of `set _flag_h 3`
do `set _flag_h -h --help -h`.

Partial fix for #4226
2017-07-20 17:54:06 -07:00
Kurtis Rader
2d5b698f0b add entry about set -Ux to the FAQ
This was inspired by this stackoverflow question:
https://stackoverflow.com/questions/45119425/how-can-i-set-environment-variables-in-fish/
2017-07-19 13:21:56 -07:00
Kurtis Rader
4e1303823b add ability for argparse to validate args
Fixes #4211
2017-07-18 14:42:50 -07:00
Fabian Homborg
2dfb615d7b Fix typo
Fixes #4225.
2017-07-18 23:37:14 +02: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
06d071dd94 clarify argparse documentation 2017-07-16 15:33:04 -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
63d601610d implement -nnn style flags in argparse
This implements support for numeric flags without an associated short or
long flag name. This pattern is used by many commands. For example `head
-3 /a/file` to emit the first three lines of the file.

Fixes #4214
2017-07-13 20:36:59 -07:00
Kurtis Rader
49a0841533 update type to use argparse 2017-07-13 15:19:02 -07:00
Kurtis Rader
0d08bfd6ff document new argparse command
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
Kurtis Rader
b88cacf03e fix some documentation errors 2017-07-11 22:50:55 -07:00
David Adam
798f1a7050 docs: tighten language in FAQ 2017-07-09 14:11:15 +08:00
David Adam
285af8c4b4 docs: add FAQ for error caused by empty braces in find
See #95, #1109, #1468, #2206, #2840, #4202, etc.
2017-07-09 14:10:10 +08:00
Kurtis Rader
8cc4639ea6 implement cdh command
Fixes #2847
2017-07-05 13:25:18 -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
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
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
Nick Tzaperas
eaa0fdaeba fish_bind_mode variable documentation 2017-06-29 22:11:31 -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
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
c31b9f430f implement command -a
Fixes #2778
2017-06-23 15:43:37 -07: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
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
Kurtis Rader
ed6c8a95d7 improve debugger documentation
Fixes #4125
2017-06-15 16:53:56 -07:00
Kurtis Rader
955ae76cb3 minor fix to string man page 2017-06-11 11:59:36 -07:00
Fabian Homborg
65b80da60b tutorial: Mention combiners in conditionals section
See #4116.
2017-06-11 13:58:43 +02:00
Fabian Homborg
7bdcbc1775 tutorial: Add section on the semicolon
See #4116.
2017-06-11 13:58:39 +02:00
Kurtis Rader
f6c9bfc0e8 implement string lower and string upper
Fixes #4080
2017-06-10 17:35:25 -07:00
Kurtis Rader
a520d97752 there is no "undo" key binding 2017-06-07 17:04:17 -07:00
Fabian Homborg
822ee634c4 docs: Mention command-substitution splitting in tutorial
See #4097.
2017-06-06 22:06:09 +02:00
Kurtis Rader
c263c59346 document that set -n output is sorted 2017-05-31 13:22:49 -07:00
Kurtis Rader
6f6d3ce520 note in the tutorial the vars that are auto split
Users continue to be surprised that fish auto splits/joins three env
vars but not other similar vars. Mention this in the tutorial to make it
less likely new users are surprised by this behavior.

Fixes #4009
2017-05-26 17:00:57 +02:00
Fabian Homborg
0ee24b9bce docs: Change misleading $status comment for set
It still performs the assignment even if the command substitution
returned unsuccessfully - `set foo (echo bar; false)` returns 1 but
sets $foo to bar.

Also use `type -p` instead of `which`.
2017-05-19 19:06:44 +02:00
Fabian Homborg
64d33fac5d docs: Improve faq-exit-status
Add examples, a mention of `if command` and link to test/if.

See #2773.
2017-05-19 19:05:47 +02:00