Commit Graph

9829 Commits

Author SHA1 Message Date
Aaron Gyes
3e8c05e32b cat, mv, rm completions: shorten descriptions 2019-03-09 15:02:25 -08:00
Aaron Gyes
c1859b5678 date completions: show correct options for different BSDs, macOS
Also prevents file completions where they are not approprite, and
additionally shortened the descriptions to fit in two pager columns
in an 80-wide terminal for some platforms.
2019-03-09 14:56:25 -08:00
Aaron Gyes
eaf496c1d4 seq.fish: use gseq if available.
Apparently if you install gnu coreutils on OpenBSD, the tools are
g-prefixed. So we definitely want to just alias that rather than
provide our lousy shell script implementation.
2019-03-09 13:44:03 -08:00
Fabian Homborg
ba1249763b functions/__fish_npm_helper: Use python for json
[ci skip]
2019-03-09 18:30:17 +01:00
Fabian Homborg
bf926fd6c4 completions/yarn: Don't offer files for yarn run
Pretty sure that, like npm, that's not valid.

[ci skip]
2019-03-09 18:04:21 +01:00
Fabian Homborg
b0e9405b11 Read json via python
Apparently that's actually faster than jq, and it's more likely to be
installed.

Also it should convince the arch packager to remove the jq dependency.

The indentation is weird, though.

[ci skip]
2019-03-09 18:04:21 +01:00
Fabian Homborg
9b1fb6938e Add __fish_anypython helper function
This just finds the first usable python and echos it, so it can then
be used.

We have a few places where we use it and I'm about to add some more.
2019-03-09 18:04:21 +01:00
Aaron Gyes
3ac1c29f79 cp completions: shorten descriptions
Enough to fit two pager columns into a 80-wide terminal.
2019-03-09 07:55:46 -08:00
Aaron Gyes
5938f02db1
Update CHANGELOG.md 2019-03-09 07:41:46 -08:00
Aaron Gyes
7ececa4c69 dmesg completions for all the platforms
+ tweaks for Linux: shorter descriptions, suppress file completions
+ Add correct completions for macOS, NetBSD, FreeBSD, OpenBSD, DragonFly
+ Solaris dmesg has no options, so complete nothing there
2019-03-09 07:29:23 -08:00
Fabian Homborg
62526a3ac8 completions/git: Fix relative paths for older git
If the first file presented was in the current directory, this would
error out.

Fixes #5728.

[ci skip]
2019-03-08 16:03:57 +01:00
Fabian Homborg
49ba7f8c01 Update CHANGELOG 2019-03-07 22:50:18 +01:00
Fabian Homborg
bd5232e0e2 functions/seq: Fix negative numbers
25d83ed0d7 (included in 3.0.0) added a `string` check that
did not use `--`, so negative numbers were interpreted as options.

Apparently nobody is using this.

(Again, this is for the `seq` fallback used on OpenBSD)
2019-03-07 22:50:17 +01:00
Aaron Gyes
e35a30de0a Add NSAppleEventsUsageDescription
This is required to send Apple Events when built against the 10.14
SDK.

Fixes #5727
2019-03-07 12:01:53 -08:00
Fabian Homborg
b5b0e68044 functions/seq: Stop using bc in the fallback
Just to remove the dependency - performance is probably about the
same.

This is used, AFAICT, exclusively on OpenBSD (not Free or Net).

CC @zanchey.
2019-03-07 14:04:32 +01:00
Fabian Homborg
1cd5b2f4e1 Pass string length instead of recomputing
This called `writestr(char*)`, which then just called `writestr(char*,
strlen(char*))`, when it had the string length right there!
2019-03-07 10:04:18 +01:00
Fabian Homborg
2b0b3d3193 Outputter_t: Handle C locale like everything else
This tried to skip conversion if the locale had MB_CUR_MAX == 1, but
in doing so it just entered an infinite recursion (because
writestr(wchar_t*) called writestr(wchar_t*)).

Instead, just let wcstombs handle it.

Fixes #5724.
2019-03-07 10:04:18 +01:00
Aaron Gyes
91e70e38e7 Handle TERM_PROGRAM_VERSION with junk after the number.
We only care about the major version number.

Fixes #5725
2019-03-06 13:52:54 -08:00
Fabian Homborg
c633c06e11 Guess emoji width via system wcwidth
Since Unicode 9, the width of some characters changed to 2.

Depending on the system, it might have support for it, or it might
not.

Instead of hardcoding specific glibc etc versions, we check what the
system wcwidth says to "😃", U+1F603 "Grinning Face With Big Eyes".

The intention is to, in most cases, make setting $fish_emoji_width
unnecessary, but since it sets the "guessed_emoji_width", that variable still takes precedence if it is set.

Unfortunately this approach has some caveats:

- It relies on the locale being set to a unicode-supporting one.
  (C.UTF-8 is unfortunately not standard, so we can't use it)
- It relies on the terminal's wcwidth having unicode9 support IFF the
  system wcwidth does.

This is like #5722, but at runtime.

The additional caveat is that we don't try to achieve a unicode
locale, but since we re-run the heuristic when the locale changes (and
we try to get a unicode locale), we should still often get the correct
value.

Plus if you use a C locale and your terminal still displays emoji,
you've misconfigured your system.

Fixes #5722.
2019-03-06 22:27:21 +01:00
Fabian Homborg
60ce10ad84 functions/eval: Return 0 for empty arguments
Fixes #5692.
2019-03-05 21:10:11 +01:00
Fabian Homborg
eac9ec9093 Add vagrant completions
These aren't perfect, but the tool is pretty much hostile to proper
completions - it includes a "--machine-readable" option, but `vagrant
global-status --machine-readable` prints great output like

```
1551816037,,ui,info,id
1551816037,,ui,info,name
1551816037,,ui,info,provider
1551816037,,ui,info,state
1551816037,,ui,info,directory
1551816037,,ui,info,
1551816037,,ui,info,-------------------------------------------------------------------------
1551816037,,ui,info,d3ea265
1551816037,,ui,info,default
1551816037,,ui,info,virtualbox
1551816037,,ui,info,poweroff
1551816037,,ui,info,/home/alfa/dev/oi-userland
1551816037,,ui,info,
1551816037,,ui,info,fdf42c4
1551816037,,ui,info,default
1551816037,,ui,info,virtualbox
1551816037,,ui,info,poweroff
1551816037,,ui,info,/home/alfa/dev/vagrant/NetBSD
1551816037,,ui,info,
1551816037,,ui,info,f8f6eff
1551816037,,ui,info,default
1551816037,,ui,info,virtualbox
1551816037,,ui,info,poweroff
1551816037,,ui,info,/home/alfa/dev/vagrant/fedora
1551816037,,ui,info,
1551816037,,ui,info, \nThe above shows information about all known Vagrant environments\non this machine. This data is cached and may not be completely\nup-to-date (use "vagrant global-status --prune" to prune invalid\nentries). To interact with any of the machines%!(VAGRANT_COMMA) you can go to that\ndirectory and run Vagrant%!(VAGRANT_COMMA) or you can use the ID directly with\nVagrant commands from any directory. For example:\n"vagrant destroy 1a2b3c4d"
```

and still takes 500ms to do so. The actual information is in a json
file, which we can't expect to read, and it doesn't have linebreaks or
such which we could use to hack-parse it.

So this is the best we can do for the most important bits (the
machineids), so let's just add this as-is.

[ci skip]
2019-03-05 21:02:32 +01:00
Fabian Homborg
60f162db19 Remove single-argument test
This is an awful bit of `test` functionality that only exists to have
a clever shortcut and confuse people.

[ci skip]
2019-03-05 17:57:50 +01:00
Fabian Homborg
fe029d4d27 CHANGELOG: Remove reverted fix for read in fish_title
11009de431 reverted
b247c8d9ad because it did not work.

[ci skip]
2019-03-05 10:44:11 +01:00
David Adam
b443808452 event.cpp: die if invalid event type passed
Fixes the build with -Wreturn-type.
2019-03-05 07:27:56 +08:00
David Adam
08fd8b6472 cmake: fix prebuilt documentation detection and installation 2019-03-04 22:06:09 +08:00
ridiculousfish
89a7cc5da3 Switch s_write to accepting const vector & instead of raw pointers 2019-03-03 18:49:57 -08:00
ridiculousfish
ccbc9d57f2 Remove reader_data_t::next
It's no longer used
2019-03-03 18:14:41 -08:00
ridiculousfish
9b9c1aa745 Fix some unused variable warnings 2019-03-03 18:06:31 -08:00
ridiculousfish
717ac9a8d5 Switch highlight_spec_t to a struct
Rather than a janky bitmask, use a real struct with real fields.
2019-03-03 18:04:22 -08:00
ridiculousfish
d165d1df27 Remove highlight_modifier_sloppy_background
It's no longer ever set
2019-03-03 17:56:08 -08:00
ridiculousfish
43a11af5e4 Reorganize reader.cpp to separate te current_data users from reader_data_t 2019-03-03 15:49:56 -08:00
ridiculousfish
c09544b288 Migrate more functions to instance methods on reader_data_t 2019-03-03 15:10:47 -08:00
ridiculousfish
29db076f4a exec_prompt to be an instance method on reader_data_t 2019-03-03 14:38:53 -08:00
ridiculousfish
7ff4b5e5fe Switch highlighting to instance methods on reader_data_t 2019-03-03 14:34:52 -08:00
ridiculousfish
e477b99a8b Switch more autosuggestions to instance methods on reader_data_t 2019-03-03 14:30:32 -08:00
ridiculousfish
b014c327a2 reader_data_t to become enable_shared_from_this
For background operations such as autosuggestions, we need a way for the
completion handler to keep the reader_data alive.
2019-03-03 14:21:15 -08:00
ridiculousfish
c334a41f96 Switch accept_autosuggestion to an instance method on reader_data_t 2019-03-03 14:11:09 -08:00
ridiculousfish
d7a156e7d9 Switch clear_pager to an instance method on reader_data_t 2019-03-03 14:09:23 -08:00
ridiculousfish
164c5b1c18 Migrate a lot of free functions in reader into reader_data_t 2019-03-03 14:02:27 -08:00
ridiculousfish
ecf51b575e Clean up input initialization and destruction 2019-03-03 12:59:55 -08:00
ridiculousfish
dc1073f905 reader_set_buffer_maintaining_pager to take reader_data directly 2019-03-03 12:19:46 -08:00
ridiculousfish
0bc08c6197 highlight_search to take reader_data directly 2019-03-03 12:11:32 -08:00
ridiculousfish
b07345ed18 set_command_line_and_position to take reader_data directly 2019-03-03 12:07:51 -08:00
ridiculousfish
968152ddc7 clear_pager to accept reader_data directly 2019-03-03 12:00:09 -08:00
ridiculousfish
e11c3f352f Clean up handle_child_status
Now that we only call waitpid() on specific processes, we no longer need
to search to find the process returned by waitpid.
2019-03-03 11:47:32 -08:00
radek-sprta
261d48367d Add completions for Mariner (#5718)
* Add completions for Mariner

* Remove unnecessary characters
2019-03-03 20:25:31 +01:00
Fabian Homborg
8939a7ba7a completions/ipset: Don't error on loading
`ipset list --name` is a privileged operation, and it prints an
"Operation not permitted" error when done as a normal user.

What's worse, this did it on loading (the command substitution wasn't
quoted), so we'd print the error as soon as you did `ipset `.

Only do the operation when necessary, and don't print the error.

This'll effectively only make it work for root shells (not e.g. `sudo
ipset`), but I don't want to sprinkle `sudo` in the completion.

(Also why does listing stuff require root? That's not how it works
e.g. for ips. But I don't actually know what ipset is for, so maybe
there is a good reason.)

[ci skip]
2019-03-03 12:43:05 +01:00
ridiculousfish
dac5d79059 Switch wait command to use topics
Prior to this fix, the wait command used waitpid() directly. Switch it to
calling process_mark_finished_children() along with the rest of the job
machinery. This centralizes the waitpid call to a single location.
2019-03-02 16:58:27 -08:00
ridiculousfish
dc27de8190 Rename reader_interrupted to reader_test_and_clear_interrupted 2019-03-02 15:17:00 -08:00
David Adam
637503cb0a travis: drop superfluous CXXFLAGS on macOS
These have not been required since ASan was moved back to the Linux build.
2019-02-28 21:09:03 +08:00