Commit Graph

7201 Commits

Author SHA1 Message Date
Kurtis Rader
8f548962b7 fix regression how fish_escape_delay_ms is handled
Fish 2.6.0 introduced a regression that keeps setting
`fish_escape_delay_ms` as a uvar from working. This also fixes a related
problem: callbacks generated from the initial loading of universal vars
were not being acted on.

Fixes #4196
2017-07-19 19:09:55 -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
9e08609f85 fix argparse --help
Also stop special-casing `printf` as if it were a syntactical keyword
with respect to handling `printf --help`. It should use the same pattern
as every other builtin command.
2017-07-19 12:19:40 -07:00
Kurtis Rader
f78ab085b5 Revert "argparse: let builtin_run() handle help."
This reverts commit bbc6bda843.
2017-07-19 11:13:59 -07:00
Aaron Gyes
bbc6bda843 argparse: let builtin_run() handle help.
Fixes #4228 and simplifies code a little. Most builtins shouldn't
need to do any work for -h/--help.
2017-07-19 07:23:40 -07:00
Kurtis Rader
0dc92fbb2d a make style-all cleanup 2017-07-18 22:40:25 -07:00
Kurtis Rader
5e2c14e7be fix a regression involving parser error output
The code for reporting parser errors needs a major overhaul. But rather
than do that I'm going to add another hack in the hope that this doesn't
introduce yet another problem.

Fixes #4221
2017-07-18 20:50:54 -07:00
Kurtis Rader
ed38db3370 refactor builtin_argparse to remove lint 2017-07-18 20:22:09 -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
Fabian Homborg
2dfb615d7b Fix typo
Fixes #4225.
2017-07-18 23:37:14 +02:00
Kurtis Rader
403d9691cb fix handling of ssh aliases
Fixes #4213
2017-07-17 21:13:21 -07:00
Kurtis Rader
71af1a9566 don't die if read is invoked with no var names
Partial fix for #4220 by restoring the old behavior if no var name was
provided. But we still set an empty var if a var name was provided.
2017-07-17 14:54:43 -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
06d071dd94 clarify argparse documentation 2017-07-16 15:33:04 -07:00
Kurtis Rader
c22df3b823 update history to use argparse 2017-07-16 15:13:39 -07:00
Kurtis Rader
5dc78dd858 fix regression involving read from scripts
Fixes #4206
2017-07-15 21:21:24 -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
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
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
c149f4f301 add argparse unit tests and fix some bugs
This implements some unit tests for the new `argparse` command and fixes
a couple of bugs those tests brought to light.

Fixes #4190
2017-07-12 22:38:32 -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
0d08bfd6ff document new argparse command
Fixes #4190
2017-07-12 22:38:32 -07:00
Kurtis Rader
28454cb57d SIZE_T_MAX => SIZE_MAX
macOS happens to have a non-standard SIZE_T_MAX which is why I didn't
notice it should be SIZE_MAX for portability.
2017-07-12 22:38:32 -07:00
Kurtis Rader
8754f776d8 fix oclint NPATH_COMPLEXITY custom threshold 2017-07-12 22:38:32 -07:00
Kurtis Rader
b3d3e07c55 changes based on feedback 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
9adf500cf3 implement argparse --max-args N --min-args N
Fixes #4190
2017-07-12 22:38:32 -07:00
Kurtis Rader
e260c42a13 implement argparse --exclusive
Fixes #4190
2017-07-12 22:38:31 -07:00
Kurtis Rader
277999adef implement argparse builtin
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
2017-07-12 22:38:24 -07:00
Kurtis Rader
b88cacf03e fix some documentation errors 2017-07-11 22:50:55 -07:00