mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 22:21:15 -03:00
Merge branch 'master' into rewrite/webconfig-to-alpinejs
This commit is contained in:
@@ -245,7 +245,7 @@ def remove_groff_formatting(data):
|
||||
data = data.replace("\\fB", "")
|
||||
data = data.replace("\\fR", "")
|
||||
data = data.replace("\\e", "")
|
||||
data = re.sub(".PD( \d+)", "", data)
|
||||
data = re.sub(r".PD( \d+)", "", data)
|
||||
data = data.replace(".BI", "")
|
||||
data = data.replace(".BR", "")
|
||||
data = data.replace("0.5i", "")
|
||||
@@ -253,14 +253,19 @@ def remove_groff_formatting(data):
|
||||
data = data.replace("\\^", "")
|
||||
data = data.replace("{ ", "")
|
||||
data = data.replace(" }", "")
|
||||
data = data.replace("\ ", "")
|
||||
data = data.replace("\-", "-")
|
||||
data = data.replace("\&", "")
|
||||
data = data.replace(r"\ ", "")
|
||||
data = data.replace(r"\-", "-")
|
||||
data = data.replace(r"\&", "")
|
||||
data = data.replace(".B", "")
|
||||
data = data.replace("\-", "-")
|
||||
data = data.replace(r"\-", "-")
|
||||
data = data.replace(".I", "")
|
||||
data = data.replace("\f", "")
|
||||
data = data.replace("\(cq", "'")
|
||||
data = data.replace(r"\(oq", "'")
|
||||
data = data.replace(r"\(cq", "'")
|
||||
data = data.replace(r"\(aq", "'")
|
||||
data = data.replace(r"\(dq", '"')
|
||||
data = data.replace(r"\(lq", '"')
|
||||
data = data.replace(r"\(rq", '"')
|
||||
return data
|
||||
|
||||
|
||||
@@ -274,13 +279,13 @@ class ManParser(object):
|
||||
|
||||
class Type1ManParser(ManParser):
|
||||
def is_my_type(self, manpage):
|
||||
return compile_and_search('\.SH "OPTIONS"(.*?)', manpage) is not None
|
||||
return compile_and_search(r'\.SH "OPTIONS"(.*?)', manpage) is not None
|
||||
|
||||
def parse_man_page(self, manpage):
|
||||
options_section_regex = re.compile('\.SH "OPTIONS"(.*?)(\.SH|\Z)', re.DOTALL)
|
||||
options_section_regex = re.compile(r'\.SH "OPTIONS"(.*?)(\.SH|\Z)', re.DOTALL)
|
||||
options_section = re.search(options_section_regex, manpage).group(1)
|
||||
|
||||
options_parts_regex = re.compile("\.PP(.*?)\.RE", re.DOTALL)
|
||||
options_parts_regex = re.compile(r"\.PP(.*?)\.RE", re.DOTALL)
|
||||
options_matched = re.search(options_parts_regex, options_section)
|
||||
add_diagnostic("Command is %r" % CMDNAME)
|
||||
|
||||
@@ -320,7 +325,7 @@ class Type1ManParser(ManParser):
|
||||
|
||||
def fallback(self, options_section):
|
||||
add_diagnostic("Trying fallback")
|
||||
options_parts_regex = re.compile("\.TP( \d+)?(.*?)\.TP", re.DOTALL)
|
||||
options_parts_regex = re.compile(r"\.TP( \d+)?(.*?)\.TP", re.DOTALL)
|
||||
options_matched = re.search(options_parts_regex, options_section)
|
||||
if options_matched is None:
|
||||
add_diagnostic("Still not found")
|
||||
@@ -349,9 +354,9 @@ class Type1ManParser(ManParser):
|
||||
|
||||
def fallback2(self, options_section):
|
||||
add_diagnostic("Trying last chance fallback")
|
||||
ix_remover_regex = re.compile("\.IX.*")
|
||||
ix_remover_regex = re.compile(r"\.IX.*")
|
||||
trailing_num_regex = re.compile("\\d+$")
|
||||
options_parts_regex = re.compile("\.IP (.*?)\.IP", re.DOTALL)
|
||||
options_parts_regex = re.compile(r"\.IP (.*?)\.IP", re.DOTALL)
|
||||
|
||||
options_section = re.sub(ix_remover_regex, "", options_section)
|
||||
options_matched = re.search(options_parts_regex, options_section)
|
||||
@@ -386,14 +391,14 @@ class Type1ManParser(ManParser):
|
||||
|
||||
class Type2ManParser(ManParser):
|
||||
def is_my_type(self, manpage):
|
||||
return compile_and_search("\.SH OPTIONS(.*?)", manpage) is not None
|
||||
return compile_and_search(r"\.SH OPTIONS(.*?)", manpage) is not None
|
||||
|
||||
def parse_man_page(self, manpage):
|
||||
options_section_regex = re.compile("\.SH OPTIONS(.*?)(\.SH|\Z)", re.DOTALL)
|
||||
options_section_regex = re.compile(r"\.SH OPTIONS(.*?)(\.SH|\Z)", re.DOTALL)
|
||||
options_section = re.search(options_section_regex, manpage).group(1)
|
||||
|
||||
options_parts_regex = re.compile(
|
||||
"\.[IT]P( \d+(\.\d)?i?)?(.*?)\.([IT]P|UNINDENT|UN|SH)", re.DOTALL
|
||||
r"\.[IT]P( \d+(\.\d)?i?)?(.*?)\.([IT]P|UNINDENT|UN|SH)", re.DOTALL
|
||||
)
|
||||
options_matched = re.search(options_parts_regex, options_section)
|
||||
add_diagnostic("Command is %r" % CMDNAME)
|
||||
@@ -426,13 +431,13 @@ class Type2ManParser(ManParser):
|
||||
|
||||
class Type3ManParser(ManParser):
|
||||
def is_my_type(self, manpage):
|
||||
return compile_and_search("\.SH DESCRIPTION(.*?)", manpage) != None
|
||||
return compile_and_search(r"\.SH DESCRIPTION(.*?)", manpage) != None
|
||||
|
||||
def parse_man_page(self, manpage):
|
||||
options_section_regex = re.compile("\.SH DESCRIPTION(.*?)(\.SH|\Z)", re.DOTALL)
|
||||
options_section_regex = re.compile(r"\.SH DESCRIPTION(.*?)(\.SH|\Z)", re.DOTALL)
|
||||
options_section = re.search(options_section_regex, manpage).group(1)
|
||||
|
||||
options_parts_regex = re.compile("\.TP(.*?)\.TP", re.DOTALL)
|
||||
options_parts_regex = re.compile(r"\.TP(.*?)\.TP", re.DOTALL)
|
||||
options_matched = re.search(options_parts_regex, options_section)
|
||||
add_diagnostic("Command is %r" % CMDNAME)
|
||||
|
||||
@@ -467,15 +472,15 @@ class Type3ManParser(ManParser):
|
||||
|
||||
class Type4ManParser(ManParser):
|
||||
def is_my_type(self, manpage):
|
||||
return compile_and_search("\.SH FUNCTION LETTERS(.*?)", manpage) != None
|
||||
return compile_and_search(r"\.SH FUNCTION LETTERS(.*?)", manpage) != None
|
||||
|
||||
def parse_man_page(self, manpage):
|
||||
options_section_regex = re.compile(
|
||||
"\.SH FUNCTION LETTERS(.*?)(\.SH|\Z)", re.DOTALL
|
||||
r"\.SH FUNCTION LETTERS(.*?)(\.SH|\Z)", re.DOTALL
|
||||
)
|
||||
options_section = re.search(options_section_regex, manpage).group(1)
|
||||
|
||||
options_parts_regex = re.compile("\.TP(.*?)\.TP", re.DOTALL)
|
||||
options_parts_regex = re.compile(r"\.TP(.*?)\.TP", re.DOTALL)
|
||||
options_matched = re.search(options_parts_regex, options_section)
|
||||
add_diagnostic("Command is %r" % CMDNAME)
|
||||
|
||||
@@ -518,7 +523,7 @@ class TypeScdocManParser(ManParser):
|
||||
)
|
||||
|
||||
def parse_man_page(self, manpage):
|
||||
options_section_regex = re.compile("\.SH OPTIONS(.*?)\.SH", re.DOTALL)
|
||||
options_section_regex = re.compile(r"\.SH OPTIONS(.*?)\.SH", re.DOTALL)
|
||||
options_section_matched = re.search(options_section_regex, manpage)
|
||||
if options_section_matched is None:
|
||||
return False
|
||||
@@ -568,14 +573,14 @@ class TypeScdocManParser(ManParser):
|
||||
|
||||
class TypeDarwinManParser(ManParser):
|
||||
def is_my_type(self, manpage):
|
||||
return compile_and_search("\.S[hH] DESCRIPTION", manpage) is not None
|
||||
return compile_and_search(r"\.S[hH] DESCRIPTION", manpage) is not None
|
||||
|
||||
def trim_groff(self, line):
|
||||
# Remove initial period
|
||||
if line.startswith("."):
|
||||
line = line[1:]
|
||||
# Skip leading groff crud
|
||||
while re.match("[A-Z][a-z]\s", line):
|
||||
while re.match(r"[A-Z][a-z]\s", line):
|
||||
line = line[3:]
|
||||
|
||||
# If the line ends with a space and then a period or comma, then erase the space
|
||||
@@ -600,7 +605,8 @@ class TypeDarwinManParser(ManParser):
|
||||
def groff_replace_escapes(self, line):
|
||||
line = line.replace(".Nm", CMDNAME)
|
||||
line = line.replace("\\ ", " ")
|
||||
line = line.replace("\& ", "")
|
||||
line = line.replace(r"\& ", "")
|
||||
line = line.replace(".Pp", "")
|
||||
return line
|
||||
|
||||
def is_option(self, line):
|
||||
@@ -787,6 +793,26 @@ def parse_manpage_at_path(manpage_path, output_directory):
|
||||
if CMDNAME in ignoredcommands:
|
||||
return
|
||||
|
||||
# Ignore some commands' gazillion man pages
|
||||
# for subcommands - especially things we already have
|
||||
ignored_prefixes = [
|
||||
"bundle-",
|
||||
"cargo-",
|
||||
"ffmpeg-",
|
||||
"flatpak-",
|
||||
"git-",
|
||||
"npm-",
|
||||
"openssl-",
|
||||
"ostree-",
|
||||
"perf-",
|
||||
"perl",
|
||||
"pip-",
|
||||
"zsh",
|
||||
]
|
||||
for prefix in ignored_prefixes:
|
||||
if CMDNAME.startswith(prefix):
|
||||
return
|
||||
|
||||
# Clear diagnostics
|
||||
global diagnostic_indent
|
||||
diagnostic_output[:] = []
|
||||
@@ -825,18 +851,14 @@ def parse_manpage_at_path(manpage_path, output_directory):
|
||||
|
||||
manpage = str(manpage)
|
||||
|
||||
# Ignore perl's gazillion man pages
|
||||
ignored_prefixes = ["perl", "zsh"]
|
||||
for prefix in ignored_prefixes:
|
||||
if CMDNAME.startswith(prefix):
|
||||
return
|
||||
|
||||
# Ignore the millions of links to BUILTIN(1)
|
||||
if "BUILTIN 1" in manpage or "builtin.1" in manpage:
|
||||
return
|
||||
|
||||
# Clear the output list
|
||||
built_command_output[:] = []
|
||||
global already_output_completions
|
||||
already_output_completions = {}
|
||||
|
||||
if DEROFF_ONLY:
|
||||
parsers = [TypeDeroffManParser()]
|
||||
|
||||
@@ -8,7 +8,6 @@ IS_PY3 = sys.version_info[0] >= 3
|
||||
|
||||
|
||||
class Deroffer:
|
||||
|
||||
g_specs_specletter = {
|
||||
# Output composed latin1 letters
|
||||
"-D": "\320",
|
||||
@@ -1058,7 +1057,6 @@ class Deroffer:
|
||||
# deroff.c has a bug where it can loop forever here...we try to work around it
|
||||
self.skip_char()
|
||||
else: # Parse option
|
||||
|
||||
option = self.s
|
||||
arg = ""
|
||||
|
||||
|
||||
@@ -664,3 +664,7 @@ img.delete_icon {
|
||||
color: #AAA;
|
||||
}
|
||||
}
|
||||
|
||||
.print_only {
|
||||
display: none;
|
||||
}
|
||||
|
||||
30
share/tools/web_config/fishconfig_print.css
Normal file
30
share/tools/web_config/fishconfig_print.css
Normal file
@@ -0,0 +1,30 @@
|
||||
body {
|
||||
background: white;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
.tab, .print_hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab.selected_tab {
|
||||
background: white;
|
||||
display: block;
|
||||
font-size: 22pt;
|
||||
font-weight: bold;
|
||||
padding-left: 14pt;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.print_only {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
.data_table_cell {
|
||||
border-bottom: #dbdbdb 1pt solid;
|
||||
}
|
||||
|
||||
#ancestor {
|
||||
width: 100%;
|
||||
box-shadow: none;
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
<title>fish shell configuration</title>
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link rel="stylesheet" type="text/css" href="fishconfig.css" />
|
||||
<link rel="stylesheet" type="text/css" media="print" href="fishconfig_print.css">
|
||||
<script type="text/javascript" src="js/colorutils.js" defer></script>
|
||||
<script type="text/javascript" src="js/main.js" defer></script>
|
||||
<script type="text/javascript" src="js/alpine.js" defer></script>
|
||||
@@ -29,7 +30,7 @@
|
||||
<a :class="{'tab': true, 'selected_tab': currentTab == 'history'}" id="tab_history"
|
||||
@click="currentTab = 'history'">history</a>
|
||||
<a :class="{'tab': true, 'selected_tab': currentTab == 'bindings'}" id="tab_bindings"
|
||||
@click="currentTab = 'bindings'">bindings</a>
|
||||
@click="currentTab = 'bindings'"><span class="print_only">fish shell </span>bindings</a>
|
||||
</div>
|
||||
<div id="tab_contents">
|
||||
<template x-if="currentTab === 'colors'" x-data="colors">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="table_filter_container" style="display: block;">
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query">
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient print_hidden" placeholder="Filter" ng-model="query">
|
||||
</div>
|
||||
|
||||
<table class="data_table">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</table>
|
||||
|
||||
<span ng-show="loadingText.length > 0"> {{ loadingText }} </span>
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="queryInput">
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient print_hidden" placeholder="Filter" ng-model="queryInput">
|
||||
</div>
|
||||
<table class="data_table">
|
||||
<tbody>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="table_filter_container">
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query">
|
||||
<input id="table_filter_text_box" class="filter_text_box text_box_transient print_hidden" placeholder="Filter" ng-model="query">
|
||||
</div>
|
||||
|
||||
<table class="data_table">
|
||||
|
||||
@@ -76,7 +76,7 @@ function fish_prompt
|
||||
set arrow "$arrow_color# "
|
||||
end
|
||||
|
||||
set -l cwd $cyan(basename (prompt_pwd))
|
||||
set -l cwd $cyan(prompt_pwd | path basename)
|
||||
|
||||
set -l repo_info
|
||||
if set -l repo_type (_repo_type)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
function fish_prompt
|
||||
set_color $fish_color_cwd
|
||||
echo -n (basename $PWD)
|
||||
echo -n (path basename $PWD)
|
||||
set_color normal
|
||||
echo -n ' ) '
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ function fish_prompt
|
||||
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
||||
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
||||
set -q VIRTUAL_ENV
|
||||
and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV")
|
||||
and _nim_prompt_wrapper $retc V (path basename "$VIRTUAL_ENV")
|
||||
|
||||
# git
|
||||
set -l prompt_git (fish_git_prompt '%s')
|
||||
|
||||
@@ -23,7 +23,7 @@ function fish_prompt
|
||||
# Line 2
|
||||
echo
|
||||
if test -n "$VIRTUAL_ENV"
|
||||
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
|
||||
printf "(%s) " (set_color blue)(path basename $VIRTUAL_ENV)(set_color normal)
|
||||
end
|
||||
printf '↪ '
|
||||
set_color normal
|
||||
|
||||
@@ -108,7 +108,7 @@ function fish_right_prompt
|
||||
# B | | | | m | r | m | u | | | |
|
||||
# ? | | | | m | r | m | u | | | t |
|
||||
# _ | | | d | m | r | m | u | | | |
|
||||
set -l porcelain_status (command git status --porcelain | string sub -l2)
|
||||
set -l porcelain_status (command git status --porcelain 2>/dev/null | string sub -l2)
|
||||
|
||||
set -l status_added 0
|
||||
if string match -qr '[ACDMT][ MT]|[ACMT]D' $porcelain_status
|
||||
|
||||
@@ -1,33 +1,54 @@
|
||||
# name: 'Dracula'
|
||||
# license: 'MIT'
|
||||
# preferred_background: 282a36
|
||||
#
|
||||
# Foreground: f8f8f2
|
||||
# Selection: 44475a
|
||||
# Comment: 6272a4
|
||||
# Red: ff5555
|
||||
# Orange: ffb86c
|
||||
# Yellow: f1fa8c
|
||||
# Green: 50fa7b
|
||||
# Purple: bd93f9
|
||||
# Cyan: 8be9fd
|
||||
# Pink: ff79c6
|
||||
|
||||
fish_color_normal normal
|
||||
fish_color_command F8F8F2
|
||||
fish_color_quote F1FA8C
|
||||
fish_color_redirection 8BE9FD
|
||||
fish_color_end 50FA7B
|
||||
fish_color_error FFB86C
|
||||
fish_color_param FF79C6
|
||||
fish_color_comment 6272A4
|
||||
fish_color_normal f8f8f2
|
||||
fish_color_command 8be9fd
|
||||
fish_color_quote f1fa8c
|
||||
fish_color_redirection f8f8f2
|
||||
fish_color_end ffb86c
|
||||
fish_color_error ff5555
|
||||
fish_color_param bd93f9
|
||||
fish_color_comment 6272a4
|
||||
fish_color_match --background=brblue
|
||||
fish_color_selection white --bold --background=brblack
|
||||
fish_color_search_match bryellow --background=brblack
|
||||
fish_color_selection --background=44475a
|
||||
fish_color_search_match --background=44475a
|
||||
fish_color_history_current --bold
|
||||
fish_color_operator 00a6b2
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_cwd green
|
||||
fish_color_operator 50fa7b
|
||||
fish_color_escape ff79c6
|
||||
fish_color_cwd 50fa7b
|
||||
fish_color_cwd_root red
|
||||
fish_color_valid_path --underline
|
||||
fish_color_autosuggestion BD93F9
|
||||
fish_color_user brgreen
|
||||
fish_color_host normal
|
||||
fish_color_cancel -r
|
||||
fish_pager_color_completion normal
|
||||
fish_pager_color_description B3A06D yellow
|
||||
fish_pager_color_prefix normal --bold --underline
|
||||
fish_pager_color_progress brwhite --background=cyan
|
||||
fish_pager_color_selected_background --background=brblack
|
||||
fish_color_option FF79C6
|
||||
fish_color_keyword F8F8F2
|
||||
fish_color_host_remote yellow
|
||||
fish_color_status red
|
||||
fish_color_autosuggestion 6272a4
|
||||
fish_color_user 8be9fd
|
||||
fish_color_host bd93f9
|
||||
fish_color_cancel ff5555 --reverse
|
||||
fish_pager_color_completion f8f8f2
|
||||
fish_pager_color_description 6272a4
|
||||
fish_pager_color_prefix 8be9fd
|
||||
fish_pager_color_progress 6272a4
|
||||
fish_pager_color_selected_background --background=44475a
|
||||
fish_color_option ffb86c
|
||||
fish_color_keyword ff79c6
|
||||
fish_color_host_remote bd93f9
|
||||
fish_color_status ff5555
|
||||
|
||||
fish_pager_color_background
|
||||
fish_pager_color_selected_prefix 8be9fd
|
||||
fish_pager_color_selected_completion f8f8f2
|
||||
fish_pager_color_selected_description 6272a4
|
||||
fish_pager_color_secondary_background
|
||||
fish_pager_color_secondary_prefix 8be9fd
|
||||
fish_pager_color_secondary_completion f8f8f2
|
||||
fish_pager_color_secondary_description 6272a4
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# name: fish default
|
||||
# NOTE: These should only use named colors
|
||||
# to give us the maximum chance they are
|
||||
# visible in whatever terminal setup.
|
||||
|
||||
fish_color_normal normal
|
||||
fish_color_command blue
|
||||
@@ -18,10 +21,10 @@ fish_color_cwd green
|
||||
fish_color_valid_path --underline
|
||||
fish_color_cwd_root red
|
||||
fish_color_user brgreen
|
||||
fish_color_autosuggestion 555 brblack
|
||||
fish_color_autosuggestion brblack
|
||||
fish_pager_color_completion normal
|
||||
fish_color_host normal
|
||||
fish_pager_color_description B3A06D yellow -i
|
||||
fish_pager_color_description yellow -i
|
||||
fish_color_cancel -r
|
||||
fish_pager_color_prefix normal --bold --underline
|
||||
fish_pager_color_progress brwhite --background=cyan
|
||||
|
||||
@@ -1508,6 +1508,7 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
"fish_pager_color_secondary_description",
|
||||
)
|
||||
)
|
||||
output = ""
|
||||
for item in postvars.get("colors"):
|
||||
what = item.get("what")
|
||||
color = item.get("color")
|
||||
|
||||
Reference in New Issue
Block a user