Commit Graph

2765 Commits

Author SHA1 Message Date
Fabian Homborg
25ba16d4b6 functions/help: Cleanup 2019-03-22 12:48:26 +01:00
Fabian Homborg
4c61691377 functions/help: Don't eval to check for lynx
This called `eval $fish_browser --version` to figure out if it is
lynx.

That's really not worth it just to support edge-cases using a rather
unusual browser, to work around a bug in it.

Instead we just see if the browser name starts with "lynx", which
should work in 99.9% of cases.
2019-03-22 12:38:23 +01:00
Fabian Homborg
21c8be8cd1 functions/help: Use open command everywhere
See #5756.

[ci skip]
2019-03-22 09:09:57 +01:00
Fabian Homborg
a649c5293e functions/fish_git_prompt: Fix space prefix for verbose showupstream
This created another local version of the variable just for the if-block.

Can't say I love the space prefix, but then I think we have too many
of these modes anyway.
2019-03-19 10:27:52 +01:00
Fabian Homborg
f6226f0802 functions/fish_git_prompt: Useful status for show_upstream
Returns 0 if there is no diversion, 1 otherwise.
2019-03-19 10:24:40 +01:00
Fabian Homborg
632c47be54 functions/fish_git_prompt: Remove literal tabs 2019-03-19 10:24:34 +01:00
Fabian Homborg
05ef157757 functions/fish_git_prompt: Let helper functions return useful status
If you use these to figure out if there _are_ staged files, or dirty
or whatever, you currently need to check the output, which relies on
the configured character.

Instead, we let them also return a useful status.
Notably, this is *not* simply the status of the git call.

__fish_git_prompt_X returns 0 if the repo is X.

This works for untracked, but the "diff" things return 1 if there is a
diff, so we invert the status for them.

See #5748.

[ci skip]
2019-03-19 10:11:37 +01:00
ykai
f56bce3f97 Fixed mount -o<TAB> exception 2019-03-19 09:28:14 +01:00
Fabian Homborg
805a8db7ef functions/fish_hg_prompt: Show untracked files
Apparently "status --quiet" actually inhibits showing untracked files,
which explains why it's 20% faster (though it's quite weird use of
that option!)

Fixes #5749.

[ci skip]
2019-03-18 22:26:43 +01:00
SanskritFritz
aea4062906 cower doesn't exist anymore, completions dropped 2019-03-17 10:55:01 +01:00
Fabian Homborg
0b6d6a29eb completions/git: Fix broken conditions for git config
Classic case of not seeing `and` as a new command:

`__fish_git_using_command config and anotherthing`

causes `and anotherthing` to be passed as arguments to
`__fish_git_using_command` instead of being executed.

[ci skip]
2019-03-15 20:09:55 +01:00
Fabian Homborg
a7ab8c6a4b Remove __fish_test_arg helper function
This was a remnant from before `string` existed, and was only used by
the xterm completions.

Part of #5279

[ci skip]
2019-03-15 19:58:01 +01:00
Fabian Homborg
2de3f7c686 Move ninja functions into ninja completions
Part of #5279

[ci skip]
2019-03-15 19:57:56 +01:00
Fabian Homborg
1c3c76165e Move xrandr functions into randr completions
Part of #5279.

[ci skip]
2019-03-15 19:57:51 +01:00
Fabian Homborg
a1380a736b Move __fish_print_make_targets into make completions
A function file for a function used only by one completion (and
unlikely to be used anywhere else).

If another user shows up, we can move it out again.

Part of #5279

[ci skip]
2019-03-15 19:57:46 +01:00
Fabian Homborg
86e9e60ae7 completions/set: Fix set -eU
This had a typo where it completed `-u` variables. Only `-u` means
unexported, `-U` means universal.

[ci skip]
2019-03-15 15:22:59 +01:00
Fabian Homborg
83932441bb Fix fish_clipboard_paste with string-replace-fewer-backslashes
This is the one place in fish where we use a `\` in the replacement of
a `string replace -r`, so we'll have to check the feature.
2019-03-15 15:18:19 +01:00
Fabian Homborg
a7a12c5c96
Merge pull request #5709 from zabereer/prompts_with_pipestatus
Prompts with pipestatus
2019-03-15 14:32:33 +01:00
Fabian Homborg
18d7123ff4 fish_git_prompt: Use count from stdin
Removes any uses of `wc` in our codebase.
2019-03-15 14:31:36 +01:00
Fabian Homborg
9dcb5abaf1 completions/pandoc: Stringify
This should be the last call to `grep` outside of a script
specifically related to `grep`.

(With the exception of `zpool`, which I've already written, but which
will probably be merged later)
2019-03-14 17:16:47 +01:00
Fabian Homborg
7766d0a7d0 Remove outdated comment
[ci skip]
2019-03-14 13:23:48 +01:00
Fabian Homborg
912ba177ec functions/__fish_append: Stringify
This called `sed`, twice.
2019-03-14 13:23:48 +01:00
Fabian Homborg
05038fc865 completions/zfs: Stringify 2019-03-14 13:23:47 +01:00
Fabian Homborg
aa08504fe3 completions/zpool: Stringify a bit
These are the simple bits - replace useless helper functions and uses
of grep/sed with string or other appropriate tools.
2019-03-14 13:23:47 +01:00
Fabian Homborg
a4d728c9de completions/ezjail-admin: Stringify
Specifically `grep`, these awks are still a bit too annoying to do
with `string`.
2019-03-14 13:23:47 +01:00
Fabian Homborg
3043d726bf completions/minikube: Stringify 2019-03-14 13:23:47 +01:00
Fabian Homborg
c5d5089871 fish_svn_prompt: Stringify
This was the only remaining use of `grep` in functions/.
2019-03-14 13:23:47 +01:00
Fabian Homborg
5859d205d8 completions/apt-file: Remove ls call 2019-03-14 13:23:47 +01:00
Fabian Homborg
7784a5f23c __fish_describe_command: Remove awk
This is really the only important place we're using it.

See #5553.
2019-03-14 13:23:47 +01:00
Fabian Homborg
29556efebd Drop rc.d completions
This was an arch utility that it used shortly before introducing
systemd.

It's been dropped upstream for years.
2019-03-14 13:23:47 +01:00
Fabian Homborg
a5a643f854 Bracketed paste: Strip leading spaces if they'd trigger histignore
Similar to the last commit, only for the in-terminal-paste stuff.

Also cleans up the comments on bracketed paste a bit - nobody has
stepped forward to report problems with old emacsen or windows, so
there's no need for a TODO comment.

See #4327.
2019-03-13 12:39:08 +01:00
Fabian Homborg
ad0c8cfb83 fish_clipboard_paste: Don't add histignore spaces
If we're at the beginning of the commandline, we trim leading whitespace so we don't trigger histignore.

Since that's the main issue of problems with histignore:
Closes #4327.
2019-03-13 12:39:08 +01:00
hyperfekt
8a0d794337 fish_git_prompt: optionally show stash state in informative mode 2019-03-12 18:47:28 +01:00
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
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
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
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
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
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
zabereer
a634356bcc remove redundant comment from __fish_print_pipestatus.fish 2019-03-05 18:25:16 +00:00
zabereer
d71e39f756 Revert "use global variables for $pipestatus in prompts to allow users to customize the look"
This reverts commit d5c18350a7.
2019-03-05 18:19:57 +00:00