Commit Graph

558 Commits

Author SHA1 Message Date
Cherichy
f32777a0cc check for both wsl1 and wsl2 2020-05-25 13:05:13 +08:00
Cherichy
b34d9bcc97 fix is_wsl() on wsl2
on wsl2 the /proc/version contains no Microsoft as wsl1 do.
2020-05-25 13:05:13 +08:00
Johannes Altmanninger
49c5f96470 Use set -l to force use of a local variable
Bare set overwrites a global/universal variable if it exists.
2020-05-15 08:25:07 +02:00
David Adam
30a8345a11 create_manpage_completions: use the first tool found
Noted in https://github.com/fish-shell/fish-shell/pull/6879#discussion_r421731269
2020-05-10 21:56:12 +08:00
Bjorn Neergaard
02e9486559
Fix manpath handling in create_manpage_completions.py (#6879)
* Fix manpath handling in create_manpage_completions.py

...as well as do some (very!) light cleanup.

Currently, `create_manpage_completions.py` does not properly
understand/respect the `$MANPATH` variable. One important feature of
`$MANPATH` is that an empty component (i.e. the trailing : in
`foo:bar:`) expands to the 'default' or 'system' path -- that is to say,
the path that would be used if `$MANPATH` was unset. This allows the
user to extend the manpath without clobbering it, and has been a feature
many Unices have included for years.

The current implementation blindly uses the `$MANPATH` variable if it
exists, which does not allow for this behaviour -- to expand the
variable correctly, an external program must be invoked. Therefore, we
first shell out to the 'proper' (read: best guess) external program. If
that fails, we can then try to use `$MANPATH` directly/literally.
Finally, if both of those are impossible, we can fall back to some
common paths from widely used operating systems.

Note that the `man.conf` parsing has been removed: this is because while
many 'traditional' Unices (BSDs, Solaris, macOS) support this file, only
macOS actually ships a file -- most other Unices use a `conf.d`-style
layout and supporting that from our Python is impractical and silly at
best. On GNU (read: Linux) systems, `mandb` uses `/etc/man_db.conf` with
slightly different syntax and sematics. As this code-path has bitrotted
(and likely never worked, anyway), just remove it.

`create_manpage_completions.py` looks like it has suffered a lot of
confusion and bitrot in general over the last few years -- and is
overdue for a major refactoring. I am quite interested in tackling this,
but I plan to wait until the go-ahead to drop support for Python 2 is
given, as a major refactor/rewrite that still supports Python 2 (and
thus ignores the ergonomic/API/syntax improvements of Python 3) does not
make sense to me.

Related: #5657

It would probably be good to revisit `man.fish` once again when a
comprehensive refactor happens: hopefully every permutation of
`man`/`$MANPATH` could be documented as part of that effort.

* Restore /etc/man.conf parsing

I was not aware that this codepath was used -- since it appeared that it
would throw an error when it was reached. Redo it, using regex, and
support parsing NetBSD man.conf as well (untested).

* Fix create_manpage_completions.py under Python 2
2020-05-07 21:01:02 +02:00
Fabian Homborg
fd90482c19 create_manpage_completions: Output "-d", not "--description"
We typically use "-d" because it's shorter.
2020-04-25 11:34:52 +02:00
Fabian Homborg
5ca527b2fe create_manpage_completions: Remove trailing period
Turns out this was on purpose, but we've been telling people to do
away with them for quite a while.
2020-04-25 11:34:40 +02:00
Fabian Homborg
b42445e675 Restyle create_manpage_completions 2020-04-05 10:13:02 +02:00
Fabian Homborg
af03f2ce6d create_manpage_completions: Switch to argparse
This is a lot cleaner and more easily extendable.
2020-04-04 15:30:09 +02:00
Fabian Homborg
6e95e1d79d create_manpage_completions: Change "--save" to "--keep" 2020-04-04 15:30:09 +02:00
JanczarKnurek
f212aba174 Allow not to remove files from destination dir
Signed-off-by: JanczarKnurek <jacek@beit.tech>
2020-04-04 15:30:09 +02:00
Fabian Homborg
1406d63b85 Restyle
I kinda hate how fussy clang-format is. It reflows text
constantly (line limit), forces things onto one line *except* when
they're too long, and wants to turn this:

```c++
    return true;;
```

into this:

```c++
    return true;
    ;
```

instead of, you know, eliminating the second semicolon?

Anyway, it is what it is and we use it, I'll just look into getting some
more slack.
2020-03-26 20:45:40 +01:00
JanczarKnurek
e78ed51747 Add flag names to usage line
Signed-off-by: JanczarKnurek <jacek@beit.tech>
2020-03-24 21:04:29 +01:00
JanczarKnurek
b1c14cf084 Add missing flags desc to script
create_manpage_completions now has all flags in help

Signed-off-by: JanczarKnurek <jacek@beit.tech>
2020-03-24 21:04:29 +01:00
Fabian Homborg
52f819cd35 sample_prompts/nim: Add vi mode indicator
The default indicator ruined alignment, which is a major design
feature here.

Handle it by including the mode indicator in the prompt proper.

Fixes #6802.

[ci skip]
2020-03-24 17:08:19 +01:00
Fabian Homborg
9367d4ff71 Reindent functions to remove useless quotes
This does not include checks/function.fish because that currently
includes a "; end" in a message that indent would remove, breaking the test.
2020-03-09 19:46:43 +01:00
Fabian Homborg
65883e0e40 Restyle
Mostly line breaks, one instance of tabs!

For some reason clang-format insists on two spaces before a same-line comment?

(I continue to be unimpressed with super-strict line length limits,
but I continue to believe in automatic styling, so it is what it is)

[ci skip]
2020-02-17 14:14:05 +01:00
Johannes Altmanninger
5d135d5556 prompts: fix pipestatus for jobs prefixed with "not"
6902459566 was an attempt to not print
$status twice in the prompt. As a result we print $pipestatus but
not $status, which /usually/ is the same as $pipestatus[-1] --- unless
the builtin "not" is used, which inverts the $status of a job (it does
not alter $pipestatus).

As a result, the default prompt prints unexpected status codes:

	~ > not false
	~ [1]> not true
	~ > not true | true
	~ > not false | false
	~ [1|1]>

This commit reintroduces printing of $status after $pipestatus, but only
if it is different from $pipestatus[-1].
Additionally, we only print anything at all if the $status is nonzero,
to avoid confusing output on `not false | false`

	~ > not false
	~ > not true
	~ [0] 1> not true | true
	~ [0|0] 1> not false | false
	~ >

I think this is closer to users' expectations for those cases; they should
not have to think about this implementation detail of the not-statement.
2020-02-06 01:43:17 +01:00
Fabian Homborg
23042b6a43 Remove unused "prefix" variable in prompt presets
[ci skip]
2020-01-26 12:29:06 +01:00
Aaron Bieber
903fe9de48 webconfig: Use tempfile instead of ~/.cache (#6522)
OpenBSD uses [unveil(2)](https://man.openbsd.org/unveil) in chromium and
firefox. This means that things outside of directories like ~/Downloads or /tmp are not visible to the
browsers.

Change webconfig so it uses tempfile.NamedTemporaryFile to create our temp file.
2020-01-23 19:52:26 +01:00
Greg Anders
e143618aef Set base16 colors for operator, escape, and match 2020-01-18 12:16:19 -08:00
Greg Anders
1331b32cce Add Base16 color options to fish_config 2020-01-18 12:16:19 -08:00
Fabian Homborg
69b464bc37 Run fish_indent on all our fish scripts
It's now good enough to do so.

We don't allow grid-alignment:

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z              -a '(something)'
```

becomes

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```

It's just more trouble than it is worth.

The one part I'd change:

We align and/or'd parts of an if-condition with the in-block code:

```fish
if true
   and false
    dosomething
end
```

becomes

```fish
if true
    and false
    dosomething
end
```

but it's not used terribly much and if we ever fix it we can just
reindent.
2020-01-13 20:34:22 +01:00
Fabian Homborg
f637b81fb6 sample_prompts/acidhub: Use prompt_pwd
This removes a call to `sed` and allows the user to specify shortening
via the variable.

We still default to disabling shortening because this prompt never
did.

[ci skip]
2020-01-06 18:41:50 +01:00
Guilhem Saurel
9910ee26cd disable virtualenv prompt update in nim prompt
As this information is already wrapped into a _nim_prompt_wrapper
2020-01-06 17:06:24 +01:00
Fabian Homborg
4a47e212f8 Color the default prompt host if running via SSH
This is part of our (well, my) quest to spice up the default prompt.

In this case we color the host if $SSH_TTY is set, which is easy to
detect and helps draw attention to the host.

See #6398.
See #6375.
2019-12-30 14:03:36 +01:00
Johannes Altmanninger
94b5720343 prompt: remove fallback for $fish_color_host
This was mostly dead, since $fish_color_host is set to normal in
__fish_config_interactive. The assignment was only used if the user
explicitly unsets fish_color_host (which they shouldn't, really).
Anyway it's weird to use cyan, use normal instead.
[ci skip]
2019-12-11 11:32:58 +01:00
Johannes Altmanninger
2f1a5e65d8 prompt: don't set default colors twice
The colors are set in __fish_config_interactive before the prompt is
painted for the first time.

Also initialize the $fish_color_status for the (pipe) status, bump the
version for that.
[ci skip]
2019-12-11 11:32:58 +01:00
Johannes Altmanninger
d4a3b30b73 prompt: move status to the right in classic_status sample prompt
This is consistent with the other prompts that include status.

[ci skip]
2019-12-11 01:19:12 +01:00
Johannes Altmanninger
6902459566 prompt: don't print status of last process in pipe twice
If a command fails, print the pipestatus in red instead of yellow and
don't print the status of the last process again. See #6375.

Also use $fish_color_status for coloring status consistently.

Also use __fish_pipestatus_with_signal to print SIGPIPE instead
of a numeric code on e.g.: yes | less +q

[ci skip]
2019-12-11 01:19:12 +01:00
Fabian Homborg
1fdb23637a Clean up Classic + VCS prompt
- Don't use a guard uvar - we're only setting variables now, and
- that's basically free.
- Allow non-universal color variables
- Simplify the root color setting a bit.
- Some comments

[ci skip]
2019-12-04 21:21:34 +01:00
Fabian Homborg
d91b0f86f4 Repaint all prompts if the variables change
This is a good idea in general and simplifies the Classic + VCS
prompt.
2019-12-01 18:15:36 +01:00
Fabian Homborg
330f1701d7 Restyle
This mostly fixes some wrong indents or replaces some stray tab indents.

I excluded alignment on purpose, because we have a whole bunch of code
that goes like

```fish
complete -c foo -n 'some-condition'        -l someoption
complete -c foo -n 'some-longer-condition' -l someotheroption
```

and changing it seems like a larger thing and would include more
thrashing.

See #3622.
2019-11-16 14:57:59 +01:00
James Stidard
16bf98f928 Fix: equality vs identity
Changes identity `is` for equality `==` check. To remove python warnings when updating auto complete

```
/usr/local/Cellar/fish/3.0.2/share/fish/tools/deroff.py:770: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(comps) is 2:
/usr/local/Cellar/fish/3.0.2/share/fish/tools/deroff.py:954: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(comps) is 2:
Parsing man pages and writing completions to /Users/james/.local/share/fish/generated_completions/
  6155 / 6155 : zic.8
```
2019-11-06 14:13:21 +08:00
Lior Stern
5b2250883a Add termux support for fish_config. 2019-10-26 18:16:54 +02:00
Gabriel Medeiros Coelho
af48fa5d91 change href attribute to ng-href
Since the url is inside a AngularJS markup {{url}}, it's better to use **ng-href**.

From  [AngularJS Documentation](https://docs.angularjs.org/api/ng/directive/ngHref):
<br>
"Using AngularJS markup like {{hash}} in an href attribute will make the link go to the wrong URL if the user clicks it before AngularJS has a chance to replace the {{hash}} markup with its value. Until AngularJS replaces the markup the link will be broken and will most likely return a 404 error. The ngHref directive solves this problem."
2019-10-26 18:12:44 +02:00
Lior Stern
2810ba0014 Check that /proc/version is readable before reading it in web_config.
/proc/version may be unreadable in Android.
2019-10-26 18:12:10 +02:00
ARifleman
876176fc94 Added 'Nord' color scheme to sample color schemes (#6201) 2019-10-15 23:18:18 -07:00
Fabian Homborg
70fc2611bd webconfig: Escape abbrs properly
Fixes #6120
2019-10-02 20:37:24 +02:00
Aaron Gyes
b7dd060dec sample prompts: use $USER instead of (whoami) 2019-09-18 23:35:16 -07:00
tomKPZ
42f38bb806 Fix status code coloring for nim prompt 2019-07-07 19:36:17 +02:00
Fabian Homborg
c2970f9618 Reformat all files
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.

If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
Aaron Gyes
b5865d2cba Spruce up fish_config output, show transcript of commands run
run_fish_cmd() now prints every command we run in a subshell

Fixes #5584
2019-04-30 14:08:11 -07:00
Aaron Gyes
3b97e2d7ec Stop caching set_color output in rest of prompts
No more __fish_prompt_* variables.
2019-04-09 03:40:09 -07:00
Aaron Gyes
5f7f4c638f informative.fish: stop caching_set_color, use br* directly
No longer uses global vars to cache set_color output, this was
from before set_color was a builtin, it is pointless now.

This is also a prompt from before we had bright named colors,
and it appears it was relying on -o red to get bright red.
so use brred, etc.
2019-04-09 03:13:45 -07:00
zabereer
da2925bad7 add $pipestatus to classic_vcs.fish prompt 2019-03-04 18:25:18 +00:00
zabereer
0923712e3e add $pipestatus to informative_vcs.fish prompt 2019-03-04 18:15:04 +00:00
zabereer
e157ba131b add $pipestatus to informative.fish prompt 2019-02-28 06:37:56 +00:00
zabereer
ead26881f0 create __fish_print_pipestatus function to reduce code duplication in other prompts when adding $pipestatus 2019-02-28 06:19:28 +00:00
zabereer
8ebbe67ff1 Use string match instead of for loop to simplify classic_status.fish 2019-02-27 06:11:03 +00:00
zabereer
378b5d7295 update classic_status.fish prompt to include $pipestatus 2019-02-26 18:27:59 +00:00
Fabian Homborg
b999ba7b47 Update fish_hg_prompt reference in terlar prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
3a320d7584 Update fish_vcs_prompt reference in sampleprompts 2019-02-10 14:44:50 +01:00
Fabian Homborg
cb7762b7c0 Move __fish_git_prompt -> fish_git_prompt
This exposes it more, since it's quite an important function.

We should do the same with the other vcs functions.

We leave a compatibility shim in place for now.
2019-02-10 14:44:50 +01:00
Leonard Hecker
988283c717 Improved performance of the sorin theme
This improves performance of the sorin theme tremendously
for repositories with a large number of changes.
2019-02-06 12:29:52 +01:00
Fabian Homborg
7eee158292 Don't test with one argument
[ci skip]
2019-01-27 15:38:03 +01:00
Aaron Gyes
8743961301 Fix fish_config rendering brights as normal on prompt previews
I noticed our default brgreen for fish_color_user was rendering
as just unstyled white.
2019-01-21 13:59:36 -08:00
Fabian Homborg
c9fe59237b webconfig: Allow \co sgr0 in one more place
Some $TERMs like tmux and linux use an sgr0 ("reset") value that ends
in \co instead of "m". We need to adjust our regex here to catch that,
or we'd miscount lines with it.
2019-01-16 10:23:53 +01:00
Fabian Homborg
d7dac4d077 webconfig: Use history -z
This did some weird stuff with \x1e.

[ci skip]
2019-01-16 09:32:26 +01:00
Fabian Homborg
2b426c1047 webconfig: Fix binding tab
This broke when --preset was introduced.

We allow a "--preset" or "--user" to appear right after the "bind",
and save the value, but don't use it yet.

Fixes #5534.

[ci skip]
2019-01-16 09:32:26 +01:00
Fabian Homborg
d4be5f08f3 Fix nim prompt (via web_config)
This had a helper function defined outside of the fish_prompt
function, so `funcsave` missed it (see #736).

Fixes #5490.

[ci skip]
2019-01-07 17:25:58 +01:00
Benjamin Nied
e7bfd1d71c Remove shebangs from py scripts
Starting with Fedora 30 and RHEL 8, ambiguous python shebangs will now
throw errors during the RPM build process instead of just warnings,
since these systems have moved to Python 3 by default, and Python 2 may
not be available in the future.

See [this
page](https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error)
for more details.

Drop these shebangs as the scripts are only ever called from fish
wrappers.
2019-01-06 20:39:04 +08:00
Fabian Homborg
50fbc36b73 sample_prompts/sorin: Correct git_action function name
We renamed this, and apparently missed it.

[ci skip]
2018-12-19 09:35:26 +01:00
Leonard Hecker
082450b1e7 Severely extended the sorin theme (#5411)
* Severely extended the sorin theme

This theme should now mostly match the original.

* Removed superfluous whitespace

* Inlined external links as ASCII art

* Made myself the author of the sorin theme

* Removed superfluous read delemiter

* Renamed __fish_git_action to fish_print_git_action

* Adde a minor comment
2018-12-18 15:01:38 +01:00
Fabian Homborg
9cfb1394bf sample_prompts/sorin: Add a safe way to determine merge status
Based on what __fish_git_prompt is doing.

See #5388.

[ci skip]
2018-12-06 16:15:11 +01:00
Leonard Hecker
0b63c1f46d Don't run git merge quietly
This can and will mess up git rebases and force pushes.
2018-12-06 15:53:34 +01:00
Aaron Gyes
04795eb8ea webconfig: should know about italics, reverse, dim. 2018-12-05 01:05:33 -08:00
Fabian Homborg
03bca5f7dd webconfig: Fall back onto the default colorscheme
The solarized themes now define pager colors, while other schemes
don't.

So if a user picks one of them, and then another, they'd keep the
pager colors.

Instead, since the default theme is now complete, any theme that does
not define its own pager colors will always get the default ones.

[ci skip]
2018-12-05 09:54:31 +01:00
Fabian Homborg
fa5f3fe9a0 webconfig: Update default colorscheme
This was missing a bunch of variables from __fish_config_interactive.

Ideally we wouldn't have to duplicate this info, but I don't have a
great solution either.
2018-12-05 09:54:31 +01:00
Fabian Homborg
c242d923c9 sample_prompts/robbyrussell: Use fish_print_hg_root
This removes ~140ms from every single prompt.

When not in a git repo, this prompt now takes ~9ms, as opposed to
~150ms before.

Fixes #5266 harder.

[ci skip]
2018-11-30 20:59:53 +01:00
Fabian Homborg
60f8eda5c4 webconfig: Hack tmux's reset sequence
This is quite ugly, but in lieu of putting in a proper ansi
parser (i.e. the output part of a terminal), since this is the only
such sequence we have seen until now, let's just match it.

Fixes #5312.

[ci skip]
2018-11-30 20:21:36 +01:00
Fabian Homborg
91a664b9fa webconfig: Use html.escape if available
Just try to import it, on error import the old thing.

Tested with python 3.7.1 and 2.7.15.

Fixes #5125.

[ci skip]
2018-11-30 19:46:00 +01:00
crocket
35db0fb5df Improve the contrast of the pager for solarized dark theme.
By setting fish_pager_color_completion to B3A06D,
the pager gets more visual contrast.
2018-11-30 19:39:45 +01:00
Fabian Homborg
eb0dd1ea78 sample_prompts/robbyrussell: Clean
- Remove use of `eval`
- Use `git rev-parse` instead of `git status` as its faster,
- especially in large repos. (in qt5: 600ms vs 1ms)

- Use return status instead of test -n

This should change nothing about the output.
2018-11-29 19:35:13 +01:00
Fabian Homborg
8ee2e54c9b sample_prompts/acidhub: Improve git parsing
Same as the sorin changes - don't parse "git branch" output.
2018-11-29 19:21:07 +01:00
Fabian Homborg
b18693f3c1 sample_prompts/sorin: Improve git parsing
This uses some more string, but the main improvement is using "git
rev-list" instead of parsing "git branch" output that happens to be localized.

[ci skip]
2018-11-29 17:38:18 +01:00
Fabian Homborg
bd1ceefb17 sample_prompts/user_host_path: Remove
I can't see the value in this, given that we have a bunch of minimalist ones.
The "escaping" here is gnarly enough that I don't want to attempt to clean it up.
2018-11-29 16:35:52 +01:00
Fabian Homborg
b794a5e476 sample_prompts/debian_chroot: Clean
- Remove begin/end in if-conditions - this used to be necessary in
  fish < 2.3.0

- Quote a `test`
2018-11-29 16:35:52 +01:00
Fabian Homborg
bcfef9268d sample_prompts/classic_status: Clean
- Remove unused variable
- Use `test` instead of `[ ]`
2018-11-29 16:35:52 +01:00
Fabian Homborg
19bcf9fc36 sample_prompts/acidhub: Clean
- Remove useless helper functions
- Remove `sed` call
- Cut down on `git` calls

The status display still needs a bit of work.
2018-11-29 16:35:52 +01:00
Fabian Homborg
ad5d400319 fixup! Fix variable names
Missed an underscore, sorry!
2018-11-29 15:36:13 +01:00
Fabian Homborg
2713265b01 webconfig: Improve Solarized schemes
Fixes #5315.
2018-11-29 15:18:13 +01:00
Fabian Homborg
be1c022861 webconfig: Allow setting pager colors 2018-11-29 15:18:00 +01:00
Fabian Homborg
a02eac5a7a webconfig: Update color lists
This adds the color variables from the docs to both the python script
and the js controller.

Among others, this includes "search_match", i.e.
"fish_color_search_match".

It still does not include the pager colors because the variable names
wouldn't match.
2018-11-29 15:17:44 +01:00
equal-l2
b4a6daef11 Fix the total page count in the history tab 2018-09-22 11:58:29 +02:00
ridiculousfish
56002abc61 Paginate history in fish_config 2018-09-09 01:01:03 -07:00
ridiculousfish
b9c50e400f Fix abbreviations in web_config 2018-09-08 21:34:54 -07:00
Maximilien Mellen
78cac07d3c Fix Informative VCS sample prompt invalid state
The Informative VCS sample prompt currently sets the `__fish_git_prompt_char_conflictedstate` variable which is unused.
It should instead set the `__fish_git_prompt_char_invalidstate` variable.
2018-08-04 13:35:03 -07:00
Guilhem Saurel
994f5c500b update nim.fish sample prompt (#5066)
* update nim.fish sample prompt

- Use an helper function to wrap informations
- Add VIRTUAL_ENV infos, if any
- Add __fish_git_prompt, wrapped for the theme
- Add comments
- Remove ASCII failback symbols for tty
  (no more useful for me, but if someone really needs it, just ask)

* fish.nim: test -n __fish_git_prompt
2018-07-05 22:30:52 +02:00
Fabian Homborg
376a4eca58 Remove ^ redirection from sample prompts
A bunch of these did ^/dev/null. Replace it with 2>/dev/null.

[ci skip]
2018-04-28 18:16:35 +02:00
Mahmoud Al-Qudsi
99ecaec175 Use system web browser under WSL
Launch `cmd.exe /c "start URL"` under WSL for both `fish_config` and
`help`. This works around #4299 but does not address the underlying
issue (#1132).
2018-04-02 18:36:14 -05:00
David Adam
61ab3aea8c webconfig: import webbrowser with empty TERM
Re-introduces the changes from 168d25e780
which were inadvertently removed in
20bcbcc252.

Work on #4299. Re-commit of #1132.
2018-04-02 21:35:10 +08:00
Xavier Lepaul
5648322993 Add required argument to history delete (#4740) 2018-02-25 16:46:25 +01:00
Aaron Bieber
db0ff0bcde Add generic parser for /etc/man.conf
- Also rename get_paths_from_manpath() to get_paths_from_man_locations()
2017-12-12 19:18:47 +01:00
Johan Walles
0e9d52bc41 [Informative VCS Prompt] Print failing exit codes
Before this change, if a command failed, this was indicated by the "$"
at the end of the prompt turning red.

With this change in place, if a command fails, the exit code of the
failing command is displayed in [square brackets].
2017-12-11 10:35:21 +01:00
Mahmoud Al-Qudsi
fa4cf77aff Ignore more invalid arguments from parsed man pages
Specifically closes #4313.
Not being as agressive in what we ignore/blacklist, but can be revisited
easily in the future to add more characters to the argument blacklist.
2017-08-14 18:18:09 -07:00
Mohamed Akram
d2d707a6fa Ignore comments when creating man page completion 2017-07-22 21:32:56 -07:00
Fabian Homborg
e0f0164b16 Quote $USER when used with switch or test
Common in prompts, this would fail if $USER is empty.

See #4229.
2017-07-20 19:45:32 +02:00
Hector Sanjuan
2d42baac35 Fix last status report (it's always 0)
It seems something is overwriting the status before it is
saved to a variable. Fixed by setting the last_status variable
at the very beginning.
2017-06-22 14:01:19 +02:00
ridiculousfish
2f5af733ba Use open instead of webbrowser.open on macOS >= 10.12.5
Works around an osascript bug. Fixes #4035.
2017-05-30 20:53:59 +08:00
David Adam
d3cfab1391 webconfig: apply colour syntax highlighting to functions tab
Closes #1432.
2017-05-03 08:37:27 +10:00
David Adam
1e9caecbcb webconfig: import angular-sanitize module
Enables use of ngBindHtml.

Work on #1432.
2017-05-03 08:37:27 +10:00
David Bishop
2565c5c15b Use $suffix in classic_vcs prompt instead of hardcoding to '>'
Also, ensure that suffix is local in both classic_vcs.fish and informative_vcs.fish.

Fixes #3991
2017-04-26 16:01:52 -07:00
mus0u
b4f70cb98b include exit status indicator in robbyrussell sample prompt 2017-03-13 18:05:49 -07:00
Twinkle
a9617f97b6 enhance git repo for Robbyrussell prompt 2017-02-18 17:11:38 -08:00
Fabian Homborg
b3d5fb71f4 completion generator: Protect against undefined variable
Proc wasn't defined if $MANPATH was used.

Fixes #3808.
2017-02-03 18:32:14 +01:00
Fabian Homborg
94b71353ef completion generator: Define parent_paths directly if MANPATH is set 2017-02-03 18:32:14 +01:00
Fabian Homborg
03e0f1eb21 create_manpage_completions: Try more ways to get manpath
Haiku only has `man --path`.

Still doesn't support OpenBSD.

Use $MANPATH if available. This needs to:

- Ignore stderr (we pipe it and throw it away)

- Read the subprocess returncode, since `man --path` is an existing
  command that fails instead of a non-existent one (that raises an
  exception)

- Properly set up the fallback

Fixes #2194.
2017-01-29 18:00:48 -08:00
mathbunnyru
7a80610300 Delete trailing spaces 2017-01-15 14:57:21 -08:00
Michael Alexander
dcf3d03e54 Implemented Dracula colors 2017-01-11 22:35:15 +08:00
Tim Smith
1a1a9b9927 Prevent error in acidhub prompt by quoting the regex
string errors if this regex isn't quoted. This results in this error:

http://stackoverflow.com/questions/40942185/fish-shell-init-git-repo-yields-constant-terminal-output-after-every-command

Signed-off-by: Tim Smith <tsmith@chef.io>
2016-12-16 10:43:40 -08:00
Kurtis Rader
7bb3bf7c74 fix regression from commit 20bcbcc2
There were two places in the code that used the anti-pattern of
returning True on success else an error message. In python you should
always be able to replace `if x == True:` with just `if x:`. Which is
what the lint tool recommended. Unfortunately I didn't notice how the
return value was being used. This fixes that by changing the two
affected functions to return an error message or None on success.

This also adds `from __future__ import print_function` since the code
uses the `print(msg)` function form rather than the `print msg`
statement form. The former works by accident on python2 because the
parens are interpreted as creating parenthesized expression that
devolves to the single string inside the parens. So while the future
import isn't strictly speaking necessary it will help avoid mistakes in
the future if more complex `print()` calls are added.

Partial fix for #3620
2016-12-04 16:01:32 -08:00
David Adam
41acaced3f webconfig: separate arguments to abbr
`abbr` used to take a single argument and split in on the first space,
but 309e10e7 and predecessors altered this behaviour. Update the web
config use of abbr to the newer format.

Fixes #3620.
2016-12-04 21:32:49 +08:00
Kurtis Rader
20bcbcc252 fix webconfig.py lint issues 2016-11-10 16:23:08 -08:00
Kurtis Rader
47a9f99523 more robust fish_config IPv6 detection
Fixes #3530
2016-11-10 15:43:59 -08:00
Kurtis Rader
c10952c354 lint: fish_indent all sample prompts 2016-11-01 19:19:45 -07:00
Aaron Gyes
edcf15e3d7 Sorin prompt: updates
Use $USER, prompt_hostname, string
Update to use correct color names such as magenta over purple.
Use bright color variants instead of bold in some cases.
2016-10-31 23:41:04 -07:00
Aaron Gyes
9f05697dcc sorin right prompt: reset color at end
bold mode being left enabled was causing issues in the pager.
2016-10-31 23:40:29 -07:00
Kurtis Rader
37d91d0c29 change name of the function 2016-10-23 15:02:14 -07:00
Kurtis Rader
07de13f61f implement a fish_prompt_hostname function
Standardize how the host name is included in the prompts that do so.

Fixes #3480
2016-10-23 14:20:54 -07:00
Kurtis Rader
f33ece11ac simplify invoking create_manpage_completions.py
My previous change to avoid creating a *.pyc file when running
create_manpage_completions.py was wrong because I put the
`sys.dont_write_bytecode = True` on the wrong line. Rather than simply
move that statement make the simpler, cleaner, fix that removes the need
for `eval` where that program is invoked.
2016-10-09 18:42:55 -07:00
Kurtis Rader
92e14d7e4a deal with Linux shebang handling
The Linux kernel only splits on the first whitespace in the shebang line
(unlike BSD which splits on all whitespace). Which means there can be
only one argument after the path to the program.
2016-10-09 15:09:44 -07:00
Kurtis Rader
213ef3ee56 don't produce *.pyc files
Producing man pages is done infrequently (basically just at `make test`
and `make install`) so there isn't any point in writing compiled
byte-code versions of the python modules.
2016-10-09 14:11:04 -07:00
Kurtis Rader
76c73aa8ce alter history sub-command handling
This deprecates the use of long options for history sub-commands (e.g.,
`history --delete`) in favor of proper sub-commands (e.g., `history
delete`). It also eliminates the short options for those sub-commands.

Also change option processing to allow options anywhere on the command
line to match how the vast majority of fish builtins handle flags.

Replace --with-time with --show-time.

Fixes #3367
2016-09-18 20:09:06 -07:00
Aaron Gyes
af95813514 Merge branch 'master' of https://github.com/fish-shell/fish-shell into colorfix 2016-09-10 15:09:12 -07:00
Jin Liu
476ffe12f6 fish_config: fix binding filter regression (#3327) 2016-08-24 01:30:33 -07:00
Jin Liu
4d04125fa1 fish_config: capitalize keynames to match parser output 2016-08-23 18:40:37 +08:00
Jin Liu
ecaba64056 fish_config: show btab as "Shift Tab" in bindings 2016-08-23 18:40:08 +08:00
Jin Liu
4906a5f390 fish_config: fix keybinding parser bugs
1. \r shown as r
2. putty-specific Home/End
3. backspace
4. show unparsable sequence as "unknown-control-sequence"
2016-08-23 18:34:23 +08:00
Jin Liu
f76e620be8 fish_config: filter out uninteresting bindings
currently: self-insert and 'begin;end'
2016-08-23 17:34:21 +08:00
Jin Liu
bfee664af3 fish_config: group bindings by command, show raw binding commands on click 2016-08-23 17:10:30 +08:00
Jin Liu
ccd62ff44b Bug fix: fish_config/bindings display ESC as "ALT-e"
Fixes #3286
2016-08-04 12:39:32 -07:00
Aaron Gyes
e75fc8452f Strip out brackets from generated-by-manpage completions.
Handles cases like cupsctl --\[no-\]remote-admin and
unxz --powerpc[ better.

Fixes #3272
2016-07-30 22:01:59 -07:00
Aaron Gyes
3669805627 Improve compatibility with 0-16 color terminals.
Fish assumed that it could use tparm to emit escapes to set colors
as long as the color was under 16 or max_colors from terminfo was 256::

 if (idx < 16 || term256_support_is_native()) {
    // Use tparm to emit color escape
    writembs(tparm(todo, idx);

If a terminal has max_colors = 8, here is what happenened, except
inside fish:

 > env TERM=xterm tput setaf 7 | xxd
   00000000: 1b5b 3337 6d                             .[37m
 > env TERM=xterm tput setaf 9 | xxd
   00000000: 1b5b 3338 6d                             .[39m

The first escape is good, that second escape is not valid.
Bright colors should start at \e[90m:

 > env TERM=xterm-16color tput setaf 9 | xxd
   00000000: 1b5b 3931 6d                             .[91m

This is what caused "white" not to work in #3176 in Terminal.app, and
obviously isn't good for real low-color terminals either.

So we replace the term256_support_is_native(), which just checked if
max_colors is 256 or not, with a function that takes an argument and
checks terminfo for that to see if tparm can handle it. We only use this
test, because otherwise, tparm should be expected to output garbage:

 /// Returns true if we think tparm can handle outputting a color index
 static bool term_supports_color_natively(unsigned int c) { return max_colors >= c; }
...

 if (term_supports_color_natively(idx) {

And if terminfo can't do it, the "forced" escapes no longer use the fancy
format when handling colors under 16, as this is not going to be compatible with
low color terminals. The code before used:

 else {
     char buff[16] = "";
     snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);

I added an intermediate format for colors 0-15:

 else {
     // We are attempting to bypass the term here. Generate the ANSI escape sequence ourself.
     char buff[16] = "";
     if (idx < 16) {
         snprintf(buff, sizeof buff, "\x1b[%dm", ((idx > 7) ? 82 : 30) + idx + !is_fg * 10);
     } else {
         snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);
     }

Restores harmony to white, brwhite, brblack, black color names.
We don't want "white" to refer to color color #16, but to the
standard color #8. #16 is "brwhite".

Move comments from output.h to output.cpp

Nuke the config.fish set_color hack for linux VTs.

Sync up our various incomplete color lists and fix all color values.
Colors 0-8 are assumed to be brights - e.g. red was FF0000. Perplexing!

Using this table:
 <http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html>

Fixes #3176
2016-07-24 17:02:29 -07:00
Aaron Gyes
d252704fdb checkout non-empty colorutils.js
The last commit was obviously an error!
2016-07-23 17:18:10 -07:00
Aaron Gyes
dfe363c945 clang-format colorutils.js
.... should make the #3260 diff shorter.
2016-07-23 17:03:32 -07:00
Aaron Gyes
d895f876b4 Fix "UNINDENT ..." junk in manpage completions
Problem with Type2ManParser

before:
    complete -c xcode-select -s h -l help --description 'Prints the usage
message. UNINDENT NDENT 0. 0.'
after:
    complete -c xcode-select -s h -l help --description 'Prints the
usage message.'
2016-07-09 07:19:15 -07:00
Aaron Gyes
bb6ce9d142 minor create_manpage_completions.py improvements
Don't truncate long lines with " [See Man Page]" suffix - use the
reclaimed 15 characters for more-useful usage info.

Improve the --verbose output with:
 - spacing fixes
 - diagnostics related to input print repr()/quoted as %r to be less
   confusing.
 - get rid of stupid name() and use type()/__class__.__name__,

- Always use new-style (new as in post python 2.2) classes so this
  behaves the same whether we run in python 2 or 3.

- Properly convert left-quotes and right-quotes to that character in
  deroff.py
2016-07-09 05:51:32 -07:00
Aaron Gyes
f04644f749 Lossless recompress of images with pngcrush+zopfli
And tweak RTF.
2016-06-18 10:03:26 -07:00
Andreas Wagner
3d19b549c8 Fix utf-8 decoding error in file_is_overwritable of create_manpage_completions.py 2016-05-29 14:12:32 -07:00
Aaron Gyes
00e32a0909 Use fonts found on terminals for the web config.
Instead of just using Courier New across the board, have the
browser try several likely available fonts before defaulting
to the system's "monospace".

Thanks @MarkGriffiths
Fixes #2924
2016-05-18 11:21:14 -07:00
CoolOppo
3daccf3c22 fix typo in webconfig.py comment 2016-05-11 19:51:08 -07:00
Vladimír Čunát
100eef4e42 docs: fix location of generated_completions (#3010) 2016-05-08 13:51:30 +02:00
Aaron Gyes
36691df6fe Stringify many completions and functions, with --invert stringification.
I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.

Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
2016-04-08 10:49:29 +08:00
Fabian Homborg
dedc7f6f03 Fix acpi check in nim prompt 2016-03-20 12:20:39 +01:00
Fabian Homborg
de0349399c robbyrussell prompt: Check for git/hg existence
Fixes #2826
2016-03-20 12:17:00 +01:00
ridiculousfish
e3968ba872 Remove "w/o Background Color" text from Set Theme button in fish_config
This is important information but the Set button is the wrong place to
put it.
2016-03-02 15:02:28 -08:00
ridiculousfish
d7f38a0802 Tweak language and styling of background color text in fish_config 2016-01-14 23:16:34 -08:00
Kurtis Rader
a77ce393ba respond to feedback 2016-01-14 22:34:25 -08:00
Kurtis Rader
f8ed1d182e improve set_color and theme color documentation
This is meant to make it clear that fish cannot control the terminal
window background color. It also augments the set_color documentation to
describe how it decides which color the terminal can display.

Resolves #2421.
Resolves #2184.
2016-01-14 22:34:25 -08:00
Fabian Homborg
4f519297dd Add new named colors to webconfig
The 'br' variants were added in 0a0acc8, but not to named_colors in
webconfig.py.

Fix this oversight.
2016-01-08 14:00:54 +01:00
Fabian Homborg
482cfca84f Make informative_git prompt use vcs_prompt -> Rename it to "Informative Vcs" 2015-12-16 19:05:28 +01:00
Fabian Homborg
e29d200ba5 Switch classic + git prompt to all vcsen -> Rename it to Classic + Vcs
Keep the variable names for now.
2015-12-16 19:05:28 +01:00
Fabian Homborg
43c7ababf9 Make lonetwin prompt use __fish_vcs_prompt 2015-12-16 19:05:28 +01:00
Alexander Hedges
32d54e37f7 Use unused cleanup_autogenerated_file 2015-11-08 12:19:15 -08:00
Alexander Hedges
2bbad22248 Remove autogenerated files before generating the new ones
Currently if there is a conflict with two manpages having the same
name, one completion will override the other. But if one can be parsed
and the other can't the one with parsed results will always have a
higher priority.
2015-11-08 12:19:15 -08:00
Alexander Hedges
22493c9df8 Guard against files that don't end in .[1...9]
It seems smart to only let files be parsed that are clearly
manpage files. Other files wouldn't be openend by man so
I think it is safe to guess that only these files are man
pages.
2015-11-08 12:19:15 -08:00
Alexander Hedges
8d97a85834 Ignore references to builtin on the mac
On my system (OS-X 10.11) references to builtin are denoted by:
".so man1/builtin.1". So you also need to check against that.
2015-11-08 12:19:15 -08:00
David Adam
b776327b9d Revert "prompts: more concise way of getting the hostname."
This reverts commit 233c443694.

See discussion in https://github.com/fish-shell/fish-shell/pull/2489
2015-10-16 07:01:12 +08:00
Michael Fogleman
233c443694 prompts: more concise way of getting the hostname. 2015-10-15 11:59:39 +08:00
Wonicon
4f3ff3d77f Correct the comment on the default path
According to the newer code below:
    xdg_data_home = os.getenv('XDG_DATA_HOME', '~/.local/share')
the actual default path is ~/.local/share/fish/generated_completions/
2015-09-26 15:23:45 +02:00
Fabian Homborg
c8ac48ff9a Informative git prompt: Handle root/toor users
Fixes #961

This should probably be in a helper function
2015-09-15 21:14:49 +02:00
Fabian Homborg
7fe8a63f53 Webconfig: It's abbr --erase, not abbr --remove
This was renamed in c0cf25cf0b but never
in webconfig.
2015-09-13 22:35:32 +02:00
Fabian Homborg
48874294d6 Webconfig: abbr doesn't support "--"
Fixes #2276
2015-09-13 22:35:32 +02:00
Fabian Homborg
60089f9750 Remove setup outside of fish_prompt from sample prompts
This doesn't work with fish_config.

For terlar and pythonista, remove unnecessary color setting.

For informative+git and pythonista, move variable setup into fish_prompt

Fixes #1141
2015-08-31 21:27:44 +02:00
ridiculousfish
2b87705a46 Remove vi mode indicator from classic_git prompt
It is duplicative of the fish_mode_prompt function

Fixes #2228
2015-08-18 10:52:53 -07:00
Fabian Homborg
b615534d8d Fix sorin prompt, remove fallback
Closes #2243
2015-08-16 22:51:49 +02:00
ridiculousfish
9cf2bb18c2 pngquant delete.png, saving ~1.4 KB 2015-07-12 15:09:24 -07:00
Jonathan Chan
4b8febd44e Add favicon for web config 2015-07-12 15:06:56 -07:00
Fernando Manfredi
1e32f9431d 👍 New sample prompt from Acidhub
New sample prompt from Acidhub (github.com/acidhub)
This prompt show user|path (full), and a small symbol to
show last command status.

If in a git repository, it's show after the path several
symbols to indicate the branch status and the branch name.

Very handy to me so far.

Signed-off-by: Fernando Manfredi <contact@acidhub.click>
2015-07-12 14:22:18 -07:00
ridiculousfish
a4d6a104a6 Correct name and author fields to be lowercase in sorin prompt
fish_config requires that these fields be lowercase, otherwise
they won't show up in the prompt list.
2015-06-23 15:58:56 -07:00
Ivan Tham
a150ae76ac Add sorin theme 2015-06-23 15:46:16 -07:00
ridiculousfish
4115a2f2d1 Tweak and add tests for abbr
1. When run with no arguments, make abbr do the equivalent
   of `abbr --show`
2. Enable "implicit add", e.g. `abbr gco git checkout`
3. Teach `abbr --show` to not use quotes for simple cases
4. Teach abbr to output -- when the abbreviation has
   leading dashes

Add some basic tests to abbr too.
2015-06-14 14:12:29 -07:00
ridiculousfish
0ddd0ed4fb fish_config to select the proper tab when run with a tab name
`fish_config abbr` should show "abbreviations" selected
in the tab list.
2015-06-14 00:10:11 -07:00
ridiculousfish
2d1331e104 Tweak the styling of the abbreviation editor
Removes the big white block of the input fields.
2015-06-13 22:56:45 -07:00
ridiculousfish
9223b643b6 Use --remove instead of -e when erasing abbreviations from fish_config
Updates fish_config to use the correct argument to abbr
2015-06-13 22:56:01 -07:00
David Adam
c0cf25cf0b abbr: rename --remove to --erase
for consistency with other fish commands

Closes #2071.
2015-05-22 09:48:39 +08:00
ridiculousfish
a83323705d Make fish_config work correctly when IPv6 is disabled in the kernel
Fixes #1754
2015-05-17 19:13:50 -07:00
Brendan Whitfield
9b5026f7e5 added cursor:pointer to master_element in web_config css 2015-05-03 17:33:25 +08:00
ridiculousfish
879d03d0fe Reset the color after printing the CWD in classic+git prompt
Fixes #2034
2015-04-23 17:53:40 -07:00
ridiculousfish
e896acffd7 Use $PWD instead of (pwd) in sample prompt
This improves the case where the working directory has vanished

Fixes #1857
2015-03-24 17:03:40 -07:00
LoveIsGrief
df6f1e8f62 Add hg branch and status to terlar's prompt 2015-01-30 23:07:40 +08:00
David Adam
78dfc57b1e web_config: set new prompts via JSON instead of URI-encoded
Fixes problems with encoding and decoding Unicode from URL-encoded strings,
which was impossible to get right in Python 2.
2015-01-30 22:54:13 +08:00
David Adam
d17ba69f9e web_config: respect the client's character set for JSON 2015-01-30 22:52:41 +08:00
David Adam
5c16b5598b web_config: fix python2/3 unification for parse_qs 2015-01-30 22:52:07 +08:00
David Adam
53a4814d8b web_config: respect linebreaks in prompt demos 2015-01-29 21:41:31 +08:00
volnt
390fe05a87 Update pythonista.fish: make virtualenv aware that prompt is set
Closes #1823, closes #1795.

Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
2014-12-28 19:28:12 +08:00
Konrad Borowski
9a34df604d Make fish_config handle no LANG variable set.
Fixes #1849.
2014-12-05 21:39:21 +01:00
David Adam
9aaf93f364 web_config: improve abbreviations support
* Fetch abbreviations by reading the variable directly.
 * Use space separators for writing new abbreviations.

Work on #731.
2014-11-16 23:20:27 +08:00
David Adam
a7bab7b18b abbr/web_config: support space-delimited abbreviations
Support for space-delimited abbreviations was added to the expansion
parser in fbade198; this commit extends that support to the user-facing
tools, and documents the space-separated behaviour. Equals-delimited
abbreviations are expected to be removed before the next release.

Work on #731.
2014-11-15 23:48:40 +08:00
Pawel Zubrycki
c84cdcd00c Added hg repo status to robbyrussell example prompt 2014-10-26 16:00:12 +08:00
David Adam
a64c372a28 web_config: add support for adding and editing abbreviations
Possible future enhancements include explanatory text and an image for
the 'save' action.

Work on #731.
2014-10-17 10:28:26 +08:00
David Adam
1f91a2a6f5 web_config: map nonexistent post requests to 404 2014-10-17 10:28:26 +08:00
David Adam
4140e678f4 web_config: further python2/3 unification 2014-10-12 16:04:40 +08:00
David Adam
cc0fcdc18d web_config: use only Python 3-style (Unicode) string literals
Improves Python 2/3 compatibility.
(It is the distant future, the year TWO THOUSAND.)
2014-10-12 15:48:14 +08:00
Kevin Ballard
cc7f1755aa web_config: Interpret fish output as utf-8
Use the unicode replacement character in place of non-utf-8 sequences.
2014-10-09 20:21:26 -07:00
Kevin Ballard
7493c9a040 fish_config: Log the path for errors 2014-10-09 18:33:59 -07:00
David Adam
71c55e1a4a web_config: send correct MIME type (and actually send it) 2014-10-09 18:45:17 +08:00
David Adam
3f0210dc96 web_config: fix output if no abbreviations defined 2014-10-07 12:21:02 +08:00
David Adam
7764a1a6f8 web_config: add support for viewing abbreviations
Add a new tab which lists the current abbreviations defined, by wrapping
the `abbr` command.

Work on #731.
2014-10-05 12:23:31 +08:00
David Adam
980bf6e2f4 web_config: set width to dynamic 80% of window
As we add more tabs, 800px looks increasingly cramped, and our config
should take advantage of the screen space available.
2014-10-05 12:23:31 +08:00
David Adam
6a0931aeae web_config: update AngularJS to 1.0.8 2014-10-05 12:23:31 +08:00
Kevin Ballard
3f11d90744 # This is a combination of 2 commits.
# The first commit's message is:

Simplify default fish_prompt

No need for the set_color caching now that it's a builtin.

Also simplify the 3 classic prompts in fish_config's sample_prompts set.
2014-10-02 18:41:01 -07:00
David Adam
a186f04f15 Manpage completions: store in $XDG_DATA_HOME
Closes #1343, works towards #1257.
2014-09-29 19:39:36 +08:00
Konrad Borowski
8d03baa4e0 Make fish config work if one of colors is undefined.
This moves the sorting to be done before sorting remaining colors.
2014-09-23 13:48:00 +02:00
ridiculousfish
6083c6fc72 Incorporate attribute links for color themes in web_config 2014-09-19 18:44:50 -07:00
qjcg
9bfb4f1e11 Fix webconfig URL generation for python3
Closes #1677.

Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
2014-09-15 16:40:28 +08:00
ridiculousfish
f9f773cc28 Comment on why we run 'false' in web_config.py 2014-08-22 12:04:23 -07:00
Kevin Ballard
d9bf53c6e5 Show a non-zero status in the fish_config prompt
When selecting a prompt with fish_config, render the prompt with a
non-zero status so the user knows what it looks like.
2014-08-22 12:00:16 -07:00
Andy Lutomirski
9079ec459c webconfig: fixes for token security
* Use 16-byte tokens
 * Use os.urandom (random.getrandbits shouldn't be used for security)
 * Convert to hex correctly
2014-08-22 15:44:43 +08:00
Andy Lutomirski
aaddccfdb1 webconfig: Use a constant-time token comparison
This prevents a linear-time attack to recover the auth token.
2014-08-22 15:39:13 +08:00
David Adam
4ae2753025 Authenticate connections to web_config service
- Require all requests to use a session path.
 - Use a redirect file to avoid exposing the '/start' URL on the
   command line, as it contains the cookie value.

Fix for CVE-2014-2914.
Closes #1438.
2014-08-04 13:34:26 +08:00
Konrad Borowski
6c80a3461c
Add support for toor account.
Currently fish doesn't recognize toor as special. However, it's likely
that on BSD systems, fish shell will be used on toor, not on root (toor
is an intentionally existing account to use more advanced shell on, like
shell).
2014-07-30 11:55:47 +02:00
ridiculousfish
b6658c5497 Render sample prompts faster in fish_config by using a thread pool 2014-07-29 12:12:32 -07:00
ridiculousfish
aad5163b49 Make prompt selection more like color selection in fish_config. Remove
the "show prompt source" button.
2014-07-29 11:00:39 -07:00
David Xia
adabc2d7a0 Fix fish_config error with python3
Closes #1253.
2014-07-28 22:02:55 +08:00
Siteshwar Vashisht
317660c2fe Avoid using OptionParser to parse bindings in webconfig.py
OptionParser eats commaandline arguments passed to bind actions, so avoid using it.
2014-07-25 08:39:31 +05:30
ridiculousfish
f6a89d13c2 Merge branch 'master' of github.com:fish-shell/fish-shell 2014-07-23 22:27:37 -07:00
Siteshwar Vashisht
3e01dd955f Updated code to parse bindings in webconfig.py 2014-07-23 01:53:15 +05:30
adisbladis
27fa0ea9d7 "webconfig.py: Don't allow NoneType as buffer, fallback to bytes.
Fixes TypeErrors when using bindings tab"
2014-07-22 12:31:57 +02:00
Siteshwar Vashisht
7b3132d39d Fixed code to parse bindings for webconfig 2014-06-08 16:05:00 +05:30
Konrad Borowski
d97e31b4ab git prompt shouldn't export variables. 2014-06-01 09:39:28 +02:00
Maurizio De Santis
4285baa6e1 Prompt sample: Debian chroot environment
When you chroot in Debian, bash shows the chroot environment in the prompt:

```bash

...

if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

...
```

This is the effect:

```
(chroot_env) user@host:~#
```

It is useful when chrooting, since usually the hostname remains the same and thus you can't distinguish where you are.
2014-05-03 12:28:38 -07:00
Anders Bergh
44b35f7735 fish_config: Listen on both IPv6 and IPv4.
A subclass of TCPServer was created to deny any non-local connections and to
listen using an IPv6 socket.
2014-03-31 10:06:46 -07:00
Konrad Borowski
6d749789ce Use 127.0.0.1 for fish config.
Before this change, fish config used 0 as its address. However, this
isn't a good idea from security point of view, as web service can be
accessed from everywhere, and do anything on the account it was ran on.

This also deals with firewalls which block the access to 0 even from
the host machine itself. It possibly might fix #673, but I'm not sure.
2014-02-27 14:47:08 +01:00
ridiculousfish
5e7c01c251 Rework color editing in fish_config. Bury customization mode a bit:
initially the user only sees the various themes, and has to activate
customization mode to change colors. Tweak the appearance as well.
2014-02-24 01:56:02 -08:00
ridiculousfish
77dbaf3aef Fix for Python out-of-range exception when accessing Bindings tab 2014-02-09 20:19:04 -08:00
Siteshwar Vashisht
a1b43b7a09 Fix for opening bindings tab as initial tab
'fish_config bindings' command should open bindings tab as initially active tab
2014-01-30 23:53:49 +05:30
Konrad Borowski
2927514e68 Partially fix #1224.
It would be nice if this would work without this hack,
but until then, this has to work. Requires you to reinstall
the prompt using fish configuration system.
2014-01-10 21:33:50 +01:00
Siteshwar Vashisht
646180518a Minor fixes in the colors tab
* Show color scheme title in preview box
* Show information about setting terminal background color on Apply
button mouse hover
* Added text_color_for_color method in colors controller scope
2013-12-07 13:12:43 +05:30
Siteshwar Vashisht
659541f4a5 Merge branch 'master' into fish_config_angular 2013-12-07 09:50:59 +05:30
Konrad Borowski
591abd340b Fix bold in informative git prompt.
Currently this fix is useless, as web config cannot apply variables,
but in future, it could be more useful.
2013-11-27 11:41:13 +01:00
d10n
168d25e780 Do not open CLI browsers when using fish_config.
From the Python webbrowser documentation:
"If text-mode browsers are used, the calling process will block until the user exits the browser."

Running fish_config on an ssh server with no GUI browser will open a CLI browser which blocks and stops the server from handling requests.
Using multiprocess to run the server in the background lets CLI browsers access the page, but the page is unusable.

For now, disable CLI browsers and recommend opening the page in a graphical browser.
In the future, maybe write a CLI utility to change prompts and delete history items.
2013-11-26 00:41:09 -08:00
Siteshwar Vashisht
2271526d2f Do not highlight selected prompt 2013-11-09 23:33:56 +05:30
Siteshwar Vashisht
ea2e1f016f Set current prompt as selected prompt after prompt change 2013-11-09 20:43:19 +05:30
Siteshwar Vashisht
c4aa223698 Changed UI of prompt tab
Show function definition and use button under prompt demo when prompt
demo is selected
2013-11-09 19:30:41 +05:30
Siteshwar Vashisht
63233655f4 Updated fish_config prompt tab 2013-11-09 18:26:44 +05:30
Marc Joliet
fe3bca3a88 Prefer standard library lzma module if available
Prefer the standard library lzma module if available.  This change prevents
using the backports-lzma when it is installed for a version of Python that
already has the lzma module in its standard library.
2013-11-09 19:46:42 +08:00
Siteshwar Vashisht
9e424ed921 Show actual binding if user clicks a binding item 2013-10-27 18:51:50 +05:30
Siteshwar Vashisht
be55d2c57f Updated handling escape character in binding parser 2013-10-25 00:05:26 +05:30
Siteshwar Vashisht
119dd06ea8 Add a one second delay between query input and filtering history 2013-10-22 23:45:32 +05:30
Siteshwar Vashisht
aed26f8c1e Added code for parsing end key 2013-10-22 23:08:30 +05:30
Siteshwar Vashisht
6482fd52fb Moved some color related methods from index.html to colorutils.js 2013-10-22 23:00:38 +05:30
Siteshwar Vashisht
44b091a7c6 Enabled filtering by binding keys 2013-10-22 00:24:15 +05:30
Siteshwar Vashisht
8279a0d477 Display bindings, history and variables in multiple lines on click 2013-10-21 23:42:16 +05:30
Siteshwar Vashisht
7709af7a62 Removed extra spaces while showing function definition 2013-10-21 23:40:43 +05:30
Siteshwar Vashisht
80a48be324 Changed scheme for loading key bindings 2013-10-20 15:03:47 +05:30
Siteshwar Vashisht
bc9e2266be Added current scheme in list of color schemes 2013-10-20 14:28:40 +05:30
Siteshwar Vashisht
ff4d0ce1e1 Moved angular.js to js directory 2013-10-19 23:56:23 +05:30
Siteshwar Vashisht
5d8c776250 Moved all functions related to colors to a separate file 2013-10-19 23:54:51 +05:30