Commit Graph

8924 Commits

Author SHA1 Message Date
ridiculousfish
6ad4d94e12 Introduce path_normalize
This new function performs normalization of paths including dropping
/./ segments, and resolving /../ segments, in preparation for switching
fish to a "virtual" PWD.
2018-10-06 17:03:18 -07:00
jacob
02b093d70a Change only to exactly 2018-10-06 16:35:03 -07:00
jacob
739ad77f38 Fix typos and address formatting
There are a few opportunities to improve the formatting as well as a
handful of typos in this document. I was looking into contributing and
noticed that it might be worthwhile to address them.
2018-10-06 16:35:03 -07:00
ridiculousfish
767b7a2180 Migrate the completion set to owning_lock_t 2018-10-05 09:05:59 -07:00
jacob
35c01bcba2 Fix a capitalization error and add a link
I just submitted a PR to fix a few issues in CONTRIBUTING.MD, so I took
a few minutes too look over README.md as well. This is the only room
for improvement I noticed.
2018-10-03 22:12:10 +08:00
Fabian Homborg
0aedd47af2 [completions/env] Argparsify
This fixes subcommand completions by using argparse to get the
subcommand, just like we did for `sudo`.

Reported by @adregan on gitter
2018-10-02 19:31:30 +02:00
evuez
f3cee81338 Add --color completion for diff 2018-10-02 18:51:14 +02:00
Fabian Homborg
64783428d4 [CHANGELOG] Add more for 3.0 2018-10-02 18:41:59 +02:00
Mahmoud Al-Qudsi
3875cc60bd Optimize literal_zero_index comparisons
No longer check literal zero after the first non-zero value.
2018-10-01 21:20:13 -05:00
Mahmoud Al-Qudsi
264d8270a7 Emit an error message on literal zero indices
Mostly resolves #4862, though there remains the lingering question of
whether or not to emit a warning to /dev/tty or stderr when a
non-literal-zero index evaluates to zero.
2018-10-01 20:58:26 -05:00
Mahmoud Al-Qudsi
5b696b5fb5 Update rsync completions
Closes #4863.
2018-10-01 20:37:53 -05:00
Mahmoud Al-Qudsi
6eb8526159 Remove no-longer-needed CMAKE_BUILD_TYPE comment
An update to `CMakeLists.txt` set the default build type to
`RelWithDebInfo`, so there's no need to tell users to consider appending
`-DCMAKE_BUILD_TYPE=Release` at all.

[skip ci]
2018-10-01 20:21:51 -05:00
Mahmoud Al-Qudsi
e04130e145 fixup! Add overload of wcstringutil::trim that automatically trims whitespace 2018-10-01 17:22:40 -05:00
Mahmoud Al-Qudsi
f702c42068 Sanitize history item whitespace
Coalesces commands with leading (if even possible) and trailing
whitespace into the same item, improving the experience when iterating
over history entries.

Closes #4908.
2018-10-01 17:12:18 -05:00
Mahmoud Al-Qudsi
a9845dc026 Add overload of wcstringutil::trim that automatically trims whitespace 2018-10-01 17:12:18 -05:00
ridiculousfish
d7cbf3581d Remove retval global from builtin_wait 2018-10-01 09:59:27 -07:00
ridiculousfish
1bc4cf2318 More const and atomic correctness 2018-10-01 09:59:22 -07:00
ridiculousfish
070a43989f Mark a null variable const in builtin_echo 2018-10-01 09:47:45 -07:00
ridiculousfish
a722a4b967 Remove global variables from builtin_commandline
There was no reason to have builtin_commandline store its buffer in a global,
these can be local variables.
2018-10-01 09:34:58 -07:00
David Adam
551ca813e0 CHANGELOG: linkify some completion PRs 2018-10-01 17:17:33 +08:00
ridiculousfish
5735703261 Convert some static wcstring_list_t to C arrays
Saves some allocations at startup.
2018-09-30 19:57:05 -04:00
ridiculousfish
e6d09dc4fe Remove another unnecessary env_var_t creation 2018-09-30 18:30:13 -04:00
ridiculousfish
bd7fea55c4 Remove some unnecessary env_var_t usage 2018-09-30 18:20:59 -04:00
ridiculousfish
6147e9ee0d path_get_cdpath to accept string instead of env_var_t
Unclear why it ever needed an env_var_t. wcstring is sufficient and much
simpler.
2018-09-30 18:13:14 -04:00
ridiculousfish
16da066722 Convert some loops in input.cpp 2018-09-30 18:13:14 -04:00
ridiculousfish
05d14f24d6 Fix a crash in bind
444f9f8715 introduced a bug where we would
use an iterator that had been invalidated by erase(). Fix that.
2018-09-30 18:00:52 -04:00
Fabian Homborg
35ce95f51d [Changelog] bind preset change
No reason to even mention them, people will care more about f_u_k_b.
2018-09-30 16:58:06 +02:00
Fabian Homborg
d62731a931 [CHANGELOG] Reorganize
This should make it more attractive to those not in the know.
2018-09-30 16:57:11 +02:00
Fabian Homborg
444f9f8715 Add separation of "preset" bindings
This allows for marking certain bindings as part of a preset, which allows us to

- only erase those when switching presets
- go back to the preset binding when erasing a user binding
- only show user customization if requested
- make bare bind statements in config.fish work (!!!11elf!!!)

Fixes #5191.
Fixes #3699.
2018-09-30 16:54:56 +02:00
ridiculousfish
36a149337b Eliminate / vet and whitelist some more globals 2018-09-29 01:11:15 -04:00
ridiculousfish
0170875ece Add an assert that builtin names are sorted 2018-09-29 00:30:02 -04:00
ridiculousfish
96da62ea87 Revert "Convert list of builtins from sorted array to unordered_set"
This reverts commit d8a1928c24.

It is better to have builtins as static const data to avoid unnecessary
initialization and allocation during startup.
2018-09-29 00:22:24 -04:00
ridiculousfish
20cb62440c Eliminate some mutable global variables
Make them const or otherwise get rid of them
2018-09-29 00:20:50 -04:00
ridiculousfish
d7b2576fb5 Mark short_options as const everywhere
These were needlessly mutable file-scoped variables.
2018-09-29 00:18:36 -04:00
ridiculousfish
f465760d1f Add a tool to locate global variables 2018-09-29 00:18:33 -04:00
ridiculousfish
9fd3f35c9a Fix some dead code
Delete some dead code, and migrate some other code under the appropriate
preprocessor check.
2018-09-28 21:26:21 -04:00
ridiculousfish
a17a815c87 Revert "Add vector of cleanup/termination events to be executed before quit"
This reverts commit 8c14f0f30f.

This list is not reliable - there are many ways for fish to quit that does not
invoke these functions. It's also not necessary since the history is correctly
saved on exec.
2018-09-28 20:21:23 -04:00
ridiculousfish
a389ca694c Revert "Save history on exec"
This reverts commit 9d0050023c.

This change was not necessary. History is already saved on exec().
2018-09-28 20:20:54 -04:00
ridiculousfish
7a0e72bfa9 env_get_pwd_slash to return L"/" if $PWD is empty or missing
Prior to this change, env_get_pwd_slash() would try to infer the PWD from
getcwd() if $PWD were missing. But this results env_get_pwd_slash() doing
something radically different than $PWD, and also is a lot of code for a
scenario that cannot be reliably reproduced. Just return "/" in this case.
2018-09-28 20:09:45 -04:00
Mahmoud Al-Qudsi
dd8c4cfb33 fixup! Move get_runtime_path() to env.cpp and expose it in env.h 2018-09-28 11:49:06 -05:00
Mahmoud Al-Qudsi
9d0050023c Save history on exec
See https://github.com/fish-shell/fish-shell/issues/907

May not fully resolve the issue, needs to be tested before #907 can be closed.
2018-09-28 11:34:07 -05:00
Mahmoud Al-Qudsi
8c14f0f30f Add vector of cleanup/termination events to be executed before quit 2018-09-28 11:34:07 -05:00
Mahmoud Al-Qudsi
e045b045da Move get_runtime_path() to env.cpp and expose it in env.h
It was previously a file-local static function in env_universal.cpp.
2018-09-28 11:33:11 -05:00
David Adam
5cc92ffd70 Documentation for while: note new exit status changes
Work on #4982.
2018-09-28 22:57:02 +08:00
ridiculousfish
a1728d61af Report errors on invalid replacements in string replace
If the replacement in `string replace` is invalid, prior to this fix we would
enter into an infinite loop trying to parse it. Instead report errors correctly.

Fixes #3381
2018-09-27 22:28:39 -04:00
ridiculousfish
ae54b66799 Fix string 2018-09-27 22:23:03 -04:00
ridiculousfish
cc99e8d510 Switch tokenizer_error back to just an error code
Rather than having tokenizer_error as pointers to objects, switch it back
to just an error code value. This makes reasoning about it easier since
it's immutable values instead of mutable objects, and it avoids allocation
during startup.
2018-09-27 21:40:51 -04:00
ridiculousfish
f28f9792b3 Remove ENUM_FLAGS
This define added operator overloading via preprocessor macros, which is
more magic than necessary. It was only used in one place.
2018-09-27 21:25:58 -04:00
Mahmoud Al-Qudsi
f15dd314e0 Revert "Add hash function for compatibility with sh/bash"
This reverts commit dbd228cc75.
2018-09-27 17:21:12 -05:00
Mahmoud Al-Qudsi
f5083d7bab Set $status after while depending on whether loop was entered
Closes #4982.
2018-09-27 08:15:45 -05:00