Unfortunately on Debian "open" is a symlink to "openvt", and there's
no way from outside to tell.
This prevents fish from failing because no browser could be found.
* docs: Add "Writing your own prompt" doc
* Remove a space from the "output"
* some teensy adjustments
* Address feedback
* envvar one more PWD
* More html warning
a lynx-internal hash of div.contents collided with em>a which caused
built-in styling to render much of entire pages as emphasized links.
Since switching from doxygen, we haven't had a <div class="contents">
so this workaround is no longer needed.
This looked at __fish_print_commands, which goes via our man pages to
find the commands (it shouldn't, buuut), and exludes a hard-coded list
of pages.
So we do two thigns:
1. We add the other doc pages to the list
2. We check commands *later* - if we listed something explicitly it
should be used
This should add all the sections that aren't linked internally,
including "identifiers".
(also give up on the line breaking because it makes it annoying to do
automatically)
Fixes#8245.
This was semi-automated with
```fish
for file in $argv
set -l varname (string replace -r '.*/(.*).html' '$1' -- $file | string escape --style=var)pages
set -l sections (string replace -rf '.*class="headerlink" href="#([^"]*)".*' '$1' <$file)
echo set -l $varname $sections
end
```
(where $argv contains the path to faq, fish_for_bash_users,
interactive, language and tutorial.html)
Building help.fish at compile time would work, but only for users who
build the docs.
Given that we no longer have that massive "index" page with
everything, it's become harder to open the correct section
immediately.
So this hardcodes the section titles for each page in help itself.
This was half-automated with
grep -o 'a class="headerlink" href="#[^"]*"' /usr/share/doc/fish/faq.html | sort -u | string replace -r '.*#' '' | string trim -c '"'
The completions still need to be adjusted.
Previously, this message told the user to "set $BROWSER and try again". However,
when I first saw this error, I didn't know how I can set `BROWSER` in fish. Moreover,
I often see this error in situations when no browser will work. For instance, I might be
using fish over ssh, and I might either not know whether that system has a text-mode
browser installed or not want to use it.
A further improvement would be to report this message if a browser fails to start.
When `fish` is running in the Chrome OS Linux VM (Crostini),
both `help` and `fish_config` opened a "file not found"
page. That is because on Crostini, `BROWSER` is usually set to
`garcon-url-handler`, which opens URLs in the host OS Chrome
browser. That browser lacks access to the Linux file system.
This commit fixes these commands. `help` now opens the URL on
www.fishshell.com. `fish_config` now opens the URL for the
server it starts. Previously, it opened a local file that
redirects to the same URL.
In the case of `help`, the situation could be improved further
by starting a web server to serve help. I don't know of another
way to access `/share/fish` from outside the VM without user
intervention, and I think that might be a part of the security
model for the Crostini VM.
It's hard to write a test for this. I checked that `help math`,
`python2 webconfig.py`, and `python3 webconfig.py` work on my
machine running in Crostini.
__fish_print_commands just prints the commands we have man pages for,
and help uses that to figure out whether it should link
a command or a section. If the docs aren't installed it won't find
anything.
At least check the builtins, because we document them and it's easy.
This probably needs to be added at build time - glob
doc_src/cmds/*.rst.
As mentioned in 5b706faa73, bare
`disown` has a problem: It disowns the last *existing* job.
Unfortunately, it's easy to see cases where that won't happen:
sleep 5m &
/bin/true & # will exit immediately
disown # will most likely disown *sleep*, not true
So what we do is to pass $last_pid.
In help especially this is likely to occur because many graphical
browsers fork immediately to avoid blocking the terminal (we only
added the backgrounding and disown because some weren't).
Note that it's *possible* this doesn't occur if used in the same
function, but I don't want to rely on those semantics.
It might be worth doing this as the default - see #7210.
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.
Like... lemme just add a break if it looks better, will you?
But it is the style at this time, so we shall tie an onion to our
belt.
* Fix#7113 (cannot call help using msys2), correct a few regexes.
* Use regex instead of glob-style matching
* Match `\.exe$` instead of `cmd\.exe$` for WSL
* Match `\.exe(\s+|$)` instead of `\.exe$` and `cmd\.exe$`
* Fix a few regexes
This allows cygstart to be manually set as a browser, with or without arguments
The completions for help know many more help topics, it makes no sense
to whitelist them here.
Fix anchor links for tutorial sections.
Remove some dead code: the "man" branch was unreachable because of the
earlier (__fish_print_commands) case.
Even if $DISPLAY is unset, xdg-open can be useful, and on systems that
have xdg-open, "open" is most likely some god awful outdated thing
called "openvt" elsewhere.
Fixes#6739
[ci skip]
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.