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
We've needed a fishy way to parse flags and arguments given to scripts
and functions for a very long time. In particular a manner that provides
the same behavior implemented by builtin commands. The long term goal is
to support DocOpt. But since it is unclear when that will happen so this
implements a `argparse` command. So named as homage to the excellent
Python module of the same name.
Fixes#4190
This fixes a stupid bug in my previous commit to standardize on a new
`list_to_array_val()` function. This adds a unit test to keep this from
regressing.
This is the first step in implementing a better abstraction for handling
fish script vars in the C++ code. It implements a new function (with two
signatures) to provide a standard method for construct the flag string
representation of a fish script array.
Partial fix for #4200
The count command should not treat any flag specially. Not even `-h` and
`--help`. It should simply return a count of the number of arguments it
received.
Fixes#4189
Completion strings, especially the description, might contain characters,
such as backspace, which make it impossible to calculate the width of
the string.
Fixes#4179
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.
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
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