From 90d52ee6693007c23f5fa8bded39fe20ff5ffd8c Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Thu, 31 Mar 2022 00:29:59 +0800 Subject: [PATCH] Complete `/dev/fd` in `isatty` (#8840) * Complete `/dev/fd` in `isatty` * Check `/dev/fd` existence first --- share/completions/isatty.fish | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/share/completions/isatty.fish b/share/completions/isatty.fish index 2ee644b0f..1e65bf77c 100644 --- a/share/completions/isatty.fish +++ b/share/completions/isatty.fish @@ -1 +1,9 @@ -complete -c isatty -x -k -a "stdin stdout stderr" +complete -c isatty -x + +if test -d /dev/fd + complete -c isatty -k -a "(string replace /dev/fd/ '' /dev/fd/*)" +end + +complete -c isatty -k -a "stderr" -d "2" +complete -c isatty -k -a "stdout" -d "1" +complete -c isatty -k -a "stdin" -d "0"