mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 20:47:44 +08:00
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]
This commit is contained in:
parent
4cefcd4327
commit
65883e0e40
|
@ -243,7 +243,14 @@ class TestRun(object):
|
||||||
# Failed to match.
|
# Failed to match.
|
||||||
lineq.pop()
|
lineq.pop()
|
||||||
# Add context, ignoring empty lines.
|
# Add context, ignoring empty lines.
|
||||||
return TestFailure(line, check, self, after = [line.text for line in lineq[::-1] if not line.is_empty_space()])
|
return TestFailure(
|
||||||
|
line,
|
||||||
|
check,
|
||||||
|
self,
|
||||||
|
after=[
|
||||||
|
line.text for line in lineq[::-1] if not line.is_empty_space()
|
||||||
|
],
|
||||||
|
)
|
||||||
# Drain empties.
|
# Drain empties.
|
||||||
while lineq and lineq[-1].is_empty_space():
|
while lineq and lineq[-1].is_empty_space():
|
||||||
lineq.pop()
|
lineq.pop()
|
||||||
|
@ -440,14 +447,15 @@ def get_argparse():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-p",
|
"-p",
|
||||||
"--progress",
|
"--progress",
|
||||||
action='store_true',
|
action="store_true",
|
||||||
dest='progress',
|
dest="progress",
|
||||||
help="Show the files to be checked",
|
help="Show the files to be checked",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
parser.add_argument("file", nargs="+", help="File to check")
|
parser.add_argument("file", nargs="+", help="File to check")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-A", "--after",
|
"-A",
|
||||||
|
"--after",
|
||||||
type=int,
|
type=int,
|
||||||
help="How many non-empty lines of output after a failure to print (default: 5)",
|
help="How many non-empty lines of output after a failure to print (default: 5)",
|
||||||
action="store",
|
action="store",
|
||||||
|
@ -471,7 +479,7 @@ def main():
|
||||||
for path in args.file:
|
for path in args.file:
|
||||||
fields["path"] = path
|
fields["path"] = path
|
||||||
if config.progress:
|
if config.progress:
|
||||||
print("Testing file {path} ... ".format(**fields), end='')
|
print("Testing file {path} ... ".format(**fields), end="")
|
||||||
subs = def_subs.copy()
|
subs = def_subs.copy()
|
||||||
subs["s"] = path
|
subs["s"] = path
|
||||||
if not check_path(path, subs, config, TestFailure.print_message):
|
if not check_path(path, subs, config, TestFailure.print_message):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
function __fish_get_vmctl_vms
|
function __fish_get_vmctl_vms
|
||||||
for line in (vmctl status | string match -e -v "MAXMEM");
|
for line in (vmctl status | string match -e -v "MAXMEM")
|
||||||
set a (string split " " $line)
|
set a (string split " " $line)
|
||||||
and printf "%s " $a[-1]
|
and printf "%s " $a[-1]
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,13 +5,13 @@ function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_co
|
||||||
set -l keyid
|
set -l keyid
|
||||||
$__fish_complete_gpg_command --list-keys --with-colons | while read garbage
|
$__fish_complete_gpg_command --list-keys --with-colons | while read garbage
|
||||||
switch $garbage
|
switch $garbage
|
||||||
# Extract user ids (note: gpg escapes colons as '\x3a')
|
|
||||||
case "uid*"
|
case "uid*"
|
||||||
|
# Extract user ids (note: gpg escapes colons as '\x3a')
|
||||||
set -l __uid (string split ":" -- $garbage)
|
set -l __uid (string split ":" -- $garbage)
|
||||||
set uid (string replace -a '\x3a' ':' -- $__uuid[10])
|
set uid (string replace -a '\x3a' ':' -- $__uuid[10])
|
||||||
printf "%s\t%s\n" $keyid $uid
|
printf "%s\t%s\n" $keyid $uid
|
||||||
# Extract key fingerprints (no subkeys)
|
|
||||||
case "pub*"
|
case "pub*"
|
||||||
|
# Extract key fingerprints (no subkeys)
|
||||||
set -l __pub (string split ":" -- $garbage)
|
set -l __pub (string split ":" -- $garbage)
|
||||||
set keyid $__pub[5]
|
set keyid $__pub[5]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1478,7 +1478,7 @@ url = "http://localhost:%d/%s/%s" % (PORT, authkey, initial_tab)
|
||||||
# Create temporary file to hold redirect to real server. This prevents exposing
|
# Create temporary file to hold redirect to real server. This prevents exposing
|
||||||
# the URL containing the authentication key on the command line (see
|
# the URL containing the authentication key on the command line (see
|
||||||
# CVE-2014-2914 or https://github.com/fish-shell/fish-shell/issues/1438).
|
# CVE-2014-2914 or https://github.com/fish-shell/fish-shell/issues/1438).
|
||||||
f = tempfile.NamedTemporaryFile(prefix='web_config', suffix='.html', mode='w')
|
f = tempfile.NamedTemporaryFile(prefix="web_config", suffix=".html", mode="w")
|
||||||
|
|
||||||
f.write(redirect_template_html % (url, url))
|
f.write(redirect_template_html % (url, url))
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include <procfs.h>
|
#include <procfs.h>
|
||||||
#endif
|
#endif
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
#include <sys/time.h> // Required to build with old SDK versions
|
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
|
#include <sys/time.h> // Required to build with old SDK versions
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -268,10 +268,13 @@ bool process_t::is_internal() const {
|
||||||
case process_type_t::exec:
|
case process_type_t::exec:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
assert(false && "The fish developers forgot to include a process_t. Please report a bug");
|
assert(false &&
|
||||||
|
"The fish developers forgot to include a process_t. Please report a bug");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
assert(false && "process_t::is_internal: Total logic failure, universe is broken. Please replace universe and retry.");
|
assert(false &&
|
||||||
|
"process_t::is_internal: Total logic failure, universe is broken. Please replace "
|
||||||
|
"universe and retry.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,8 @@ maybe_t<pipe_or_redir_t> pipe_or_redir_t::from_string(const wchar_t *buff) {
|
||||||
: STDOUT_FILENO; // like >|
|
: STDOUT_FILENO; // like >|
|
||||||
} else if (try_consume(L'&')) {
|
} else if (try_consume(L'&')) {
|
||||||
// This is a redirection to an fd.
|
// This is a redirection to an fd.
|
||||||
// Note that we allow ">>&", but it's still just writing to the fd - "appending" to it doesn't make sense.
|
// Note that we allow ">>&", but it's still just writing to the fd - "appending" to
|
||||||
|
// it doesn't make sense.
|
||||||
result.mode = redirection_mode_t::fd;
|
result.mode = redirection_mode_t::fd;
|
||||||
result.fd = has_fd ? parse_fd(fd_start, fd_end) // like 1>&2
|
result.fd = has_fd ? parse_fd(fd_start, fd_end) // like 1>&2
|
||||||
: STDOUT_FILENO; // like >&2
|
: STDOUT_FILENO; // like >&2
|
||||||
|
@ -383,7 +384,8 @@ maybe_t<pipe_or_redir_t> pipe_or_redir_t::from_string(const wchar_t *buff) {
|
||||||
// This is a redirection to a file.
|
// This is a redirection to a file.
|
||||||
result.fd = has_fd ? parse_fd(fd_start, fd_end) // like 1> file.txt
|
result.fd = has_fd ? parse_fd(fd_start, fd_end) // like 1> file.txt
|
||||||
: STDOUT_FILENO; // like > file.txt
|
: STDOUT_FILENO; // like > file.txt
|
||||||
if (result.mode != redirection_mode_t::append) result.mode = redirection_mode_t::overwrite;
|
if (result.mode != redirection_mode_t::append)
|
||||||
|
result.mode = redirection_mode_t::overwrite;
|
||||||
// Note 'echo abc >>? file' is valid: it means append and noclobber.
|
// Note 'echo abc >>? file' is valid: it means append and noclobber.
|
||||||
// But here "noclobber" means the file must not exist, so appending
|
// But here "noclobber" means the file must not exist, so appending
|
||||||
// can be ignored.
|
// can be ignored.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user