mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Converted tabs to spaces in webconfig script
This commit is contained in:
parent
0fe44f0e2a
commit
379cf3d249
@ -75,7 +75,6 @@ def better_color(c1, c2):
|
|||||||
if c1 in named_colors: return c2
|
if c1 in named_colors: return c2
|
||||||
return c1
|
return c1
|
||||||
|
|
||||||
|
|
||||||
def parse_color(color_str):
|
def parse_color(color_str):
|
||||||
""" A basic function to parse a color string, for example, 'red' '--bold' """
|
""" A basic function to parse a color string, for example, 'red' '--bold' """
|
||||||
comps = color_str.split(' ')
|
comps = color_str.split(' ')
|
||||||
@ -98,7 +97,6 @@ def parse_color(color_str):
|
|||||||
|
|
||||||
return [color, background_color, bold, underline]
|
return [color, background_color, bold, underline]
|
||||||
|
|
||||||
|
|
||||||
def parse_bool(val):
|
def parse_bool(val):
|
||||||
val = val.lower()
|
val = val.lower()
|
||||||
if val.startswith('f') or val.startswith('0'): return False
|
if val.startswith('f') or val.startswith('0'): return False
|
||||||
@ -229,11 +227,11 @@ def ansi_to_html(val):
|
|||||||
# Clean up empty spans, the nasty way
|
# Clean up empty spans, the nasty way
|
||||||
idx = len(result) - 1
|
idx = len(result) - 1
|
||||||
while idx >= 1:
|
while idx >= 1:
|
||||||
if result[idx] == '</span>' and result[idx-1].startswith('<span'):
|
if result[idx] == '</span>' and result[idx-1].startswith('<span'):
|
||||||
# Empty span, delete these two
|
# Empty span, delete these two
|
||||||
result[idx-1:idx+1] = []
|
result[idx-1:idx+1] = []
|
||||||
idx = idx - 1
|
idx = idx - 1
|
||||||
idx = idx - 1
|
idx = idx - 1
|
||||||
|
|
||||||
return ''.join(result)
|
return ''.join(result)
|
||||||
|
|
||||||
@ -579,26 +577,26 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
fish_bin_dir = os.environ.get('__fish_bin_dir')
|
fish_bin_dir = os.environ.get('__fish_bin_dir')
|
||||||
fish_bin_path = None
|
fish_bin_path = None
|
||||||
if not fish_bin_dir:
|
if not fish_bin_dir:
|
||||||
print('The __fish_bin_dir environment variable is not set. Looking in $PATH...')
|
print('The __fish_bin_dir environment variable is not set. Looking in $PATH...')
|
||||||
# distutils.spawn is terribly broken, because it looks in wd before PATH,
|
# distutils.spawn is terribly broken, because it looks in wd before PATH,
|
||||||
# and doesn't actually validate that the file is even executabl
|
# and doesn't actually validate that the file is even executabl
|
||||||
for p in os.environ['PATH'].split(os.pathsep):
|
for p in os.environ['PATH'].split(os.pathsep):
|
||||||
proposed_path = os.path.join(p, 'fish')
|
proposed_path = os.path.join(p, 'fish')
|
||||||
if os.access(proposed_path, os.X_OK):
|
if os.access(proposed_path, os.X_OK):
|
||||||
fish_bin_path = proposed_path
|
fish_bin_path = proposed_path
|
||||||
break
|
break
|
||||||
if not fish_bin_path:
|
if not fish_bin_path:
|
||||||
print("fish could not be found. Is fish installed correctly?")
|
print("fish could not be found. Is fish installed correctly?")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
else:
|
else:
|
||||||
print("fish found at '%s'" % fish_bin_path)
|
print("fish found at '%s'" % fish_bin_path)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
fish_bin_path = os.path.join(fish_bin_dir, 'fish')
|
fish_bin_path = os.path.join(fish_bin_dir, 'fish')
|
||||||
|
|
||||||
if not os.access(fish_bin_path, os.X_OK):
|
if not os.access(fish_bin_path, os.X_OK):
|
||||||
print("fish could not be executed at path '%s'. Is fish installed correctly?" % fish_bin_path)
|
print("fish could not be executed at path '%s'. Is fish installed correctly?" % fish_bin_path)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
FISH_BIN_PATH = fish_bin_path
|
FISH_BIN_PATH = fish_bin_path
|
||||||
|
|
||||||
# We want to show the demo prompts in the directory from which this was invoked,
|
# We want to show the demo prompts in the directory from which this was invoked,
|
||||||
@ -646,15 +644,15 @@ webbrowser.open(url)
|
|||||||
# Select on stdin and httpd
|
# Select on stdin and httpd
|
||||||
stdin_no = sys.stdin.fileno()
|
stdin_no = sys.stdin.fileno()
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
ready_read = select.select([sys.stdin.fileno(), httpd.fileno()], [], [])
|
ready_read = select.select([sys.stdin.fileno(), httpd.fileno()], [], [])
|
||||||
if ready_read[0][0] < 1:
|
if ready_read[0][0] < 1:
|
||||||
print("Shutting down.")
|
print("Shutting down.")
|
||||||
# Consume the newline so it doesn't get printed by the caller
|
# Consume the newline so it doesn't get printed by the caller
|
||||||
sys.stdin.readline()
|
sys.stdin.readline()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
httpd.handle_request()
|
httpd.handle_request()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\nShutting down.")
|
print("\nShutting down.")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user