mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
Compare commits
190 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
064581c7f8 | ||
|
|
94b1c4c076 | ||
|
|
85c87fe267 | ||
|
|
5bd66ee2ce | ||
|
|
e593f9be53 | ||
|
|
25e363e729 | ||
|
|
5db192347c | ||
|
|
18bbb5ad01 | ||
|
|
24ca6ceb47 | ||
|
|
3607c555be | ||
|
|
cad14db27b | ||
|
|
2fb5632212 | ||
|
|
56ad85d8a8 | ||
|
|
ee66520863 | ||
|
|
83629e28c8 | ||
|
|
645af56d77 | ||
|
|
9501dc83e6 | ||
|
|
9942e2f19f | ||
|
|
6d6644b907 | ||
|
|
11273a7be0 | ||
|
|
1562b8148d | ||
|
|
d7b659d8e8 | ||
|
|
6050850081 | ||
|
|
95d68e48f2 | ||
|
|
2b7781d3cb | ||
|
|
f0b2d7532a | ||
|
|
6b91433881 | ||
|
|
16cb9dfa05 | ||
|
|
10fec8abb6 | ||
|
|
da058aa141 | ||
|
|
67333a23f1 | ||
|
|
72bb5ae06f | ||
|
|
d4034fc253 | ||
|
|
be9208412a | ||
|
|
f66689d415 | ||
|
|
aca0511762 | ||
|
|
68df730980 | ||
|
|
032a736840 | ||
|
|
d9663a4ec4 | ||
|
|
5392533f33 | ||
|
|
bf0957d8dd | ||
|
|
630abb56f6 | ||
|
|
c45e457492 | ||
|
|
fef1e1db32 | ||
|
|
8ed80deb6b | ||
|
|
b7c551a348 | ||
|
|
810d9104fc | ||
|
|
54c502c3cf | ||
|
|
faa23a33ec | ||
|
|
ae511451fe | ||
|
|
ce689e69d5 | ||
|
|
906495d713 | ||
|
|
690648e1b0 | ||
|
|
b33d3f78b1 | ||
|
|
343c280dbf | ||
|
|
f6b2b9f9a5 | ||
|
|
6a0460f51e | ||
|
|
e12902fe3c | ||
|
|
48030576e4 | ||
|
|
33177e75a6 | ||
|
|
c1304a05d9 | ||
|
|
038d7e725e | ||
|
|
6408486336 | ||
|
|
ec43c635cc | ||
|
|
26de6ba26b | ||
|
|
8f121dce9c | ||
|
|
7eec1a6625 | ||
|
|
02a3288db7 | ||
|
|
b069489792 | ||
|
|
b37eeb92ef | ||
|
|
b6630b5087 | ||
|
|
3a69fc997c | ||
|
|
c216e36a72 | ||
|
|
00778832f1 | ||
|
|
cdbd233e62 | ||
|
|
9ce93164bb | ||
|
|
20b269130c | ||
|
|
891c2fc379 | ||
|
|
00be44a69a | ||
|
|
b8ea709c1e | ||
|
|
7bdcfacee4 | ||
|
|
61706b4490 | ||
|
|
443ddb509e | ||
|
|
e6774cc944 | ||
|
|
78cd8fa089 | ||
|
|
9229041385 | ||
|
|
e6bd3dbc40 | ||
|
|
a91bf6d88a | ||
|
|
fa75fc3901 | ||
|
|
e4a95cb989 | ||
|
|
9cf4a2a0b3 | ||
|
|
0ff374a4a0 | ||
|
|
0817962300 | ||
|
|
8b69c5416d | ||
|
|
1071fedaee | ||
|
|
ab207b64a3 | ||
|
|
418e26c0ac | ||
|
|
de3a28874e | ||
|
|
9dd842ea96 | ||
|
|
5d069de71d | ||
|
|
16333b0c69 | ||
|
|
e4fa0e1000 | ||
|
|
3e52bd0132 | ||
|
|
211663a549 | ||
|
|
659b99ed1a | ||
|
|
86d7e8bb8e | ||
|
|
8bf0a14bd5 | ||
|
|
9c32709fe1 | ||
|
|
00bdd2cb48 | ||
|
|
0a8284c981 | ||
|
|
ddbb50acd7 | ||
|
|
5262f3ce99 | ||
|
|
28dd48a76a | ||
|
|
b1c61bcf1f | ||
|
|
bb591a69c9 | ||
|
|
1d69e70b7a | ||
|
|
2cac04850b | ||
|
|
2619f1752d | ||
|
|
33e2c81748 | ||
|
|
f05da41159 | ||
|
|
780ecc46fc | ||
|
|
9b98df8310 | ||
|
|
5a8205ac2b | ||
|
|
2490da31ce | ||
|
|
092bb90569 | ||
|
|
39ca027706 | ||
|
|
22433f2717 | ||
|
|
f6e194447d | ||
|
|
e2ed5d0977 | ||
|
|
fe5bf8f80e | ||
|
|
0a713a7939 | ||
|
|
4ba2709452 | ||
|
|
0c877183b9 | ||
|
|
a46be4cadb | ||
|
|
8b4637e900 | ||
|
|
ab13c4caad | ||
|
|
479696a8ec | ||
|
|
acde745e34 | ||
|
|
064d49215a | ||
|
|
78d3b37e11 | ||
|
|
12aa33fad4 | ||
|
|
e4ade8f41b | ||
|
|
9d7723b330 | ||
|
|
2bc2e0b9ec | ||
|
|
02083a1bd7 | ||
|
|
e534a952b7 | ||
|
|
754d8d3712 | ||
|
|
86230813de | ||
|
|
2faba57e5a | ||
|
|
3789127d28 | ||
|
|
32e833f331 | ||
|
|
9b4c34aa4c | ||
|
|
e2ebc0e443 | ||
|
|
8ff66e718c | ||
|
|
2789da6a1a | ||
|
|
51c345311a | ||
|
|
4a68a34c50 | ||
|
|
9993ff07f2 | ||
|
|
fc8b56da0d | ||
|
|
02981a1750 | ||
|
|
c2e6b07b35 | ||
|
|
8fcacdd5df | ||
|
|
6bf58e44f4 | ||
|
|
bda7948719 | ||
|
|
e800fca499 | ||
|
|
eed4b75389 | ||
|
|
5974dd68b0 | ||
|
|
680c0aff05 | ||
|
|
4a2bdeebef | ||
|
|
dfa251a1ab | ||
|
|
82cb97d3e3 | ||
|
|
7d334914f7 | ||
|
|
27a60f465d | ||
|
|
279159384e | ||
|
|
d748e05cb9 | ||
|
|
d50c051eec | ||
|
|
8d58e58d7b | ||
|
|
c8c3715aac | ||
|
|
7ffcebb9f8 | ||
|
|
831d95b600 | ||
|
|
0ffeb41c28 | ||
|
|
e8d02159da | ||
|
|
b78fba810c | ||
|
|
43213ee458 | ||
|
|
da316dd588 | ||
|
|
c8bc79005c | ||
|
|
5ba0affdd7 | ||
|
|
721f616964 | ||
|
|
ef4345968e | ||
|
|
319956c26b |
18
INSTALL
18
INSTALL
@@ -33,10 +33,13 @@ broken.
|
|||||||
Simple install procedure
|
Simple install procedure
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
If you have downloaded the darcs repository of fish, you need to run
|
||||||
|
autoconf.
|
||||||
|
|
||||||
% ./configure
|
% ./configure
|
||||||
% make #Compile fish
|
% make # Compile fish
|
||||||
% make install #Install fish
|
% make install # Install fish
|
||||||
% echo /usr/local/bin/fish >>/etc/shells #Add fish to list of shells
|
% echo /usr/local/bin/fish >>/etc/shells # Add fish to list of shells
|
||||||
|
|
||||||
If you wish to use fish as your default shell, use the following
|
If you wish to use fish as your default shell, use the following
|
||||||
command:
|
command:
|
||||||
@@ -49,6 +52,9 @@ chsh will prompt you for your password, and change your default shell.
|
|||||||
Local install procedure
|
Local install procedure
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
If you have downloaded the darcs repository of fish, you need to run
|
||||||
|
autoconf first.
|
||||||
|
|
||||||
To install fish in your own home directory (typically as non-root),
|
To install fish in your own home directory (typically as non-root),
|
||||||
type:
|
type:
|
||||||
|
|
||||||
@@ -57,6 +63,6 @@ type:
|
|||||||
% make install # Install fish
|
% make install # Install fish
|
||||||
|
|
||||||
You will not be able to use fish as the default shell unless you also
|
You will not be able to use fish as the default shell unless you also
|
||||||
add the corresponding line to /etc/shells, which kind of defeats the
|
add the corresponding line to /etc/shells, which mostly defeats the
|
||||||
point of a local install. But you can at least build and run fish.
|
point of a local install. As a workaround, you can add fish as the
|
||||||
|
last command of the init files for your regular shell.
|
||||||
|
|||||||
223
Makefile.in
223
Makefile.in
@@ -38,6 +38,7 @@ INSTALL:=@INSTALL@
|
|||||||
|
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
|
datadir = @datadir@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
@@ -46,13 +47,15 @@ fishfile = @fishfile@
|
|||||||
fishinputfile = @fishinputfile@
|
fishinputfile = @fishinputfile@
|
||||||
docdir = @docdir@
|
docdir = @docdir@
|
||||||
|
|
||||||
|
HAVE_GETTEXT=@HAVE_GETTEXT@
|
||||||
|
|
||||||
# All objects used by fish, that are compiled from an ordinary .c file
|
# All objects used by fish, that are compiled from an ordinary .c file
|
||||||
# using an ordinary .h file.
|
# using an ordinary .h file.
|
||||||
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
|
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
|
||||||
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
|
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
|
||||||
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
|
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
|
||||||
output.o intern.o env_universal.o env_universal_common.o \
|
output.o intern.o env_universal.o env_universal_common.o \
|
||||||
input_common.o event.o signal.o io.o
|
input_common.o event.o signal.o io.o translate.o
|
||||||
|
|
||||||
# builtin_help.h exists, but builtin_help.c is autogenerated
|
# builtin_help.h exists, but builtin_help.c is autogenerated
|
||||||
COMMON_OBJS_WITH_HEADER := builtin_help.o
|
COMMON_OBJS_WITH_HEADER := builtin_help.o
|
||||||
@@ -62,7 +65,7 @@ COMMON_OBJS_WITH_CODE := builtin_set.o builtin_commandline.o builtin_ulimit.c
|
|||||||
|
|
||||||
# All objects that the system needs to build fish
|
# All objects that the system needs to build fish
|
||||||
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) main.o
|
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) main.o
|
||||||
FISH_PAGER_OBJS := fish_pager.o common.o output.o util.o wutil.o tokenizer.o input_common.o env_universal.o env_universal_common.o
|
FISH_PAGER_OBJS := fish_pager.o common.o output.o util.o wutil.o tokenizer.o input_common.o env_universal.o env_universal_common.o translate.o
|
||||||
FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) fish_tests.o
|
FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) fish_tests.o
|
||||||
FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
|
FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
|
||||||
|
|
||||||
@@ -79,13 +82,13 @@ MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
|
|||||||
|
|
||||||
BUILTIN_DOC_SRC := doc_src/source.txt doc_src/and.txt \
|
BUILTIN_DOC_SRC := doc_src/source.txt doc_src/and.txt \
|
||||||
doc_src/begin.txt doc_src/bg.txt doc_src/bind.txt \
|
doc_src/begin.txt doc_src/bg.txt doc_src/bind.txt \
|
||||||
doc_src/break.txt doc_src/builtin.txt doc_src/case.txt \
|
doc_src/block.txt doc_src/break.txt doc_src/builtin.txt \
|
||||||
doc_src/cd.txt doc_src/command.txt doc_src/commandline.txt \
|
doc_src/case.txt doc_src/cd.txt doc_src/command.txt \
|
||||||
doc_src/complete.txt doc_src/continue.txt doc_src/else.txt \
|
doc_src/commandline.txt doc_src/complete.txt doc_src/continue.txt \
|
||||||
doc_src/end.txt doc_src/eval.txt doc_src/exec.txt doc_src/exit.txt \
|
doc_src/else.txt doc_src/end.txt doc_src/eval.txt doc_src/exec.txt \
|
||||||
doc_src/fg.txt doc_src/for.txt doc_src/function.txt \
|
doc_src/exit.txt doc_src/fg.txt doc_src/for.txt \
|
||||||
doc_src/functions.txt doc_src/if.txt doc_src/jobs.txt \
|
doc_src/function.txt doc_src/functions.txt doc_src/if.txt \
|
||||||
doc_src/not.txt doc_src/or.txt doc_src/random.txt \
|
doc_src/jobs.txt doc_src/not.txt doc_src/or.txt doc_src/random.txt \
|
||||||
doc_src/return.txt doc_src/read.txt doc_src/set.txt \
|
doc_src/return.txt doc_src/read.txt doc_src/set.txt \
|
||||||
doc_src/status.txt doc_src/switch.txt doc_src/ulimit.txt \
|
doc_src/status.txt doc_src/switch.txt doc_src/ulimit.txt \
|
||||||
doc_src/while.txt
|
doc_src/while.txt
|
||||||
@@ -105,8 +108,8 @@ CMD_DOC_SRC := doc_src/count.txt doc_src/dirh.txt doc_src/dirs.txt \
|
|||||||
doc_src/fishd.txt doc_src/help.txt doc_src/mimedb.txt \
|
doc_src/fishd.txt doc_src/help.txt doc_src/mimedb.txt \
|
||||||
doc_src/nextd.txt doc_src/open.txt doc_src/popd.txt \
|
doc_src/nextd.txt doc_src/open.txt doc_src/popd.txt \
|
||||||
doc_src/prevd.txt doc_src/psub.txt doc_src/pushd.txt \
|
doc_src/prevd.txt doc_src/psub.txt doc_src/pushd.txt \
|
||||||
doc_src/set_color.txt doc_src/tokenize.txt doc_src/type.txt \
|
doc_src/set_color.txt doc_src/trap.txt doc_src/type.txt \
|
||||||
doc_src/umask.txt
|
doc_src/umask.txt doc_src/vared.txt
|
||||||
|
|
||||||
#
|
#
|
||||||
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
|
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
|
||||||
@@ -126,7 +129,7 @@ DOC_SRC_DIR_FILES := doc_src/Doxyfile.in doc_src/doc.hdr \
|
|||||||
# Files in ./
|
# Files in ./
|
||||||
MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
|
MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
|
||||||
configure.ac config.h.in install-sh set_color.c count.c \
|
configure.ac config.h.in install-sh set_color.c count.c \
|
||||||
key_reader.c tokenize.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \
|
key_reader.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \
|
||||||
$(MIME_OBJS:.o=.c) $(COMMON_OBJS_WITH_HEADER:.o=.h) \
|
$(MIME_OBJS:.o=.c) $(COMMON_OBJS_WITH_HEADER:.o=.h) \
|
||||||
$(COMMON_OBJS:.o=.h) $(COMMON_OBJS_WITH_CODE:.o=.c) \
|
$(COMMON_OBJS:.o=.h) $(COMMON_OBJS_WITH_CODE:.o=.c) \
|
||||||
$(COMMON_OBJS:.o=.c) builtin_help.hdr fish.spec.in INSTALL README \
|
$(COMMON_OBJS:.o=.c) builtin_help.hdr fish.spec.in INSTALL README \
|
||||||
@@ -134,9 +137,9 @@ MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
|
|||||||
config.guess fish_tests.c main.c fish_pager.c fishd.c
|
config.guess fish_tests.c main.c fish_pager.c fishd.c
|
||||||
|
|
||||||
# Files in ./init/
|
# Files in ./init/
|
||||||
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish \
|
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \
|
||||||
init/fish_function.fish init/fish_inputrc \
|
init/fish_function.fish init/fish_inputrc \
|
||||||
init/fish_interactive.fish
|
init/fish_interactive.fish.in
|
||||||
|
|
||||||
# Files in ./tests/
|
# Files in ./tests/
|
||||||
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
|
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
|
||||||
@@ -145,17 +148,23 @@ TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
|
|||||||
COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
|
COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
|
||||||
|
|
||||||
# Programs to build
|
# Programs to build
|
||||||
PROGRAMS:=fish set_color tokenize @XSEL@ mimedb count fish_pager fishd
|
PROGRAMS:=fish set_color @XSEL@ mimedb count fish_pager fishd
|
||||||
|
|
||||||
# Manuals to install
|
# Manuals to install
|
||||||
MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \
|
MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \
|
||||||
doc_src/builtin_doc/man/man1/mimedb.1 \
|
doc_src/builtin_doc/man/man1/mimedb.1 \
|
||||||
doc_src/builtin_doc/man/man1/set_color.1 \
|
doc_src/builtin_doc/man/man1/set_color.1 \
|
||||||
doc_src/builtin_doc/man/man1/tokenize.1 \
|
|
||||||
doc_src/builtin_doc/man/man1/count.1
|
doc_src/builtin_doc/man/man1/count.1
|
||||||
|
|
||||||
|
#All translation message catalogs
|
||||||
|
TRANSLATIONS_SRC := $(wildcard po/*.po)
|
||||||
|
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
|
||||||
|
|
||||||
#Make everything needed for installing fish
|
#Make everything needed for installing fish
|
||||||
all: $(PROGRAMS) user_doc
|
all: $(PROGRAMS) user_doc
|
||||||
|
|
||||||
|
debug:
|
||||||
|
make fish CFLAGS="-O0 -Wno-unused -Werror -g @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing"
|
||||||
|
|
||||||
# User documentation, describing the features of the fish shell.
|
# User documentation, describing the features of the fish shell.
|
||||||
user_doc: doc.h Doxyfile.user user_doc.head.html
|
user_doc: doc.h Doxyfile.user user_doc.head.html
|
||||||
@@ -205,6 +214,29 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
|
|||||||
cat $*.txt >>$@;
|
cat $*.txt >>$@;
|
||||||
echo "*/" >>$@
|
echo "*/" >>$@
|
||||||
|
|
||||||
|
# Compile translation file
|
||||||
|
%.gmo:%.po
|
||||||
|
if test $(HAVE_GETTEXT) = 1; then \
|
||||||
|
msgfmt $*.po -o $*.gmo; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update existing po file or copy messages.pot
|
||||||
|
%.po: messages.pot
|
||||||
|
if test $(HAVE_GETTEXT) = 1;then \
|
||||||
|
if test -f $*.po; then \
|
||||||
|
msgmerge -U --backup=existing --no-wrap $*.po messages.pot;\
|
||||||
|
else \
|
||||||
|
cp messages.pot $*.po;\
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a template translation object
|
||||||
|
messages.pot: *.c *.h init/*.in init/*.fish init/completions/*.fish
|
||||||
|
if test $(HAVE_GETTEXT) = 1;then \
|
||||||
|
xgettext -k_ -kN_ -kcomplete_desc --no-wrap *.c *.h -o messages.pot; \
|
||||||
|
xgettext -j -k_ -LShell --no-wrap init/*.in init/*.fish init/completions/*.fish -o messages.pot; \
|
||||||
|
fi
|
||||||
|
|
||||||
# Generate the internal help functions by making doxygen create
|
# Generate the internal help functions by making doxygen create
|
||||||
# man-pages which are then converted into C code. The convertion path
|
# man-pages which are then converted into C code. The convertion path
|
||||||
# looks like this:
|
# looks like this:
|
||||||
@@ -266,7 +298,7 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui
|
|||||||
echo "}" >>$@
|
echo "}" >>$@
|
||||||
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
|
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
|
||||||
|
|
||||||
install: all
|
install: all install-translations
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
|
||||||
for i in $(PROGRAMS); do\
|
for i in $(PROGRAMS); do\
|
||||||
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
|
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
|
||||||
@@ -283,7 +315,9 @@ install: all
|
|||||||
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
|
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
|
||||||
for i in user_doc/html/* ChangeLog; do \
|
for i in user_doc/html/* ChangeLog; do \
|
||||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
|
if test -f $$i; then \
|
||||||
|
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
|
||||||
|
fi; \
|
||||||
done;
|
done;
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
|
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
|
||||||
for i in $(MANUALS); do \
|
for i in $(MANUALS); do \
|
||||||
@@ -292,7 +326,7 @@ install: all
|
|||||||
@echo If you want to use fish as the default shell, remember to first
|
@echo If you want to use fish as the default shell, remember to first
|
||||||
@echo add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.
|
@echo add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.
|
||||||
|
|
||||||
uninstall:
|
uninstall: uninstall-translations
|
||||||
for i in $(PROGRAMS); do \
|
for i in $(PROGRAMS); do \
|
||||||
rm -f $(DESTDIR)$(bindir)/$$i; \
|
rm -f $(DESTDIR)$(bindir)/$$i; \
|
||||||
done;
|
done;
|
||||||
@@ -301,10 +335,26 @@ uninstall:
|
|||||||
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
|
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
|
||||||
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
|
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
|
||||||
rm -r $(DESTDIR)$(docdir)
|
rm -r $(DESTDIR)$(docdir)
|
||||||
for i in fish.1* @XSEL_MAN@ mimedb.1* set_color.1* tokenize.1* count.1*; do \
|
for i in fish.1* @XSEL_MAN@ mimedb.1* set_color.1* count.1*; do \
|
||||||
rm $(DESTDIR)$(mandir)/man1/$$i; \
|
rm $(DESTDIR)$(mandir)/man1/$$i; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
|
install-translations: $(TRANSLATIONS)
|
||||||
|
if test $(HAVE_GETTEXT) = 1; then \
|
||||||
|
for i in $(TRANSLATIONS); do \
|
||||||
|
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES; \
|
||||||
|
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES/fish.mo; \
|
||||||
|
echo $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES/fish.mo;\
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
uninstall-translations:
|
||||||
|
if test $(HAVE_GETTEXT) = 1; then \
|
||||||
|
for i in $(TRANSLATIONS_SRC); do \
|
||||||
|
rm -f $(DESTDIR)$(datadir)/locale/$$(basename $$i .po)/LC_MESSAGES/fish.mo; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
# The fish shell
|
# The fish shell
|
||||||
fish: $(FISH_OBJS)
|
fish: $(FISH_OBJS)
|
||||||
$(CC) $(FISH_OBJS) $(LDFLAGS) -o $@
|
$(CC) $(FISH_OBJS) $(LDFLAGS) -o $@
|
||||||
@@ -325,9 +375,6 @@ mimedb: $(MIME_OBJS) util.o common.o doc_src/mimedb.c
|
|||||||
set_color: set_color.o doc_src/set_color.c
|
set_color: set_color.o doc_src/set_color.c
|
||||||
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
|
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
|
||||||
|
|
||||||
tokenize: tokenize.o doc_src/tokenize.c
|
|
||||||
$(CC) tokenize.o doc_src/tokenize.c $(LDFLAGS) -o $@
|
|
||||||
|
|
||||||
# Test program for the tokenizer library
|
# Test program for the tokenizer library
|
||||||
tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o
|
tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o
|
||||||
$(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
|
$(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
|
||||||
@@ -344,18 +391,20 @@ depend:
|
|||||||
#
|
#
|
||||||
# Uses install instead of mkdir so build won't fail if the directory
|
# Uses install instead of mkdir so build won't fail if the directory
|
||||||
# exists
|
# exists
|
||||||
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
|
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog $(TRANSLATIONS_SRC)
|
||||||
rm -rf fish-@PACKAGE_VERSION@
|
rm -rf fish-@PACKAGE_VERSION@
|
||||||
$(INSTALL) -d fish-@PACKAGE_VERSION@
|
$(INSTALL) -d fish-@PACKAGE_VERSION@
|
||||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
|
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
|
||||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
|
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
|
||||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
|
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
|
||||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
|
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
|
||||||
|
$(INSTALL) -d fish-@PACKAGE_VERSION@/po
|
||||||
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
|
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
|
||||||
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
|
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
|
||||||
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
|
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
|
||||||
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
|
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
|
||||||
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
|
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
|
||||||
|
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/
|
||||||
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
|
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
|
||||||
rm -rf fish-@PACKAGE_VERSION@
|
rm -rf fish-@PACKAGE_VERSION@
|
||||||
|
|
||||||
@@ -374,10 +423,16 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2
|
|||||||
mv /usr/src/redhat/RPMS/*/fish*@PACKAGE_VERSION@*.rpm .
|
mv /usr/src/redhat/RPMS/*/fish*@PACKAGE_VERSION@*.rpm .
|
||||||
mv /usr/src/redhat/SRPMS/fish*@PACKAGE_VERSION@*.src.rpm .
|
mv /usr/src/redhat/SRPMS/fish*@PACKAGE_VERSION@*.src.rpm .
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
|
||||||
|
rm -f init/fish init/fish_interactive.fish init/fish_complete.fish
|
||||||
|
rm -f config.status config.log config.h Makefile
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o doc.h doc_src/*.doxygen doc_src/*.c builtin_help.c
|
rm -f *.o doc.h doc_src/*.doxygen doc_src/*.c builtin_help.c
|
||||||
rm -f config.status config.log config.h Makefile
|
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
|
||||||
rm -f tokenizer_test fish key_reader set_color tokenize gen_hdr2 mimedb
|
rm -f tokenizer_test fish key_reader set_color gen_hdr2 mimedb
|
||||||
|
rm -f fishd fish_pager count
|
||||||
rm -f fish-@PACKAGE_VERSION@.tar
|
rm -f fish-@PACKAGE_VERSION@.tar
|
||||||
rm -f fish-@PACKAGE_VERSION@.tar.gz
|
rm -f fish-@PACKAGE_VERSION@.tar.gz
|
||||||
rm -f fish-@PACKAGE_VERSION@.tar.bz2
|
rm -f fish-@PACKAGE_VERSION@.tar.bz2
|
||||||
@@ -386,70 +441,90 @@ clean:
|
|||||||
rm -rf doc_src/builtin_doc
|
rm -rf doc_src/builtin_doc
|
||||||
rm -rf fish-@PACKAGE_VERSION@
|
rm -rf fish-@PACKAGE_VERSION@
|
||||||
rm -rf xsel-0.9.6/
|
rm -rf xsel-0.9.6/
|
||||||
|
rm -f $(TRANSLATIONS)
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h
|
builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h
|
||||||
builtin.o: parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
|
builtin.o: io.h parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
|
||||||
builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h
|
builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h
|
||||||
builtin.o: intern.h
|
builtin.o: intern.h event.h signal.h translate.h
|
||||||
builtin_commandline.o: config.h util.h builtin.h common.h wgetopt.h reader.h
|
builtin_commandline.o: signal.h config.h util.h builtin.h common.h wgetopt.h
|
||||||
builtin_commandline.o: proc.h parser.h tokenizer.h input_common.h input.h
|
builtin_commandline.o: reader.h proc.h io.h parser.h tokenizer.h
|
||||||
|
builtin_commandline.o: input_common.h input.h translate.h
|
||||||
builtin_help.o: config.h util.h common.h builtin_help.h
|
builtin_help.o: config.h util.h common.h builtin_help.h
|
||||||
builtin_set.o: config.h util.h builtin.h env.h expand.h common.h wgetopt.h
|
builtin_set.o: signal.h config.h util.h builtin.h env.h expand.h common.h
|
||||||
builtin_set.o: proc.h parser.h
|
builtin_set.o: wgetopt.h proc.h io.h parser.h translate.h
|
||||||
common.o: config.h util.h wutil.h common.h expand.h proc.h wildcard.h
|
builtin_ulimit.o: config.h util.h builtin.h common.h wgetopt.h translate.h
|
||||||
common.o: parser.h
|
common.o: config.h signal.h util.h wutil.h common.h expand.h proc.h io.h
|
||||||
complete.o: config.h util.h tokenizer.h wildcard.h proc.h parser.h function.h
|
common.o: wildcard.h parser.h
|
||||||
complete.o: complete.h builtin.h env.h exec.h expand.h common.h reader.h
|
complete.o: signal.h config.h util.h tokenizer.h wildcard.h proc.h io.h
|
||||||
complete.o: history.h intern.h wutil.h
|
complete.o: parser.h function.h complete.h builtin.h env.h exec.h expand.h
|
||||||
env.o: config.h util.h wutil.h proc.h common.h env.h sanity.h expand.h
|
complete.o: common.h reader.h history.h intern.h translate.h wutil.h
|
||||||
env.o: history.h reader.h parser.h env_universal.h env_universal_common.h
|
env.o: config.h signal.h util.h wutil.h proc.h io.h common.h env.h sanity.h
|
||||||
env_universal.o: util.h common.h wutil.h env_universal_common.h
|
env.o: expand.h history.h reader.h parser.h env_universal.h
|
||||||
env_universal.o: env_universal.h
|
env.o: env_universal_common.h input_common.h event.h translate.h
|
||||||
env_universal_common.o: util.h common.h wutil.h env_universal_common.h
|
env_universal.o: config.h signal.h util.h common.h wutil.h
|
||||||
exec.o: config.h util.h common.h wutil.h proc.h exec.h parser.h builtin.h
|
env_universal.o: env_universal_common.h env_universal.h
|
||||||
exec.o: function.h env.h wildcard.h sanity.h expand.h env_universal.h
|
env_universal_common.o: signal.h util.h common.h wutil.h
|
||||||
exec.o: env_universal_common.h
|
env_universal_common.o: env_universal_common.h
|
||||||
expand.o: config.h util.h common.h wutil.h env.h proc.h parser.h expand.h
|
event.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
|
||||||
expand.o: wildcard.h exec.h tokenizer.h complete.h
|
event.o: event.h translate.h
|
||||||
fishd.o: util.h common.h wutil.h env_universal_common.h
|
exec.o: signal.h config.h util.h common.h wutil.h proc.h io.h exec.h parser.h
|
||||||
fish_pager.o: config.h util.h wutil.h common.h complete.h output.h
|
exec.o: builtin.h function.h env.h wildcard.h sanity.h expand.h
|
||||||
|
exec.o: env_universal.h env_universal_common.h translate.h
|
||||||
|
expand.o: signal.h config.h util.h common.h wutil.h env.h proc.h io.h
|
||||||
|
expand.o: parser.h expand.h wildcard.h exec.h tokenizer.h complete.h
|
||||||
|
fishd.o: signal.h util.h common.h wutil.h env_universal_common.h
|
||||||
|
fish_pager.o: config.h signal.h util.h wutil.h common.h complete.h output.h
|
||||||
fish_pager.o: input_common.h env_universal.h env_universal_common.h
|
fish_pager.o: input_common.h env_universal.h env_universal_common.h
|
||||||
fish_tests.o: config.h util.h common.h proc.h reader.h builtin.h function.h
|
fish_tests.o: config.h signal.h util.h common.h proc.h io.h reader.h
|
||||||
fish_tests.o: complete.h wutil.h env.h expand.h parser.h tokenizer.h
|
fish_tests.o: builtin.h function.h complete.h wutil.h env.h expand.h parser.h
|
||||||
function.o: config.h util.h function.h proc.h parser.h common.h intern.h
|
fish_tests.o: tokenizer.h output.h exec.h event.h
|
||||||
highlight.o: config.h util.h wutil.h highlight.h tokenizer.h proc.h parser.h
|
function.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
|
||||||
highlight.o: builtin.h function.h env.h expand.h sanity.h common.h complete.h
|
function.o: intern.h event.h
|
||||||
highlight.o: output.h
|
highlight.o: signal.h config.h util.h wutil.h highlight.h tokenizer.h proc.h
|
||||||
|
highlight.o: io.h parser.h builtin.h function.h env.h expand.h sanity.h
|
||||||
|
highlight.o: common.h complete.h output.h
|
||||||
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
|
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
|
||||||
input.o: config.h util.h wutil.h reader.h proc.h common.h sanity.h
|
input.o: config.h signal.h util.h wutil.h reader.h proc.h io.h common.h
|
||||||
input.o: input_common.h input.h parser.h env.h expand.h
|
input.o: sanity.h input_common.h input.h parser.h env.h expand.h event.h
|
||||||
|
input.o: translate.h
|
||||||
input_common.o: config.h util.h common.h wutil.h input_common.h
|
input_common.o: config.h util.h common.h wutil.h input_common.h
|
||||||
input_common.o: env_universal.h env_universal_common.h
|
input_common.o: env_universal.h env_universal_common.h
|
||||||
intern.o: config.h util.h common.h intern.h
|
intern.o: config.h util.h common.h intern.h
|
||||||
kill.o: config.h util.h wutil.h kill.h proc.h sanity.h common.h env.h
|
io.o: config.h util.h wutil.h exec.h proc.h io.h common.h translate.h
|
||||||
kill.o: expand.h exec.h parser.h
|
key_reader.o: input_common.h
|
||||||
main.o: config.h util.h common.h reader.h builtin.h function.h complete.h
|
kill.o: signal.h config.h util.h wutil.h kill.h proc.h io.h sanity.h common.h
|
||||||
main.o: wutil.h env.h sanity.h proc.h parser.h expand.h intern.h
|
kill.o: env.h expand.h exec.h parser.h
|
||||||
|
main.o: config.h signal.h util.h common.h reader.h builtin.h function.h
|
||||||
|
main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h expand.h
|
||||||
|
main.o: intern.h exec.h event.h output.h translate.h
|
||||||
mimedb.o: config.h xdgmime.h util.h
|
mimedb.o: config.h xdgmime.h util.h
|
||||||
output.o: config.h util.h wutil.h expand.h common.h output.h highlight.h
|
output.o: config.h signal.h util.h wutil.h expand.h common.h output.h
|
||||||
parser.o: config.h util.h common.h wutil.h proc.h parser.h tokenizer.h exec.h
|
output.o: highlight.h
|
||||||
parser.o: wildcard.h function.h builtin.h builtin_help.h env.h expand.h
|
parser.o: signal.h config.h util.h common.h wutil.h proc.h io.h parser.h
|
||||||
parser.o: reader.h sanity.h env_universal.h env_universal_common.h
|
parser.o: tokenizer.h exec.h wildcard.h function.h builtin.h builtin_help.h
|
||||||
proc.o: config.h util.h wutil.h proc.h common.h reader.h sanity.h env.h
|
parser.o: env.h expand.h reader.h sanity.h env_universal.h
|
||||||
reader.o: config.h util.h wutil.h highlight.h reader.h proc.h parser.h
|
parser.o: env_universal_common.h event.h translate.h
|
||||||
reader.o: complete.h history.h common.h sanity.h env.h exec.h expand.h
|
proc.o: config.h signal.h util.h wutil.h proc.h io.h common.h reader.h
|
||||||
reader.o: tokenizer.h kill.h input_common.h input.h function.h output.h
|
proc.o: sanity.h env.h parser.h event.h translate.h
|
||||||
sanity.o: config.h util.h common.h sanity.h proc.h history.h reader.h kill.h
|
reader.o: config.h signal.h util.h wutil.h highlight.h reader.h proc.h io.h
|
||||||
sanity.o: wutil.h
|
reader.o: parser.h complete.h history.h common.h sanity.h env.h exec.h
|
||||||
|
reader.o: expand.h tokenizer.h kill.h input_common.h input.h function.h
|
||||||
|
reader.o: output.h translate.h
|
||||||
|
sanity.o: signal.h config.h util.h common.h sanity.h proc.h io.h history.h
|
||||||
|
sanity.o: reader.h kill.h wutil.h
|
||||||
set_color.o: config.h
|
set_color.o: config.h
|
||||||
tokenize.o: config.h
|
signal.o: config.h signal.h common.h util.h wutil.h event.h reader.h proc.h
|
||||||
|
signal.o: io.h translate.h
|
||||||
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h
|
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h
|
||||||
|
tokenizer.o: translate.h
|
||||||
|
translate.o: config.h common.h util.h
|
||||||
util.o: config.h util.h common.h wutil.h
|
util.o: config.h util.h common.h wutil.h
|
||||||
wgetopt.o: config.h wgetopt.h wutil.h
|
wgetopt.o: config.h wgetopt.h wutil.h
|
||||||
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
|
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
|
||||||
wildcard.o: expand.h
|
wildcard.o: expand.h translate.h
|
||||||
wutil.o: config.h util.h common.h wutil.h
|
wutil.o: config.h util.h common.h wutil.h
|
||||||
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
|
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
|
||||||
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
|
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
|
||||||
|
|||||||
19
builtin.h
19
builtin.h
@@ -20,27 +20,36 @@ enum
|
|||||||
/**
|
/**
|
||||||
Error message on missing argument
|
Error message on missing argument
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_ERR_MISSING L": Expected argument"
|
#define BUILTIN_ERR_MISSING _( L"%ls: Expected argument\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Error message on invalid combination of options
|
Error message on invalid combination of options
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_ERR_COMBO L": Invalid combination of options"
|
#define BUILTIN_ERR_COMBO _( L"%ls: Invalid combination of options\n" )
|
||||||
|
|
||||||
|
/**
|
||||||
|
Error message on invalid combination of options
|
||||||
|
*/
|
||||||
|
#define BUILTIN_ERR_COMBO2 _( L"%ls: Invalid combination of options,\n%ls\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Error message on multiple scope levels for variables
|
Error message on multiple scope levels for variables
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_ERR_GLOCAL L": Variable can only be one of universal, global and local"
|
#define BUILTIN_ERR_GLOCAL _( L"%ls: Variable scope can only be one of universal, global and local\n%ls\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Error message for specifying both export and unexport to set/read
|
Error message for specifying both export and unexport to set/read
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_ERR_EXPUNEXP L": Variable can't be both exported and unexported"
|
#define BUILTIN_ERR_EXPUNEXP _( L"%ls: Variable can't be both exported and unexported\n%ls\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Error message for unknown switch
|
Error message for unknown switch
|
||||||
*/
|
*/
|
||||||
#define BUILTIN_ERR_UNKNOWN L": Unknown option"
|
#define BUILTIN_ERR_UNKNOWN _( L"%ls: Unknown option '%ls'\n" )
|
||||||
|
|
||||||
|
#define BUILTIN_ERR_VARCHAR _( L"%ls: Invalid character '%lc' in variable name. Only alphanumerical characters and underscores are valid in a variable name.\n" )
|
||||||
|
|
||||||
|
#define BUILTIN_ERR_VARNAME_ZERO _( L"%ls: Variable name can not be the empty string\n" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stringbuffer used to represent standard output
|
Stringbuffer used to represent standard output
|
||||||
|
|||||||
@@ -22,16 +22,17 @@ Functions used for implementing the commandline builtin.
|
|||||||
#include "tokenizer.h"
|
#include "tokenizer.h"
|
||||||
#include "input_common.h"
|
#include "input_common.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "translate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Which part of the comandbuffer are we operating on
|
Which part of the comandbuffer are we operating on
|
||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
STRING_MODE=1, // Operate on entire buffer
|
STRING_MODE=1, /**< Operate on entire buffer */
|
||||||
JOB_MODE, // Operate on job under cursor
|
JOB_MODE, /**< Operate on job under cursor */
|
||||||
PROCESS_MODE, // Operate on process under cursor
|
PROCESS_MODE, /**< Operate on process under cursor */
|
||||||
TOKEN_MODE // Operate on token under cursor
|
TOKEN_MODE /**< Operate on token under cursor */
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -40,9 +41,9 @@ enum
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
REPLACE_MODE=1, // Replace current text
|
REPLACE_MODE=1, /**< Replace current text */
|
||||||
INSERT_MODE, // Insert at cursor position
|
INSERT_MODE, /**< Insert at cursor position */
|
||||||
APPEND_MODE // Insert at end of current token/command/buffer
|
APPEND_MODE /**< Insert at end of current token/command/buffer */
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -66,10 +67,6 @@ static void replace_part( wchar_t *begin,
|
|||||||
|
|
||||||
sb_init( &out );
|
sb_init( &out );
|
||||||
|
|
||||||
// wchar_t *tmp = wcsndup( begin, end-begin );
|
|
||||||
|
|
||||||
// fwprintf( stderr, L"Commandline '%ls', current command '%ls'\n", reader_get_buffer(), tmp );
|
|
||||||
|
|
||||||
sb_append_substring( &out, buff, begin-buff );
|
sb_append_substring( &out, buff, begin-buff );
|
||||||
|
|
||||||
switch( append_mode)
|
switch( append_mode)
|
||||||
@@ -253,7 +250,7 @@ int builtin_commandline( wchar_t **argv )
|
|||||||
|
|
||||||
int opt = wgetopt_long( argc,
|
int opt = wgetopt_long( argc,
|
||||||
argv,
|
argv,
|
||||||
L"aijpctwfo",
|
L"aijpctwfor",
|
||||||
long_options,
|
long_options,
|
||||||
&opt_index );
|
&opt_index );
|
||||||
if( opt == -1 )
|
if( opt == -1 )
|
||||||
@@ -264,13 +261,10 @@ int builtin_commandline( wchar_t **argv )
|
|||||||
case 0:
|
case 0:
|
||||||
if(long_options[opt_index].flag != 0)
|
if(long_options[opt_index].flag != 0)
|
||||||
break;
|
break;
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
BUILTIN_ERR_UNKNOWN,
|
||||||
BUILTIN_ERR_UNKNOWN,
|
argv[0],
|
||||||
L" ",
|
long_options[opt_index].name );
|
||||||
long_options[opt_index].name,
|
|
||||||
L"\n",
|
|
||||||
(void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -282,7 +276,11 @@ int builtin_commandline( wchar_t **argv )
|
|||||||
case L'i':
|
case L'i':
|
||||||
append_mode = INSERT_MODE;
|
append_mode = INSERT_MODE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case L'r':
|
||||||
|
append_mode = REPLACE_MODE;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
cut_at_cursor=1;
|
cut_at_cursor=1;
|
||||||
break;
|
break;
|
||||||
@@ -322,10 +320,11 @@ int builtin_commandline( wchar_t **argv )
|
|||||||
*/
|
*/
|
||||||
if( buffer_part || cut_at_cursor || append_mode || tokenize )
|
if( buffer_part || cut_at_cursor || append_mode || tokenize )
|
||||||
{
|
{
|
||||||
|
sb_printf(sb_err,
|
||||||
|
BUILTIN_ERR_COMBO,
|
||||||
|
argv[0] );
|
||||||
|
|
||||||
sb_append2(sb_err,
|
sb_append2(sb_err,
|
||||||
argv[0],
|
|
||||||
BUILTIN_ERR_COMBO,
|
|
||||||
L"\n",
|
|
||||||
parser_current_line(),
|
parser_current_line(),
|
||||||
L"\n",
|
L"\n",
|
||||||
(void *)0);
|
(void *)0);
|
||||||
@@ -335,10 +334,11 @@ int builtin_commandline( wchar_t **argv )
|
|||||||
|
|
||||||
if( argc == woptind )
|
if( argc == woptind )
|
||||||
{
|
{
|
||||||
|
sb_printf( sb_err,
|
||||||
|
BUILTIN_ERR_MISSING,
|
||||||
|
argv[0] );
|
||||||
|
|
||||||
sb_append2( sb_err,
|
sb_append2( sb_err,
|
||||||
argv[0],
|
|
||||||
BUILTIN_ERR_MISSING,
|
|
||||||
L"\n",
|
|
||||||
parser_current_line(),
|
parser_current_line(),
|
||||||
L"\n",
|
L"\n",
|
||||||
(void *)0 );
|
(void *)0 );
|
||||||
@@ -394,22 +394,23 @@ int builtin_commandline( wchar_t **argv )
|
|||||||
if( (tokenize || cut_at_cursor) && (argc-woptind) )
|
if( (tokenize || cut_at_cursor) && (argc-woptind) )
|
||||||
{
|
{
|
||||||
|
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
BUILTIN_ERR_COMBO2,
|
||||||
BUILTIN_ERR_COMBO,
|
argv[0],
|
||||||
L",\n --cut-at-cursor and --tokenize can not be used when setting the commandline",
|
L"--cut-at-cursor and --tokenize can not be used when setting the commandline" );
|
||||||
(void *)0 );
|
|
||||||
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( append_mode && !(argc-woptind) )
|
if( append_mode && !(argc-woptind) )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
|
BUILTIN_ERR_COMBO2,
|
||||||
argv[0],
|
argv[0],
|
||||||
BUILTIN_ERR_COMBO,
|
L"insertion mode switches can not be used when not in insertion mode" );
|
||||||
L",\n insertion mode switches can not be used when not in insertion mode",
|
|
||||||
(void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ Functions used for implementing the set builtin.
|
|||||||
#include "wgetopt.h"
|
#include "wgetopt.h"
|
||||||
#include "proc.h"
|
#include "proc.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
#include "translate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extract the name from a destination argument of the form name[index1 index2...]
|
Extract the name from a destination argument of the form name[index1 index2...]
|
||||||
@@ -40,10 +41,8 @@ static int parse_fill_name( string_buffer_t *name,
|
|||||||
|
|
||||||
if (*src != L'[' && *src != L'\0')
|
if (*src != L'[' && *src != L'\0')
|
||||||
{
|
{
|
||||||
|
sb_printf( sb_err, BUILTIN_ERR_VARCHAR, L"set", *src );
|
||||||
sb_append(sb_err, L"set: Invalid character in variable name: ");
|
sb_append2(sb_err, parser_current_line(), L"\n", (void *)0 );
|
||||||
sb_append_char(sb_err, *src);
|
|
||||||
sb_append2(sb_err, L"\n", parser_current_line(), L"\n", (void *)0 );
|
|
||||||
// builtin_print_help( L"set", sb_err );
|
// builtin_print_help( L"set", sb_err );
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -83,7 +82,7 @@ static int parse_fill_indexes( array_list_t *indexes,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (iswblank(*src))
|
while (iswspace(*src))
|
||||||
{
|
{
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
@@ -94,9 +93,7 @@ static int parse_fill_indexes( array_list_t *indexes,
|
|||||||
long l_ind = wcstol(src, &end, 10);
|
long l_ind = wcstol(src, &end, 10);
|
||||||
if (end == src)
|
if (end == src)
|
||||||
{
|
{
|
||||||
wchar_t sbuf[256];
|
sb_printf(sb_err, _(L"%ls: Invalid index starting at '%ls'\n"), L"set", src);
|
||||||
swprintf(sbuf, 255, L"Invalid index starting at %ls\n", src);
|
|
||||||
sb_append(sb_err, sbuf);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +102,7 @@ static int parse_fill_indexes( array_list_t *indexes,
|
|||||||
al_push(indexes, ind);
|
al_push(indexes, ind);
|
||||||
src = end;
|
src = end;
|
||||||
count++;
|
count++;
|
||||||
while (iswblank(*src)) src++;
|
while (iswspace(*src)) src++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
@@ -292,7 +289,7 @@ int builtin_set( wchar_t **argv )
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
wchar_t short_options[] = L"xglenuUq";
|
wchar_t short_options[] = L"+xglenuUq";
|
||||||
|
|
||||||
int argc = builtin_count_args(argv);
|
int argc = builtin_count_args(argv);
|
||||||
|
|
||||||
@@ -364,13 +361,11 @@ int builtin_set( wchar_t **argv )
|
|||||||
|
|
||||||
if( query && (erase || list || global || local || universal || export || unexport ) )
|
if( query && (erase || list || global || local || universal || export || unexport ) )
|
||||||
{
|
{
|
||||||
sb_append2(sb_err,
|
sb_printf(sb_err,
|
||||||
|
BUILTIN_ERR_COMBO2,
|
||||||
argv[0],
|
argv[0],
|
||||||
BUILTIN_ERR_COMBO,
|
parser_current_line() );
|
||||||
L"\n",
|
|
||||||
parser_current_line(),
|
|
||||||
L"\n",
|
|
||||||
(void *)0);
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -379,13 +374,11 @@ int builtin_set( wchar_t **argv )
|
|||||||
/* Check operation and modifiers sanity */
|
/* Check operation and modifiers sanity */
|
||||||
if( erase && list )
|
if( erase && list )
|
||||||
{
|
{
|
||||||
sb_append2(sb_err,
|
sb_printf(sb_err,
|
||||||
|
BUILTIN_ERR_COMBO2,
|
||||||
argv[0],
|
argv[0],
|
||||||
BUILTIN_ERR_COMBO,
|
parser_current_line() );
|
||||||
L"\n",
|
|
||||||
parser_current_line(),
|
|
||||||
L"\n",
|
|
||||||
(void *)0);
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -393,9 +386,8 @@ int builtin_set( wchar_t **argv )
|
|||||||
if( local + global + universal > 1 )
|
if( local + global + universal > 1 )
|
||||||
{
|
{
|
||||||
sb_printf( sb_err,
|
sb_printf( sb_err,
|
||||||
L"%ls%ls\n%ls\n",
|
|
||||||
argv[0],
|
|
||||||
BUILTIN_ERR_GLOCAL,
|
BUILTIN_ERR_GLOCAL,
|
||||||
|
argv[0],
|
||||||
parser_current_line() );
|
parser_current_line() );
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
@@ -403,13 +395,10 @@ int builtin_set( wchar_t **argv )
|
|||||||
|
|
||||||
if( export && unexport )
|
if( export && unexport )
|
||||||
{
|
{
|
||||||
sb_append2(sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
|
||||||
BUILTIN_ERR_EXPUNEXP,
|
BUILTIN_ERR_EXPUNEXP,
|
||||||
L"\n",
|
argv[0],
|
||||||
parser_current_line(),
|
parser_current_line() );
|
||||||
L"\n",
|
|
||||||
(void *)0);
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -435,6 +424,13 @@ int builtin_set( wchar_t **argv )
|
|||||||
{
|
{
|
||||||
dest = wcsdup(argv[woptind++]);
|
dest = wcsdup(argv[woptind++]);
|
||||||
//fwprintf(stderr, L"Dest: %ls\n", dest);
|
//fwprintf(stderr, L"Dest: %ls\n", dest);
|
||||||
|
|
||||||
|
if( !wcslen( dest ) )
|
||||||
|
{
|
||||||
|
free( dest );
|
||||||
|
sb_printf( sb_err, BUILTIN_ERR_VARNAME_ZERO, argv[0] );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse values */
|
/* Parse values */
|
||||||
@@ -488,12 +484,11 @@ int builtin_set( wchar_t **argv )
|
|||||||
/* No arguments -- display name & value for all variables in scope */
|
/* No arguments -- display name & value for all variables in scope */
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
_(L"%ls: Erase needs a variable name\n%ls\n"),
|
||||||
L": Erase needs a variable name\n",
|
argv[0],
|
||||||
parser_current_line(),
|
parser_current_line() );
|
||||||
L"\n",
|
|
||||||
(void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
retcode = 1;
|
retcode = 1;
|
||||||
}
|
}
|
||||||
@@ -526,12 +521,11 @@ int builtin_set( wchar_t **argv )
|
|||||||
/* There are some arguments, we have at least a variable name */
|
/* There are some arguments, we have at least a variable name */
|
||||||
if( erase && al_get_count(&values) != 0 )
|
if( erase && al_get_count(&values) != 0 )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
_(L"%ls: Values cannot be specfied with erase\n%ls\n"),
|
||||||
L": Values cannot be specfied with erase\n",
|
argv[0],
|
||||||
parser_current_line(),
|
parser_current_line() );
|
||||||
L"\n",
|
|
||||||
(void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
retcode = 1;
|
retcode = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ Functions used for implementing the ulimit builtin.
|
|||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "wgetopt.h"
|
#include "wgetopt.h"
|
||||||
|
#include "translate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Struct describing a resource limit
|
Struct describing a resource limit
|
||||||
@@ -35,6 +36,10 @@ struct resource_t
|
|||||||
Switch used on commandline to specify resource
|
Switch used on commandline to specify resource
|
||||||
*/
|
*/
|
||||||
wchar_t switch_char;
|
wchar_t switch_char;
|
||||||
|
/**
|
||||||
|
The implicit multiplier used when setting getting values
|
||||||
|
*/
|
||||||
|
int multiplier;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -44,49 +49,55 @@ struct resource_t
|
|||||||
const static struct resource_t resource_arr[] =
|
const static struct resource_t resource_arr[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
RLIMIT_CORE, L"Maximum size of core files created", L'c'
|
RLIMIT_CORE, L"Maximum size of core files created", L'c', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_DATA, L"Maximum size of a process’s data segment", L'd'
|
RLIMIT_DATA, L"Maximum size of a process’s data segment", L'd', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f'
|
RLIMIT_FSIZE, L"Maximum size of files created by the shell", L'f', 1024
|
||||||
|
}
|
||||||
|
,
|
||||||
|
#if HAVE_RLIMIT_MEMLOCK
|
||||||
|
{
|
||||||
|
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l', 1024
|
||||||
|
}
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
#if HAVE_RLIMIT_RSS
|
||||||
|
{
|
||||||
|
RLIMIT_RSS, L"Maximum resident set size", L'm', 1024
|
||||||
|
}
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
RLIMIT_NOFILE, L"Maximum number of open file descriptors", L'n', 1
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_MEMLOCK, L"Maximum size that may be locked into memory", L'l'
|
RLIMIT_STACK, L"Maximum stack size", L's', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
RLIMIT_RSS, L"Maximum resident set size", L'm'
|
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't', 1
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
#if HAVE_RLIMIT_NPROC
|
||||||
{
|
{
|
||||||
RLIMIT_NOFILE, L"Maximum number of open file descriptors", L'n'
|
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u', 1
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
RLIMIT_STACK, L"Maximum stack size", L's'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
RLIMIT_CPU, L"Maximum amount of cpu time in seconds", L't'
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
RLIMIT_NPROC, L"Maximum number of processes available to a single user", L'u'
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
#endif
|
||||||
#if HAVE_RLIMIT_AS
|
#if HAVE_RLIMIT_AS
|
||||||
{
|
{
|
||||||
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v'
|
RLIMIT_AS, L"Maximum amount of virtual memory available to the shell", L'v', 1024
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
0, 0
|
0, 0, 0, 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -96,13 +107,16 @@ const static struct resource_t resource_arr[] =
|
|||||||
*/
|
*/
|
||||||
static int get_multiplier( int what )
|
static int get_multiplier( int what )
|
||||||
{
|
{
|
||||||
if( ( what == RLIMIT_NPROC ) ||
|
int i;
|
||||||
( what == RLIMIT_NOFILE ) ||
|
|
||||||
( what == RLIMIT_CPU ) )
|
for( i=0; resource_arr[i].desc; i++ )
|
||||||
{
|
{
|
||||||
return 1;
|
if( resource_arr[i].resource == what )
|
||||||
|
{
|
||||||
|
return resource_arr[i].multiplier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1024;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,13 +345,10 @@ int builtin_ulimit( wchar_t ** argv )
|
|||||||
case 0:
|
case 0:
|
||||||
if(long_options[opt_index].flag != 0)
|
if(long_options[opt_index].flag != 0)
|
||||||
break;
|
break;
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
BUILTIN_ERR_UNKNOWN,
|
||||||
BUILTIN_ERR_UNKNOWN,
|
argv[0],
|
||||||
L" ",
|
long_options[opt_index].name );
|
||||||
long_options[opt_index].name,
|
|
||||||
L"\n",
|
|
||||||
(void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -365,14 +376,17 @@ int builtin_ulimit( wchar_t ** argv )
|
|||||||
case L'f':
|
case L'f':
|
||||||
what=RLIMIT_FSIZE;
|
what=RLIMIT_FSIZE;
|
||||||
break;
|
break;
|
||||||
|
#if HAVE_RLIMIT_MEMLOCK
|
||||||
case L'l':
|
case L'l':
|
||||||
what=RLIMIT_MEMLOCK;
|
what=RLIMIT_MEMLOCK;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_RLIMIT_RSS
|
||||||
case L'm':
|
case L'm':
|
||||||
what=RLIMIT_RSS;
|
what=RLIMIT_RSS;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case L'n':
|
case L'n':
|
||||||
what=RLIMIT_NOFILE;
|
what=RLIMIT_NOFILE;
|
||||||
@@ -385,10 +399,12 @@ int builtin_ulimit( wchar_t ** argv )
|
|||||||
case L't':
|
case L't':
|
||||||
what=RLIMIT_CPU;
|
what=RLIMIT_CPU;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if HAVE_RLIMIT_NPROC
|
||||||
case L'u':
|
case L'u':
|
||||||
what=RLIMIT_NPROC;
|
what=RLIMIT_NPROC;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_RLIMIT_AS
|
#if HAVE_RLIMIT_AS
|
||||||
case L'v':
|
case L'v':
|
||||||
|
|||||||
692
common.c
692
common.c
@@ -13,6 +13,7 @@ parts of fish.
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
@@ -103,8 +104,17 @@ static struct winsize termsize;
|
|||||||
*/
|
*/
|
||||||
static int block_count=0;
|
static int block_count=0;
|
||||||
|
|
||||||
|
static string_buffer_t *setlocale_buff=0;
|
||||||
|
|
||||||
|
|
||||||
void common_destroy()
|
void common_destroy()
|
||||||
{
|
{
|
||||||
|
if( setlocale_buff )
|
||||||
|
{
|
||||||
|
sb_destroy( setlocale_buff );
|
||||||
|
free( setlocale_buff );
|
||||||
|
}
|
||||||
|
|
||||||
debug( 3, L"Calls: wcsdupcat %d, wcsdupcat2 %d, wcsndup %d, str2wcs %d, wcs2str %d", c1, c2, c3, c4, c5 );
|
debug( 3, L"Calls: wcsdupcat %d, wcsdupcat2 %d, wcsndup %d, str2wcs %d, wcs2str %d", c1, c2, c3, c4, c5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +262,6 @@ wchar_t *str2wcs( const char *in )
|
|||||||
if( !res )
|
if( !res )
|
||||||
{
|
{
|
||||||
die_mem();
|
die_mem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (size_t)-1 == mbstowcs( res, in, sizeof(wchar_t)*(strlen(in)) +1) )
|
if( (size_t)-1 == mbstowcs( res, in, sizeof(wchar_t)*(strlen(in)) +1) )
|
||||||
@@ -299,7 +308,7 @@ char *wcs2str( const wchar_t *in )
|
|||||||
in,
|
in,
|
||||||
MAX_UTF8_BYTES*wcslen(in)+1 );
|
MAX_UTF8_BYTES*wcslen(in)+1 );
|
||||||
|
|
||||||
res = realloc( res, strlen( res )+1 );
|
// res = realloc( res, strlen( res )+1 );
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -314,8 +323,7 @@ char **wcsv2strv( const wchar_t **in )
|
|||||||
char **res = malloc( sizeof( char *)*(count+1));
|
char **res = malloc( sizeof( char *)*(count+1));
|
||||||
if( res == 0 )
|
if( res == 0 )
|
||||||
{
|
{
|
||||||
die_mem();
|
die_mem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i=0; i<count; i++ )
|
for( i=0; i<count; i++ )
|
||||||
@@ -353,8 +361,10 @@ wchar_t *wcsdupcat2( const wchar_t *a, ... )
|
|||||||
|
|
||||||
wchar_t *res = malloc( sizeof(wchar_t)*(len +1 ));
|
wchar_t *res = malloc( sizeof(wchar_t)*(len +1 ));
|
||||||
if( res == 0 )
|
if( res == 0 )
|
||||||
return 0;
|
{
|
||||||
|
die_mem();
|
||||||
|
}
|
||||||
|
|
||||||
wcscpy( res, a );
|
wcscpy( res, a );
|
||||||
pos = wcslen(a);
|
pos = wcslen(a);
|
||||||
while( (arg=va_arg(va2, wchar_t *) )!= 0 )
|
while( (arg=va_arg(va2, wchar_t *) )!= 0 )
|
||||||
@@ -391,7 +401,7 @@ wchar_t **strv2wcsv( const char **in )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSNDUP
|
||||||
wchar_t *wcsndup( const wchar_t *in, int c )
|
wchar_t *wcsndup( const wchar_t *in, int c )
|
||||||
{
|
{
|
||||||
c3++;
|
c3++;
|
||||||
@@ -405,6 +415,7 @@ wchar_t *wcsndup( const wchar_t *in, int c )
|
|||||||
res[c] = L'\0';
|
res[c] = L'\0';
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
long convert_digit( wchar_t d, int base )
|
long convert_digit( wchar_t d, int base )
|
||||||
{
|
{
|
||||||
@@ -489,17 +500,6 @@ long wcstol(const wchar_t *nptr,
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
Appends src to string dst of size siz (unlike wcsncat, siz is the
|
|
||||||
full size of dst, not space left). At most siz-1 characters will be
|
|
||||||
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
|
|
||||||
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
|
|
||||||
truncation occurred.
|
|
||||||
|
|
||||||
This is the OpenBSD strlcat function, modified for wide characters,
|
|
||||||
and renamed to reflect this change.
|
|
||||||
|
|
||||||
*/
|
|
||||||
size_t
|
size_t
|
||||||
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
|
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
|
||||||
{
|
{
|
||||||
@@ -552,14 +552,6 @@ wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
Copy src to string dst of size siz. At most siz-1 characters will
|
|
||||||
be copied. Always NUL terminates (unless siz == 0). Returns
|
|
||||||
wcslen(src); if retval >= siz, truncation occurred.
|
|
||||||
|
|
||||||
This is the OpenBSD strlcpy function, modified for wide characters,
|
|
||||||
and renamed to reflect this change.
|
|
||||||
*/
|
|
||||||
size_t
|
size_t
|
||||||
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
|
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
|
||||||
{
|
{
|
||||||
@@ -591,9 +583,7 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
|
|||||||
/* count does not include NUL */
|
/* count does not include NUL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#ifndef HAVE_WCSDUP
|
||||||
Fallback implementation if missing from libc
|
|
||||||
*/
|
|
||||||
wchar_t *wcsdup( const wchar_t *in )
|
wchar_t *wcsdup( const wchar_t *in )
|
||||||
{
|
{
|
||||||
size_t len=wcslen(in);
|
size_t len=wcslen(in);
|
||||||
@@ -601,17 +591,26 @@ wchar_t *wcsdup( const wchar_t *in )
|
|||||||
if( out == 0 )
|
if( out == 0 )
|
||||||
{
|
{
|
||||||
die_mem();
|
die_mem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( out, in, sizeof( wchar_t)*(len+1));
|
memcpy( out, in, sizeof( wchar_t)*(len+1));
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
#ifndef HAVE_WCSLEN
|
||||||
Fallback implementation if missing from libc
|
size_t wcslen(const wchar_t *in)
|
||||||
*/
|
{
|
||||||
|
const wchar_t *end=in;
|
||||||
|
while( *end )
|
||||||
|
end++;
|
||||||
|
return end-in;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSCASECMP
|
||||||
int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
||||||
{
|
{
|
||||||
if( *a == 0 )
|
if( *a == 0 )
|
||||||
@@ -628,10 +627,10 @@ int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
|||||||
else
|
else
|
||||||
return wcscasecmp( a+1,b+1);
|
return wcscasecmp( a+1,b+1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Fallback implementation if missing from libc
|
#ifndef HAVE_WCSNCASECMP
|
||||||
*/
|
|
||||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
||||||
{
|
{
|
||||||
if( count == 0 )
|
if( count == 0 )
|
||||||
@@ -651,6 +650,7 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
|||||||
else
|
else
|
||||||
return wcsncasecmp( a+1,b+1, count-1);
|
return wcsncasecmp( a+1,b+1, count-1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int wcsvarname( wchar_t *str )
|
int wcsvarname( wchar_t *str )
|
||||||
{
|
{
|
||||||
@@ -706,66 +706,55 @@ int my_wcswidth( const wchar_t *c )
|
|||||||
|
|
||||||
wchar_t *quote_end( const wchar_t *in )
|
wchar_t *quote_end( const wchar_t *in )
|
||||||
{
|
{
|
||||||
int level=1;
|
switch( *in )
|
||||||
int offset = (*in != L'\"');
|
|
||||||
|
|
||||||
in++;
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
{
|
||||||
/* fwprintf( stderr, L"Check %c\n", *tok->buff );*/
|
case '"':
|
||||||
switch( *in )
|
|
||||||
{
|
{
|
||||||
case L'\\':
|
while(1)
|
||||||
in++;
|
{
|
||||||
if( *in == L'\0' )
|
in = wcschr( in+1, L'"' );
|
||||||
{
|
if( !in )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
if( *(in-1) != L'\\' )
|
||||||
break;
|
return (wchar_t *)in;
|
||||||
case L'\"':
|
}
|
||||||
case L'\'':
|
}
|
||||||
if( (((level+offset) % 2)?L'\"':L'\'') == *in )
|
case '\'':
|
||||||
{
|
{
|
||||||
level--;
|
return wcschr( in+1, L'\'' );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if( (*in == L'\0') ||(level==0))
|
|
||||||
break;
|
|
||||||
|
|
||||||
in++;
|
|
||||||
}
|
}
|
||||||
return level?0:(wchar_t *)in;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fish_setlocale(int category, const wchar_t *locale)
|
const wchar_t *wsetlocale(int category, const wchar_t *locale)
|
||||||
{
|
{
|
||||||
char *lang = wcs2str( locale );
|
|
||||||
setlocale(category,lang);
|
char *lang = locale?wcs2str( locale ):0;
|
||||||
|
char * res = setlocale(category,lang);
|
||||||
|
|
||||||
free( lang );
|
free( lang );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use ellipsis if on known unicode system, otherwise use $
|
Use ellipsis if on known unicode system, otherwise use $
|
||||||
*/
|
*/
|
||||||
if( wcslen( locale ) )
|
char *ctype = setlocale( LC_CTYPE, (void *)0 );
|
||||||
|
ellipsis_char = (strstr( ctype, ".UTF")||strstr( ctype, ".utf") )?L'\u2026':L'$';
|
||||||
|
|
||||||
|
if( !res )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( !setlocale_buff )
|
||||||
{
|
{
|
||||||
ellipsis_char = wcsstr( locale, L".UTF")?L'\u2026':L'$';
|
setlocale_buff = malloc( sizeof(string_buffer_t) );
|
||||||
}
|
sb_init( setlocale_buff);
|
||||||
else
|
|
||||||
{
|
|
||||||
char *lang = getenv( "LANG" );
|
|
||||||
if( lang )
|
|
||||||
ellipsis_char = strstr( lang, ".UTF")?L'\u2026':L'$';
|
|
||||||
else
|
|
||||||
ellipsis_char = L'$';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sb_clear( setlocale_buff );
|
||||||
|
sb_printf( setlocale_buff, L"%s", res );
|
||||||
|
|
||||||
|
return (wchar_t *)setlocale_buff->buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
int contains_str( const wchar_t *a, ... )
|
int contains_str( const wchar_t *a, ... )
|
||||||
@@ -810,18 +799,19 @@ int writeb( tputs_arg_t b )
|
|||||||
|
|
||||||
void die_mem()
|
void die_mem()
|
||||||
{
|
{
|
||||||
debug( 0, L"Out of memory, shutting down fish." );
|
/*
|
||||||
|
Do not translate this message, and do not send it through the
|
||||||
|
usual channels. This increases the odds that the message gets
|
||||||
|
through correctly, even if we are out of memory.
|
||||||
|
*/
|
||||||
|
fwprintf( stderr, L"Out of memory, shutting down fish.\n" );
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug( int level, wchar_t *msg, ... )
|
void debug( int level, const wchar_t *msg, ... )
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
string_buffer_t sb;
|
string_buffer_t sb;
|
||||||
wchar_t *start, *pos;
|
|
||||||
int line_width = 0;
|
|
||||||
int tok_width = 0;
|
|
||||||
int screen_width = common_get_width();
|
|
||||||
|
|
||||||
if( level > debug_level )
|
if( level > debug_level )
|
||||||
return;
|
return;
|
||||||
@@ -832,10 +822,22 @@ void debug( int level, wchar_t *msg, ... )
|
|||||||
sb_printf( &sb, L"%ls: ", program_name );
|
sb_printf( &sb, L"%ls: ", program_name );
|
||||||
sb_vprintf( &sb, msg, va );
|
sb_vprintf( &sb, msg, va );
|
||||||
va_end( va );
|
va_end( va );
|
||||||
|
|
||||||
|
write_screen( (wchar_t *)sb.buff );
|
||||||
|
|
||||||
|
sb_destroy( &sb );
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_screen( const wchar_t *msg )
|
||||||
|
{
|
||||||
|
const wchar_t *start, *pos;
|
||||||
|
int line_width = 0;
|
||||||
|
int tok_width = 0;
|
||||||
|
int screen_width = common_get_width();
|
||||||
|
|
||||||
if( screen_width )
|
if( screen_width )
|
||||||
{
|
{
|
||||||
start = pos = (wchar_t *)sb.buff;
|
start = pos = msg;
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
int overflow = 0;
|
int overflow = 0;
|
||||||
@@ -907,11 +909,9 @@ void debug( int level, wchar_t *msg, ... )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fwprintf( stderr, L"%ls", sb.buff );
|
fwprintf( stderr, L"%ls", msg );
|
||||||
|
|
||||||
}
|
}
|
||||||
putwc( L'\n', stderr );
|
putwc( L'\n', stderr );
|
||||||
sb_destroy( &sb );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t *escape( const wchar_t *in,
|
wchar_t *escape( const wchar_t *in,
|
||||||
@@ -959,9 +959,10 @@ wchar_t *escape( const wchar_t *in,
|
|||||||
case L'^':
|
case L'^':
|
||||||
case L'<':
|
case L'<':
|
||||||
case L'>':
|
case L'>':
|
||||||
case L'@':
|
|
||||||
case L'(':
|
case L'(':
|
||||||
case L')':
|
case L')':
|
||||||
|
case L'[':
|
||||||
|
case L']':
|
||||||
case L'{':
|
case L'{':
|
||||||
case L'}':
|
case L'}':
|
||||||
case L'?':
|
case L'?':
|
||||||
@@ -970,8 +971,9 @@ wchar_t *escape( const wchar_t *in,
|
|||||||
case L';':
|
case L';':
|
||||||
case L':':
|
case L':':
|
||||||
case L'\'':
|
case L'\'':
|
||||||
case L'\"':
|
case L'"':
|
||||||
case L'%':
|
case L'%':
|
||||||
|
case L'~':
|
||||||
if( escape_all )
|
if( escape_all )
|
||||||
*pos++ = L'\\';
|
*pos++ = L'\\';
|
||||||
*pos++ = *in;
|
*pos++ = *in;
|
||||||
@@ -997,8 +999,10 @@ wchar_t *escape( const wchar_t *in,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wchar_t *unescape( const wchar_t * orig, int escape_special )
|
wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int mode = 0;
|
||||||
int in_pos, out_pos, len = wcslen( orig );
|
int in_pos, out_pos, len = wcslen( orig );
|
||||||
int c;
|
int c;
|
||||||
int bracket_count=0;
|
int bracket_count=0;
|
||||||
@@ -1007,194 +1011,346 @@ wchar_t *unescape( const wchar_t * orig, int escape_special )
|
|||||||
if( !in )
|
if( !in )
|
||||||
die_mem();
|
die_mem();
|
||||||
|
|
||||||
for( in_pos=0, out_pos=0; in_pos<len; prev=in[out_pos], out_pos++, in_pos++ )
|
for( in_pos=0, out_pos=0;
|
||||||
|
in_pos<len;
|
||||||
|
(prev=(out_pos>=0)?in[out_pos]:0), out_pos++, in_pos++ )
|
||||||
{
|
{
|
||||||
c = in[in_pos];
|
c = in[in_pos];
|
||||||
if( c == L'\\' )
|
switch( mode )
|
||||||
{
|
{
|
||||||
switch( in[++in_pos] )
|
|
||||||
|
/*
|
||||||
|
Mode 0 means unquoted string
|
||||||
|
*/
|
||||||
|
case 0:
|
||||||
{
|
{
|
||||||
case L'\0':
|
if( c == L'\\' )
|
||||||
free(in);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case L'n':
|
|
||||||
in[out_pos]=L'\n';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'r':
|
|
||||||
in[out_pos]=L'\r';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L't':
|
|
||||||
in[out_pos]=L'\t';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'b':
|
|
||||||
in[out_pos]=L'\b';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'e':
|
|
||||||
in[out_pos]=L'\e';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'u':
|
|
||||||
case L'U':
|
|
||||||
case L'x':
|
|
||||||
case L'o':
|
|
||||||
{
|
{
|
||||||
int i;
|
switch( in[++in_pos] )
|
||||||
wchar_t res=0;
|
|
||||||
int chars=2;
|
|
||||||
int base=16;
|
|
||||||
|
|
||||||
switch( in[in_pos] )
|
|
||||||
{
|
{
|
||||||
case L'u':
|
case L'\0':
|
||||||
base=16;
|
|
||||||
chars=4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'U':
|
|
||||||
base=16;
|
|
||||||
chars=8;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'x':
|
|
||||||
base=16;
|
|
||||||
chars=2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'o':
|
|
||||||
base=8;
|
|
||||||
chars=3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i=0; i<chars; i++ )
|
|
||||||
{
|
|
||||||
int d = convert_digit( in[++in_pos],base);
|
|
||||||
if( d < 0 )
|
|
||||||
{
|
{
|
||||||
in_pos--;
|
free(in);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'n':
|
||||||
|
{
|
||||||
|
in[out_pos]=L'\n';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
res=(res*base)|d;
|
case L'r':
|
||||||
|
{
|
||||||
|
in[out_pos]=L'\r';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L't':
|
||||||
|
{
|
||||||
|
in[out_pos]=L'\t';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'b':
|
||||||
|
{
|
||||||
|
in[out_pos]=L'\b';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'e':
|
||||||
|
{
|
||||||
|
in[out_pos]=L'\e';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'u':
|
||||||
|
case L'U':
|
||||||
|
case L'x':
|
||||||
|
case L'o':
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
wchar_t res=0;
|
||||||
|
int chars=2;
|
||||||
|
int base=16;
|
||||||
|
|
||||||
|
switch( in[in_pos] )
|
||||||
|
{
|
||||||
|
case L'u':
|
||||||
|
{
|
||||||
|
base=16;
|
||||||
|
chars=4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'U':
|
||||||
|
{
|
||||||
|
base=16;
|
||||||
|
chars=8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'x':
|
||||||
|
{
|
||||||
|
base=16;
|
||||||
|
chars=2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'o':
|
||||||
|
{
|
||||||
|
base=8;
|
||||||
|
chars=3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i=0; i<chars; i++ )
|
||||||
|
{
|
||||||
|
int d = convert_digit( in[++in_pos],base);
|
||||||
|
if( d < 0 )
|
||||||
|
{
|
||||||
|
in_pos--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
res=(res*base)|d;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
in[out_pos] = res;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch( in[in_pos]){
|
||||||
|
case L'~':
|
||||||
|
{
|
||||||
|
if( unescape_special && (in_pos == 0) )
|
||||||
|
{
|
||||||
|
in[out_pos]=HOME_DIRECTORY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos] = L'~';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'%':
|
||||||
|
{
|
||||||
|
if( unescape_special && (in_pos == 0) )
|
||||||
|
{
|
||||||
|
in[out_pos]=PROCESS_EXPAND;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'*':
|
||||||
|
{
|
||||||
|
if( unescape_special )
|
||||||
|
{
|
||||||
|
if( out_pos > 0 && in[out_pos-1]==ANY_STRING )
|
||||||
|
{
|
||||||
|
out_pos--;
|
||||||
|
in[out_pos] = ANY_STRING_RECURSIVE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
in[out_pos]=ANY_STRING;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'?':
|
||||||
|
{
|
||||||
|
if( unescape_special )
|
||||||
|
{
|
||||||
|
in[out_pos]=ANY_CHAR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'$':
|
||||||
|
{
|
||||||
|
if( unescape_special )
|
||||||
|
{
|
||||||
|
in[out_pos]=VARIABLE_EXPAND;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'{':
|
||||||
|
{
|
||||||
|
if( unescape_special )
|
||||||
|
{
|
||||||
|
bracket_count++;
|
||||||
|
in[out_pos]=BRACKET_BEGIN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'}':
|
||||||
|
{
|
||||||
|
if( unescape_special )
|
||||||
|
{
|
||||||
|
bracket_count--;
|
||||||
|
in[out_pos]=BRACKET_END;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L',':
|
||||||
|
{
|
||||||
|
if( unescape_special && bracket_count && prev!=BRACKET_SEP)
|
||||||
|
{
|
||||||
|
in[out_pos]=BRACKET_SEP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'\'':
|
||||||
|
{
|
||||||
|
mode = 1;
|
||||||
|
in[out_pos] = INTERNAL_SEPARATOR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'\"':
|
||||||
|
{
|
||||||
|
mode = 2;
|
||||||
|
in[out_pos] = INTERNAL_SEPARATOR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
in[out_pos] = in[in_pos];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Mode 1 means single quoted string, i.e 'foo'
|
||||||
|
*/
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
if( c == L'\'' )
|
||||||
|
{
|
||||||
|
in[out_pos] = INTERNAL_SEPARATOR;
|
||||||
|
mode = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
in[out_pos] = in[in_pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Mode 2 means double quoted string, i.e. "foo"
|
||||||
|
*/
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
switch( c )
|
||||||
|
{
|
||||||
|
case '"':
|
||||||
|
{
|
||||||
|
mode = 0;
|
||||||
|
in[out_pos] = INTERNAL_SEPARATOR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
{
|
||||||
|
switch( in[++in_pos] )
|
||||||
|
{
|
||||||
|
case L'\0':
|
||||||
|
{
|
||||||
|
free(in);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case L'$':
|
||||||
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
in[out_pos++] = L'\\';
|
||||||
|
in[out_pos] = in[in_pos];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
in[out_pos] = res;
|
case '$':
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
in[out_pos]=in[in_pos];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch( in[in_pos]){
|
|
||||||
case L'~':
|
|
||||||
if( escape_special && (in_pos == 0) )
|
|
||||||
in[out_pos]=HOME_DIRECTORY;
|
|
||||||
else
|
|
||||||
in[out_pos] = L'~';
|
|
||||||
break;
|
|
||||||
case L'%':
|
|
||||||
if( escape_special && (in_pos == 0) )
|
|
||||||
in[out_pos]=PROCESS_EXPAND;
|
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
|
||||||
break;
|
|
||||||
case L'*':
|
|
||||||
if( escape_special )
|
|
||||||
{
|
{
|
||||||
if( out_pos > 0 && in[out_pos-1]==ANY_STRING )
|
if( unescape_special )
|
||||||
{
|
{
|
||||||
out_pos--;
|
in[out_pos]=VARIABLE_EXPAND_SINGLE;
|
||||||
in[out_pos] = ANY_STRING_RECURSIVE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
in[out_pos]=ANY_STRING;
|
{
|
||||||
|
in[out_pos]=in[in_pos];
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
default:
|
||||||
break;
|
|
||||||
case L'?':
|
|
||||||
if( escape_special )
|
|
||||||
in[out_pos]=ANY_CHAR;
|
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
|
||||||
break;
|
|
||||||
case L'$':
|
|
||||||
if( escape_special )
|
|
||||||
in[out_pos]=VARIABLE_EXPAND;
|
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
|
||||||
break;
|
|
||||||
case L'{':
|
|
||||||
if( escape_special )
|
|
||||||
{
|
{
|
||||||
bracket_count++;
|
in[out_pos] = in[in_pos];
|
||||||
in[out_pos]=BRACKET_BEGIN;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
}
|
||||||
break;
|
break;
|
||||||
case L'}':
|
|
||||||
if( escape_special )
|
|
||||||
{
|
|
||||||
bracket_count--;
|
|
||||||
in[out_pos]=BRACKET_END;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L',':
|
|
||||||
if( escape_special && bracket_count && prev!=BRACKET_SEP)
|
|
||||||
{
|
|
||||||
in[out_pos]=BRACKET_SEP;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
in[out_pos]=in[in_pos];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L'\'':
|
|
||||||
case L'\"':
|
|
||||||
{
|
|
||||||
wchar_t *end = quote_end( &in[in_pos] );
|
|
||||||
int len;
|
|
||||||
|
|
||||||
if( end == 0 )
|
|
||||||
{
|
|
||||||
free(in);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = end- &in[in_pos]-1;
|
|
||||||
|
|
||||||
if( escape_special)
|
|
||||||
in[out_pos++]=INTERNAL_SEPARATOR;
|
|
||||||
|
|
||||||
memmove( &in[out_pos], &in[in_pos+1], sizeof(wchar_t)*(len) );
|
|
||||||
in_pos += len+1;
|
|
||||||
out_pos += len-1;
|
|
||||||
|
|
||||||
if( escape_special)
|
|
||||||
in[++out_pos]=INTERNAL_SEPARATOR;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
in[out_pos] = in[in_pos];
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in[out_pos]=L'\0';
|
in[out_pos]=L'\0';
|
||||||
return in;
|
return in;
|
||||||
@@ -1310,13 +1466,13 @@ static char *gen_unique_nfs_filename( const char *filename )
|
|||||||
pidlen = sprint_pid_t( getpid(), newname + orglen + 1 + hnlen + 1 );
|
pidlen = sprint_pid_t( getpid(), newname + orglen + 1 + hnlen + 1 );
|
||||||
newname[orglen + 1 + hnlen + 1 + pidlen] = '\0';
|
newname[orglen + 1 + hnlen + 1 + pidlen] = '\0';
|
||||||
/* debug( 1, L"gen_unique_nfs_filename returning with: newname = \"%s\"; "
|
/* debug( 1, L"gen_unique_nfs_filename returning with: newname = \"%s\"; "
|
||||||
L"HOST_NAME_MAX = %d; hnlen = %d; orglen = %d; "
|
L"HOST_NAME_MAX = %d; hnlen = %d; orglen = %d; "
|
||||||
L"sizeof(pid_t) = %d; maxpiddigits = %d; malloc'd size: %d",
|
L"sizeof(pid_t) = %d; maxpiddigits = %d; malloc'd size: %d",
|
||||||
newname, (int)HOST_NAME_MAX, hnlen, orglen,
|
newname, (int)HOST_NAME_MAX, hnlen, orglen,
|
||||||
(int)sizeof(pid_t),
|
(int)sizeof(pid_t),
|
||||||
(int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1),
|
(int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1),
|
||||||
(int)(orglen + 1 + hnlen + 1 +
|
(int)(orglen + 1 + hnlen + 1 +
|
||||||
(int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1) + 1) ); */
|
(int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1) + 1) ); */
|
||||||
return newname;
|
return newname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
107
common.h
107
common.h
@@ -14,7 +14,10 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Under curses, tputs expects an int (*func)(char) as its last parameter, but in ncurses, tputs expects a int (*func)(int) as its last parameter. tputs_arg_t is defined to always be what tputs expects. Hopefully.
|
Under curses, tputs expects an int (*func)(char) as its last
|
||||||
|
parameter, but in ncurses, tputs expects a int (*func)(int) as its
|
||||||
|
last parameter. tputs_arg_t is defined to always be what tputs
|
||||||
|
expects. Hopefully.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef NCURSES_VERSION
|
#ifdef NCURSES_VERSION
|
||||||
@@ -24,7 +27,7 @@ typedef char tputs_arg_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Maximum number of bytes in a utf-8 character
|
Maximum number of bytes used by a single utf-8 character
|
||||||
*/
|
*/
|
||||||
#define MAX_UTF8_BYTES 6
|
#define MAX_UTF8_BYTES 6
|
||||||
|
|
||||||
@@ -39,11 +42,14 @@ typedef char tputs_arg_t;
|
|||||||
*/
|
*/
|
||||||
#define FISH_COLOR_RESET -2
|
#define FISH_COLOR_RESET -2
|
||||||
|
|
||||||
/** Save the shell mode on startup so we can restore them on exit */
|
/**
|
||||||
|
Save the shell mode on startup so we can restore them on exit
|
||||||
|
*/
|
||||||
extern struct termios shell_modes;
|
extern struct termios shell_modes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The character to use where the text has been truncated. Is an ellipsis on unicode system and a $ on other systems.
|
The character to use where the text has been truncated. Is an
|
||||||
|
ellipsis on unicode system and a $ on other systems.
|
||||||
*/
|
*/
|
||||||
extern wchar_t ellipsis_char;
|
extern wchar_t ellipsis_char;
|
||||||
|
|
||||||
@@ -69,7 +75,8 @@ extern char *profile;
|
|||||||
extern wchar_t *program_name;
|
extern wchar_t *program_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Take an array_list_t containing wide strings and converts them to a wchar_t **.
|
Take an array_list_t containing wide strings and converts them to a
|
||||||
|
single null-terminated wchar_t **.
|
||||||
*/
|
*/
|
||||||
wchar_t **list_to_char_arr( array_list_t *l );
|
wchar_t **list_to_char_arr( array_list_t *l );
|
||||||
|
|
||||||
@@ -87,22 +94,26 @@ wchar_t **list_to_char_arr( array_list_t *l );
|
|||||||
int fgetws2( wchar_t **buff, int *len, FILE *f );
|
int fgetws2( wchar_t **buff, int *len, FILE *f );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sorts a list of wide strings according to the wcsfilecmp-function from the util library
|
Sorts a list of wide strings according to the wcsfilecmp-function
|
||||||
|
from the util library
|
||||||
*/
|
*/
|
||||||
void sort_list( array_list_t *comp );
|
void sort_list( array_list_t *comp );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated wide character string equivalent of the specified multibyte character string
|
Returns a newly allocated wide character string equivalent of the
|
||||||
|
specified multibyte character string
|
||||||
*/
|
*/
|
||||||
wchar_t *str2wcs( const char *in );
|
wchar_t *str2wcs( const char *in );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated multibyte character string equivalent of the specified wide character string
|
Returns a newly allocated multibyte character string equivalent of
|
||||||
|
the specified wide character string
|
||||||
*/
|
*/
|
||||||
char *wcs2str( const wchar_t *in );
|
char *wcs2str( const wchar_t *in );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated wide character string array equivalent of the specified multibyte character string array
|
Returns a newly allocated wide character string array equivalent of
|
||||||
|
the specified multibyte character string array
|
||||||
*/
|
*/
|
||||||
char **wcsv2strv( const wchar_t **in );
|
char **wcsv2strv( const wchar_t **in );
|
||||||
|
|
||||||
@@ -112,17 +123,22 @@ char **wcsv2strv( const wchar_t **in );
|
|||||||
wchar_t **strv2wcsv( const char **in );
|
wchar_t **strv2wcsv( const char **in );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated concatenation of the specified wide character strings
|
Returns a newly allocated concatenation of the specified wide
|
||||||
|
character strings
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
|
wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated concatenation of the specified wide character strings. The last argument must be a null pointer.
|
Returns a newly allocated concatenation of the specified wide
|
||||||
|
character strings. The last argument must be a null pointer.
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated wide character string wich is a copy of the string in, but of length c or shorter. The returned string is always null terminated, and the null is not included in the string length.
|
Returns a newly allocated wide character string wich is a copy of
|
||||||
|
the string in, but of length c or shorter. The returned string is
|
||||||
|
always null terminated, and the null is not included in the string
|
||||||
|
length.
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsndup( const wchar_t *in, int c );
|
wchar_t *wcsndup( const wchar_t *in, int c );
|
||||||
|
|
||||||
@@ -144,17 +160,37 @@ long wcstol(const wchar_t *nptr,
|
|||||||
wchar_t **endptr,
|
wchar_t **endptr,
|
||||||
int base);
|
int base);
|
||||||
|
|
||||||
size_t
|
/**
|
||||||
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz);
|
Appends src to string dst of size siz (unlike wcsncat, siz is the
|
||||||
|
full size of dst, not space left). At most siz-1 characters will be
|
||||||
|
copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
|
||||||
|
wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
|
||||||
|
truncation occurred.
|
||||||
|
|
||||||
size_t
|
This is the OpenBSD strlcat function, modified for wide characters,
|
||||||
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz);
|
and renamed to reflect this change.
|
||||||
|
|
||||||
|
*/
|
||||||
|
size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a dublicate string. Wide string version of strdup.
|
Copy src to string dst of size siz. At most siz-1 characters will
|
||||||
|
be copied. Always NUL terminates (unless siz == 0). Returns
|
||||||
|
wcslen(src); if retval >= siz, truncation occurred.
|
||||||
|
|
||||||
|
This is the OpenBSD strlcpy function, modified for wide characters,
|
||||||
|
and renamed to reflect this change.
|
||||||
|
*/
|
||||||
|
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a duplicate string. Wide string version of strdup. Will
|
||||||
|
automatically exit if out of memory.
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsdup(const wchar_t *in);
|
wchar_t *wcsdup(const wchar_t *in);
|
||||||
|
|
||||||
|
size_t wcslen(const wchar_t *in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Case insensitive string compare function. Wide string version of
|
Case insensitive string compare function. Wide string version of
|
||||||
strcasecmp.
|
strcasecmp.
|
||||||
@@ -163,9 +199,22 @@ wchar_t *wcsdup(const wchar_t *in);
|
|||||||
esoteric locales where uppercase and lowercase do not cleanly
|
esoteric locales where uppercase and lowercase do not cleanly
|
||||||
transform between each other. Hopefully this should be fine since
|
transform between each other. Hopefully this should be fine since
|
||||||
fish only uses this function with one of the strings supplied by
|
fish only uses this function with one of the strings supplied by
|
||||||
fish and guaranteed to be a sane, english word.
|
fish and guaranteed to be a sane, english word. Using wcscasecmp on
|
||||||
|
a user-supplied string should be considered a bug.
|
||||||
*/
|
*/
|
||||||
int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Case insensitive string compare function. Wide string version of
|
||||||
|
strncasecmp.
|
||||||
|
|
||||||
|
This implementation of wcsncasecmp does not take into account
|
||||||
|
esoteric locales where uppercase and lowercase do not cleanly
|
||||||
|
transform between each other. Hopefully this should be fine since
|
||||||
|
fish only uses this function with one of the strings supplied by
|
||||||
|
fish and guaranteed to be a sane, english word. Using wcsncasecmp on
|
||||||
|
a user-supplied string should be considered a bug.
|
||||||
|
*/
|
||||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,7 +237,11 @@ int wcwidth( wchar_t c );
|
|||||||
int my_wcswidth( const wchar_t *c );
|
int my_wcswidth( const wchar_t *c );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This functions returns the end of a quoted substring. It can handle nested single and double quotes.
|
This functions returns the end of the quoted substring beginning at
|
||||||
|
\c in. It can handle both single and double quotes. Returns 0 on
|
||||||
|
error.
|
||||||
|
|
||||||
|
\param in the position of the opening quote
|
||||||
*/
|
*/
|
||||||
wchar_t *quote_end( const wchar_t *in );
|
wchar_t *quote_end( const wchar_t *in );
|
||||||
|
|
||||||
@@ -203,9 +256,12 @@ wchar_t *quote_end( const wchar_t *in );
|
|||||||
void error_reset();
|
void error_reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the locale, also change the ellipsis character
|
This function behaves exactly like a wide character equivalent of
|
||||||
|
the C function setlocale, except that it will also try to detect if
|
||||||
|
the user is using a Unicode character set, and if so, use the
|
||||||
|
unicode ellipsis character as ellipsis, instead of '$'.
|
||||||
*/
|
*/
|
||||||
void fish_setlocale(int category, const wchar_t *locale);
|
const wchar_t *wsetlocale( int category, const wchar_t *locale );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks if \c needle is included in the list of strings specified
|
Checks if \c needle is included in the list of strings specified
|
||||||
@@ -251,7 +307,7 @@ void common_destroy();
|
|||||||
|
|
||||||
will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'.
|
will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'.
|
||||||
*/
|
*/
|
||||||
void debug( int level, wchar_t *msg, ... );
|
void debug( int level, const wchar_t *msg, ... );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Replace special characters with backslash escape sequences. Newline is
|
Replace special characters with backslash escape sequences. Newline is
|
||||||
@@ -324,5 +380,12 @@ int common_get_height();
|
|||||||
*/
|
*/
|
||||||
void common_handle_winch( int signal );
|
void common_handle_winch( int signal );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Write paragraph of output to screen. Ignore newlines in message and
|
||||||
|
perform internal line-breaking.
|
||||||
|
*/
|
||||||
|
void write_screen( const wchar_t *msg );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
497
complete.c
497
complete.c
@@ -35,6 +35,7 @@
|
|||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "intern.h"
|
#include "intern.h"
|
||||||
|
#include "translate.h"
|
||||||
|
|
||||||
#include "wutil.h"
|
#include "wutil.h"
|
||||||
|
|
||||||
@@ -48,63 +49,67 @@
|
|||||||
/**
|
/**
|
||||||
Description for ~USER completion
|
Description for ~USER completion
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_USER_DESC COMPLETE_SEP_STR L"User home"
|
#define COMPLETE_USER_DESC _( L"User home" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Description for short variables. The value is concatenated to this description
|
Description for short variables. The value is concatenated to this description
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_VAR_DESC_VAL COMPLETE_SEP_STR L"Variable: "
|
#define COMPLETE_VAR_DESC_VAL _( L"Variable: " )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Description for generic executable
|
Description for generic executable
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_EXEC_DESC COMPLETE_SEP_STR L"Executable"
|
#define COMPLETE_EXEC_DESC _( L"Executable" )
|
||||||
/**
|
/**
|
||||||
Description for link to executable
|
Description for link to executable
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_EXEC_LINK_DESC COMPLETE_SEP_STR L"Executable link"
|
#define COMPLETE_EXEC_LINK_DESC _( L"Executable link" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Description for regular file
|
Description for regular file
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_FILE_DESC COMPLETE_SEP_STR L"File"
|
#define COMPLETE_FILE_DESC _( L"File" )
|
||||||
/**
|
/**
|
||||||
Description for character device
|
Description for character device
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_CHAR_DESC COMPLETE_SEP_STR L"Character device"
|
#define COMPLETE_CHAR_DESC _( L"Character device" )
|
||||||
/**
|
/**
|
||||||
Description for block device
|
Description for block device
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_BLOCK_DESC COMPLETE_SEP_STR L"Block device"
|
#define COMPLETE_BLOCK_DESC _( L"Block device" )
|
||||||
/**
|
/**
|
||||||
Description for fifo buffer
|
Description for fifo buffer
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_FIFO_DESC COMPLETE_SEP_STR L"Fifo"
|
#define COMPLETE_FIFO_DESC _( L"Fifo" )
|
||||||
/**
|
/**
|
||||||
Description for symlink
|
Description for symlink
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_SYMLINK_DESC COMPLETE_SEP_STR L"Symbolic link"
|
#define COMPLETE_SYMLINK_DESC _( L"Symbolic link" )
|
||||||
/**
|
/**
|
||||||
Description for Rotten symlink
|
Description for Rotten symlink
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_ROTTEN_SYMLINK_DESC COMPLETE_SEP_STR L"Rotten symbolic link"
|
#define COMPLETE_ROTTEN_SYMLINK_DESC _( L"Rotten symbolic link" )
|
||||||
|
/**
|
||||||
|
Description for symlink loop
|
||||||
|
*/
|
||||||
|
#define COMPLETE_LOOP_SYMLINK_DESC _( L"Symbolic link loop" )
|
||||||
/**
|
/**
|
||||||
Description for socket
|
Description for socket
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_SOCKET_DESC COMPLETE_SEP_STR L"Socket"
|
#define COMPLETE_SOCKET_DESC _( L"Socket" )
|
||||||
/**
|
/**
|
||||||
Description for directory
|
Description for directory
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_DIRECTORY_DESC COMPLETE_SEP_STR L"Directory"
|
#define COMPLETE_DIRECTORY_DESC _( L"Directory" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Description for function
|
Description for function
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_FUNCTION_DESC COMPLETE_SEP_STR L"Function"
|
#define COMPLETE_FUNCTION_DESC _( L"Function" )
|
||||||
/**
|
/**
|
||||||
Description for builtin command
|
Description for builtin command
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_BUILTIN_DESC COMPLETE_SEP_STR L"Builtin"
|
#define COMPLETE_BUILTIN_DESC _( L"Builtin" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The command to run to get a description from a file suffix
|
The command to run to get a description from a file suffix
|
||||||
@@ -204,6 +209,9 @@ static hash_table_t *condition_cache=0;
|
|||||||
*/
|
*/
|
||||||
static hash_table_t *loaded_completions=0;
|
static hash_table_t *loaded_completions=0;
|
||||||
|
|
||||||
|
static string_buffer_t *get_desc_buff=0;
|
||||||
|
|
||||||
|
|
||||||
void complete_init()
|
void complete_init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -321,18 +329,21 @@ static void clear_hash_value( const void *key, const void *data )
|
|||||||
void complete_destroy()
|
void complete_destroy()
|
||||||
{
|
{
|
||||||
complete_entry *i=first_entry, *prev;
|
complete_entry *i=first_entry, *prev;
|
||||||
|
|
||||||
while( i )
|
while( i )
|
||||||
{
|
{
|
||||||
prev = i;
|
prev = i;
|
||||||
i=i->next;
|
i=i->next;
|
||||||
complete_free_entry( prev );
|
complete_free_entry( prev );
|
||||||
}
|
}
|
||||||
|
first_entry = 0;
|
||||||
|
|
||||||
if( suffix_hash )
|
if( suffix_hash )
|
||||||
{
|
{
|
||||||
hash_foreach( suffix_hash, &clear_hash_entry );
|
hash_foreach( suffix_hash, &clear_hash_entry );
|
||||||
hash_destroy( suffix_hash );
|
hash_destroy( suffix_hash );
|
||||||
free( suffix_hash );
|
free( suffix_hash );
|
||||||
|
suffix_hash=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( loaded_completions )
|
if( loaded_completions )
|
||||||
@@ -341,8 +352,16 @@ void complete_destroy()
|
|||||||
&clear_hash_value );
|
&clear_hash_value );
|
||||||
hash_destroy( loaded_completions );
|
hash_destroy( loaded_completions );
|
||||||
free( loaded_completions );
|
free( loaded_completions );
|
||||||
|
loaded_completions = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( get_desc_buff )
|
||||||
|
{
|
||||||
|
sb_destroy( get_desc_buff );
|
||||||
|
free( get_desc_buff );
|
||||||
|
get_desc_buff = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,8 +395,6 @@ void complete_add( const wchar_t *cmd,
|
|||||||
complete_entry *c =
|
complete_entry *c =
|
||||||
complete_find_exact_entry( cmd, cmd_type );
|
complete_find_exact_entry( cmd, cmd_type );
|
||||||
complete_entry_opt *opt;
|
complete_entry_opt *opt;
|
||||||
wchar_t *tmp;
|
|
||||||
|
|
||||||
|
|
||||||
if( c == 0 )
|
if( c == 0 )
|
||||||
{
|
{
|
||||||
@@ -424,9 +441,7 @@ void complete_add( const wchar_t *cmd,
|
|||||||
|
|
||||||
if( desc && wcslen( desc ) )
|
if( desc && wcslen( desc ) )
|
||||||
{
|
{
|
||||||
tmp = wcsdupcat( COMPLETE_SEP_STR, desc );
|
opt->desc = intern( desc );
|
||||||
opt->desc = intern( tmp );
|
|
||||||
free( tmp );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
opt->desc = L"";
|
opt->desc = L"";
|
||||||
@@ -746,7 +761,7 @@ int complete_is_valid_option( const wchar_t *str,
|
|||||||
str[0] = opt[j];
|
str[0] = opt[j];
|
||||||
str[1]=0;
|
str[1]=0;
|
||||||
al_push( errors,
|
al_push( errors,
|
||||||
wcsdupcat2(L"Unknown option \'", str, L"\'", 0) );
|
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
opt_found = 0;
|
opt_found = 0;
|
||||||
@@ -765,12 +780,12 @@ int complete_is_valid_option( const wchar_t *str,
|
|||||||
if( hash_get_count( &gnu_match_hash )==0)
|
if( hash_get_count( &gnu_match_hash )==0)
|
||||||
{
|
{
|
||||||
al_push( errors,
|
al_push( errors,
|
||||||
wcsdupcat2(L"Unknown option \'", opt, L"\'", 0) );
|
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", 0) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
al_push( errors,
|
al_push( errors,
|
||||||
wcsdupcat2(L"Multiple matches for option \'", opt, L"\'", 0) );
|
wcsdupcat2( _(L"Multiple matches for option: "), L"'", opt, L"\'", 0) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -847,13 +862,13 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
|
|||||||
wchar_t *ln = (wchar_t *)al_get(&l, 0 );
|
wchar_t *ln = (wchar_t *)al_get(&l, 0 );
|
||||||
if( wcscmp( ln, L"unknown" ) != 0 )
|
if( wcscmp( ln, L"unknown" ) != 0 )
|
||||||
{
|
{
|
||||||
desc = wcsdupcat( COMPLETE_SEP_STR, ln);
|
desc = wcsdup( ln);
|
||||||
/*
|
/*
|
||||||
I have decided I prefer to have the description
|
I have decided I prefer to have the description
|
||||||
begin in uppercase and the whole universe will just
|
begin in uppercase and the whole universe will just
|
||||||
have to accept it. Hah!
|
have to accept it. Hah!
|
||||||
*/
|
*/
|
||||||
desc[1]=towupper(desc[1]);
|
desc[0]=towupper(desc[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,87 +895,100 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
|
|||||||
const wchar_t *complete_get_desc( const wchar_t *filename )
|
const wchar_t *complete_get_desc( const wchar_t *filename )
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
const wchar_t *desc = COMPLETE_FILE_DESC;
|
if( !get_desc_buff )
|
||||||
|
{
|
||||||
|
get_desc_buff = malloc(sizeof(string_buffer_t) );
|
||||||
|
sb_init( get_desc_buff );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb_clear( get_desc_buff );
|
||||||
|
}
|
||||||
|
|
||||||
if( lwstat( filename, &buf )==0)
|
if( lwstat( filename, &buf )==0)
|
||||||
{
|
{
|
||||||
if( waccess( filename, X_OK ) == 0 )
|
|
||||||
{
|
|
||||||
desc = COMPLETE_EXEC_DESC;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( S_ISCHR(buf.st_mode) )
|
if( S_ISCHR(buf.st_mode) )
|
||||||
desc= COMPLETE_CHAR_DESC;
|
{
|
||||||
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_CHAR_DESC );
|
||||||
|
}
|
||||||
else if( S_ISBLK(buf.st_mode) )
|
else if( S_ISBLK(buf.st_mode) )
|
||||||
desc = COMPLETE_BLOCK_DESC;
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_BLOCK_DESC );
|
||||||
else if( S_ISFIFO(buf.st_mode) )
|
else if( S_ISFIFO(buf.st_mode) )
|
||||||
desc = COMPLETE_FIFO_DESC;
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_FIFO_DESC );
|
||||||
else if( S_ISLNK(buf.st_mode))
|
else if( S_ISLNK(buf.st_mode))
|
||||||
{
|
{
|
||||||
struct stat buf2;
|
struct stat buf2;
|
||||||
desc = COMPLETE_SYMLINK_DESC;
|
|
||||||
|
|
||||||
if( waccess( filename, X_OK ) == 0 )
|
|
||||||
desc = COMPLETE_EXEC_LINK_DESC;
|
|
||||||
|
|
||||||
if( wstat( filename, &buf2 ) == 0 )
|
if( wstat( filename, &buf2 ) == 0 )
|
||||||
{
|
{
|
||||||
if( S_ISDIR(buf2.st_mode) )
|
if( S_ISDIR(buf2.st_mode) )
|
||||||
{
|
{
|
||||||
desc = L"/" COMPLETE_SYMLINK_DESC;
|
sb_printf( get_desc_buff, L"/%lc%ls", COMPLETE_SEP, COMPLETE_SYMLINK_DESC );
|
||||||
}
|
}
|
||||||
|
else if( waccess( filename, X_OK ) == 0 )
|
||||||
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_EXEC_LINK_DESC );
|
||||||
|
else
|
||||||
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_SYMLINK_DESC );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( errno )
|
switch( errno )
|
||||||
{
|
{
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
desc = COMPLETE_ROTTEN_SYMLINK_DESC;
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_ROTTEN_SYMLINK_DESC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EACCES:
|
case EACCES:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wperror( L"stat" );
|
if( errno == ELOOP )
|
||||||
|
{
|
||||||
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_LOOP_SYMLINK_DESC );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Some kind of broken symlink. We ignore it
|
||||||
|
here, and it will get a 'file' description,
|
||||||
|
or one based on suffix.
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( S_ISSOCK(buf.st_mode))
|
else if( S_ISSOCK(buf.st_mode))
|
||||||
desc= COMPLETE_SOCKET_DESC;
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_SOCKET_DESC );
|
||||||
else if( S_ISDIR(buf.st_mode) )
|
else if( S_ISDIR(buf.st_mode) )
|
||||||
desc= L"/" COMPLETE_DIRECTORY_DESC;
|
sb_printf( get_desc_buff, L"/%lc%ls", COMPLETE_SEP, COMPLETE_DIRECTORY_DESC );
|
||||||
|
else if( waccess( filename, X_OK ) == 0 )
|
||||||
|
{
|
||||||
|
sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_EXEC_DESC );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* else
|
|
||||||
{
|
|
||||||
|
|
||||||
switch( errno )
|
if( wcslen((wchar_t *)get_desc_buff->buff) == 0 )
|
||||||
{
|
|
||||||
case EACCES:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
fprintf( stderr, L"The following error happened on file %ls\n", filename );
|
|
||||||
wperror( L"lstat" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if( desc == COMPLETE_FILE_DESC )
|
|
||||||
{
|
{
|
||||||
wchar_t *suffix = wcsrchr( filename, L'.' );
|
wchar_t *suffix = wcsrchr( filename, L'.' );
|
||||||
if( suffix != 0 )
|
if( suffix != 0 )
|
||||||
{
|
{
|
||||||
if( !wcsrchr( suffix, L'/' ) )
|
if( !wcsrchr( suffix, L'/' ) )
|
||||||
{
|
{
|
||||||
desc = complete_get_desc_suffix( suffix );
|
sb_printf( get_desc_buff,
|
||||||
|
L"%lc%ls",
|
||||||
|
COMPLETE_SEP,
|
||||||
|
complete_get_desc_suffix( suffix ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
sb_printf( get_desc_buff,
|
||||||
|
L"%lc%ls",
|
||||||
|
COMPLETE_SEP,
|
||||||
|
COMPLETE_FILE_DESC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return desc;
|
return (wchar_t *)get_desc_buff->buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -976,7 +1004,7 @@ const wchar_t *complete_get_desc( const wchar_t *filename )
|
|||||||
|
|
||||||
\param comp_out the destination list
|
\param comp_out the destination list
|
||||||
\param wc_escaped the prefix, possibly containing wildcards. The wildcard should not have been unescaped, i.e. '*' should be used for any string, not the ANY_STRING character.
|
\param wc_escaped the prefix, possibly containing wildcards. The wildcard should not have been unescaped, i.e. '*' should be used for any string, not the ANY_STRING character.
|
||||||
\param desc the default description, used for completions with no embedded description
|
\param desc the default description, used for completions with no embedded description. The description _may_ contain a COMPLETE_SEP character, if not, one will be prefixed to it
|
||||||
\param desc_func the function that generates a description for those completions witout an embedded description
|
\param desc_func the function that generates a description for those completions witout an embedded description
|
||||||
\param possible_comp the list of possible completions to iterate over
|
\param possible_comp the list of possible completions to iterate over
|
||||||
*/
|
*/
|
||||||
@@ -1006,6 +1034,7 @@ static void copy_strings_with_prefix( array_list_t *comp_out,
|
|||||||
|
|
||||||
wildcard_complete( next_str, wc, desc, desc_func, comp_out );
|
wildcard_complete( next_str, wc, desc, desc_func, comp_out );
|
||||||
}
|
}
|
||||||
|
|
||||||
free( wc );
|
free( wc );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1028,8 +1057,11 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
|
|||||||
if( !cmd )
|
if( !cmd )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cmd_start=wcschr(cmd, L'/');
|
cmd_start=wcsrchr(cmd, L'/');
|
||||||
if( !cmd_start )
|
|
||||||
|
if( cmd_start )
|
||||||
|
cmd_start++;
|
||||||
|
else
|
||||||
cmd_start = cmd;
|
cmd_start = cmd;
|
||||||
|
|
||||||
cmd_len = wcslen(cmd_start);
|
cmd_len = wcslen(cmd_start);
|
||||||
@@ -1049,131 +1081,127 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
|
|||||||
|
|
||||||
esc = expand_escape( cmd_start, 1 );
|
esc = expand_escape( cmd_start, 1 );
|
||||||
|
|
||||||
if( esc )
|
if( whatis_path )
|
||||||
{
|
{
|
||||||
|
apropos_cmd =wcsdupcat2( L"grep ^/dev/null -F <", whatis_path, L" ", esc, 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
apropos_cmd = wcsdupcat( L"apropos ^/dev/null ", esc );
|
||||||
|
}
|
||||||
|
free(esc);
|
||||||
|
|
||||||
if( whatis_path )
|
al_init( &list );
|
||||||
|
hash_init( &lookup, &hash_wcs_func, &hash_wcs_cmp );
|
||||||
|
|
||||||
|
/*
|
||||||
|
First locate a list of possible descriptions using a single
|
||||||
|
call to apropos or a direct search if we know the location
|
||||||
|
of the whatis database. This can take some time on slower
|
||||||
|
systems with a large set of manuals, but it should be ok
|
||||||
|
since apropos is only called once.
|
||||||
|
*/
|
||||||
|
exec_subshell( apropos_cmd, &list );
|
||||||
|
/*
|
||||||
|
Then discard anything that is not a possible completion and put
|
||||||
|
the result into a hashtable with the completion as key and the
|
||||||
|
description as value.
|
||||||
|
|
||||||
|
Should be reasonably fast, since no memory allocations are needed.
|
||||||
|
*/
|
||||||
|
for( i=0; i<al_get_count( &list); i++ )
|
||||||
|
{
|
||||||
|
wchar_t *el = (wchar_t *)al_get( &list, i );
|
||||||
|
wchar_t *key, *key_end, *val_begin;
|
||||||
|
|
||||||
|
if( !el )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//fwprintf( stderr, L"%ls\n", el );
|
||||||
|
if( wcsncmp( el, cmd_start, cmd_len ) != 0 )
|
||||||
|
continue;
|
||||||
|
//fwprintf( stderr, L"%ls\n", el );
|
||||||
|
key = el + cmd_len;
|
||||||
|
|
||||||
|
key_end = wcschr( el, L' ' );
|
||||||
|
if( !key_end )
|
||||||
{
|
{
|
||||||
apropos_cmd =wcsdupcat2( L"grep ^/dev/null -F <", whatis_path, L" ", esc, 0 );
|
key_end = wcschr( el, L'\t' );
|
||||||
|
if( !key_end )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*key_end = 0;
|
||||||
|
val_begin=key_end+1;
|
||||||
|
|
||||||
|
//fwprintf( stderr, L"Key %ls\n", el );
|
||||||
|
|
||||||
|
while( *val_begin != L'-' && *val_begin)
|
||||||
|
{
|
||||||
|
val_begin++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !val_begin )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
val_begin++;
|
||||||
|
|
||||||
|
while( *val_begin == L' ' || *val_begin == L'\t' )
|
||||||
|
{
|
||||||
|
val_begin++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !*val_begin )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
And once again I make sure the first character is uppercased
|
||||||
|
because I like it that way, and I get to decide these
|
||||||
|
things.
|
||||||
|
*/
|
||||||
|
val_begin[0]=towupper(val_begin[0]);
|
||||||
|
hash_put( &lookup, key, val_begin );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Then do a lookup on every completion and if a match is found,
|
||||||
|
change to the new description.
|
||||||
|
|
||||||
|
This needs to do a reallocation for every description added, but
|
||||||
|
there shouldn't be that many completions, so it should be ok.
|
||||||
|
*/
|
||||||
|
for( i=0; i<al_get_count(comp); i++ )
|
||||||
|
{
|
||||||
|
wchar_t *el = (wchar_t *)al_get( comp, i );
|
||||||
|
wchar_t *cmd_end = wcschr( el,
|
||||||
|
COMPLETE_SEP );
|
||||||
|
wchar_t *new_desc;
|
||||||
|
|
||||||
|
if( cmd_end )
|
||||||
|
*cmd_end = 0;
|
||||||
|
|
||||||
|
new_desc = (wchar_t *)hash_get( &lookup,
|
||||||
|
el );
|
||||||
|
|
||||||
|
if( new_desc )
|
||||||
|
{
|
||||||
|
wchar_t *new_el = wcsdupcat2( el,
|
||||||
|
COMPLETE_SEP_STR,
|
||||||
|
new_desc,
|
||||||
|
0 );
|
||||||
|
al_set( comp, i, new_el );
|
||||||
|
free( el );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
apropos_cmd = wcsdupcat( L"apropos ^/dev/null ", esc );
|
|
||||||
}
|
|
||||||
free(esc);
|
|
||||||
|
|
||||||
al_init( &list );
|
|
||||||
hash_init( &lookup, &hash_wcs_func, &hash_wcs_cmp );
|
|
||||||
|
|
||||||
/*
|
|
||||||
First locate a list of possible descriptions using a single
|
|
||||||
call to apropos or a direct search if we know the location
|
|
||||||
of the whatis database. This can take some time on slower
|
|
||||||
systems with a large set of manuals, but it should be ok
|
|
||||||
since apropos is only called once.
|
|
||||||
*/
|
|
||||||
exec_subshell( apropos_cmd, &list );
|
|
||||||
/*
|
|
||||||
Then discard anything that is not a possible completion and put
|
|
||||||
the result into a hashtable with the completion as key and the
|
|
||||||
description as value.
|
|
||||||
|
|
||||||
Should be reasonably fast, since no memory allocations are needed.
|
|
||||||
*/
|
|
||||||
for( i=0; i<al_get_count( &list); i++ )
|
|
||||||
{
|
|
||||||
wchar_t *el = (wchar_t *)al_get( &list, i );
|
|
||||||
wchar_t *key, *key_end, *val_begin;
|
|
||||||
|
|
||||||
if( !el )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//fwprintf( stderr, L"%ls\n", el );
|
|
||||||
if( wcsncmp( el, cmd_start, cmd_len ) != 0 )
|
|
||||||
continue;
|
|
||||||
//fwprintf( stderr, L"%ls\n", el );
|
|
||||||
key = el + cmd_len;
|
|
||||||
|
|
||||||
key_end = wcschr( el, L' ' );
|
|
||||||
if( !key_end )
|
|
||||||
{
|
|
||||||
key_end = wcschr( el, L'\t' );
|
|
||||||
if( !key_end )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*key_end = 0;
|
|
||||||
val_begin=key_end+1;
|
|
||||||
|
|
||||||
//fwprintf( stderr, L"Key %ls\n", el );
|
|
||||||
|
|
||||||
while( *val_begin != L'-' && *val_begin)
|
|
||||||
{
|
|
||||||
val_begin++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !val_begin )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
val_begin++;
|
|
||||||
|
|
||||||
while( *val_begin == L' ' || *val_begin == L'\t' )
|
|
||||||
{
|
|
||||||
val_begin++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !*val_begin )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
And once again I make sure the first character is uppercased
|
|
||||||
because I like it that way, and I get to decide these
|
|
||||||
things.
|
|
||||||
*/
|
|
||||||
val_begin[0]=towupper(val_begin[0]);
|
|
||||||
hash_put( &lookup, key, val_begin );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Then do a lookup on every completion and if a match is found,
|
|
||||||
change to the new description.
|
|
||||||
|
|
||||||
This needs to do a reallocation for every description added, but
|
|
||||||
there shouldn't be that many completions, so it should be ok.
|
|
||||||
*/
|
|
||||||
for( i=0; i<al_get_count(comp); i++ )
|
|
||||||
{
|
|
||||||
wchar_t *el = (wchar_t *)al_get( comp, i );
|
|
||||||
wchar_t *cmd_end = wcschr( el,
|
|
||||||
COMPLETE_SEP );
|
|
||||||
wchar_t *new_desc;
|
|
||||||
|
|
||||||
if( cmd_end )
|
if( cmd_end )
|
||||||
*cmd_end = 0;
|
*cmd_end = COMPLETE_SEP;
|
||||||
|
|
||||||
new_desc = (wchar_t *)hash_get( &lookup,
|
|
||||||
el );
|
|
||||||
|
|
||||||
if( new_desc )
|
|
||||||
{
|
|
||||||
wchar_t *new_el = wcsdupcat2( el,
|
|
||||||
COMPLETE_SEP_STR,
|
|
||||||
new_desc,
|
|
||||||
0 );
|
|
||||||
al_set( comp, i, new_el );
|
|
||||||
free( el );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( cmd_end )
|
|
||||||
*cmd_end = COMPLETE_SEP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1213,10 +1241,12 @@ static void complete_cmd( const wchar_t *cmd,
|
|||||||
array_list_t tmp;
|
array_list_t tmp;
|
||||||
al_init( &tmp );
|
al_init( &tmp );
|
||||||
|
|
||||||
expand_string( wcsdup(cmd),
|
if( expand_string( wcsdup(cmd),
|
||||||
comp,
|
comp,
|
||||||
ACCEPT_INCOMPLETE | EXECUTABLES_ONLY );
|
ACCEPT_INCOMPLETE | EXECUTABLES_ONLY ) != EXPAND_ERROR )
|
||||||
complete_cmd_desc( cmd, comp );
|
{
|
||||||
|
complete_cmd_desc( cmd, comp );
|
||||||
|
}
|
||||||
al_destroy( &tmp );
|
al_destroy( &tmp );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1237,14 +1267,15 @@ static void complete_cmd( const wchar_t *cmd,
|
|||||||
|
|
||||||
al_init( &tmp );
|
al_init( &tmp );
|
||||||
|
|
||||||
expand_string( nxt_completion,
|
if( expand_string( nxt_completion,
|
||||||
&tmp,
|
&tmp,
|
||||||
ACCEPT_INCOMPLETE |
|
ACCEPT_INCOMPLETE |
|
||||||
EXECUTABLES_ONLY );
|
EXECUTABLES_ONLY ) != EXPAND_ERROR )
|
||||||
|
|
||||||
for( i=0; i<al_get_count(&tmp); i++ )
|
|
||||||
{
|
{
|
||||||
al_push( comp, al_get( &tmp, i ) );
|
for( i=0; i<al_get_count(&tmp); i++ )
|
||||||
|
{
|
||||||
|
al_push( comp, al_get( &tmp, i ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
al_destroy( &tmp );
|
al_destroy( &tmp );
|
||||||
@@ -1290,24 +1321,29 @@ static void complete_cmd( const wchar_t *cmd,
|
|||||||
|
|
||||||
al_init( &tmp );
|
al_init( &tmp );
|
||||||
|
|
||||||
expand_string( nxt_completion,
|
if( expand_string( nxt_completion,
|
||||||
&tmp,
|
&tmp,
|
||||||
ACCEPT_INCOMPLETE | DIRECTORIES_ONLY );
|
ACCEPT_INCOMPLETE | DIRECTORIES_ONLY ) != EXPAND_ERROR )
|
||||||
|
|
||||||
for( i=0; i<al_get_count(&tmp); i++ )
|
|
||||||
{
|
{
|
||||||
wchar_t *nxt = (wchar_t *)al_get( &tmp, i );
|
|
||||||
|
for( i=0; i<al_get_count(&tmp); i++ )
|
||||||
wchar_t *desc = wcsrchr( nxt, COMPLETE_SEP );
|
|
||||||
int is_valid = (desc && (wcscmp(desc,
|
|
||||||
COMPLETE_DIRECTORY_DESC)==0));
|
|
||||||
if( is_valid )
|
|
||||||
{
|
{
|
||||||
al_push( comp, nxt );
|
wchar_t *nxt = (wchar_t *)al_get( &tmp, i );
|
||||||
}
|
|
||||||
else
|
wchar_t *desc = wcsrchr( nxt, COMPLETE_SEP );
|
||||||
{
|
if( desc )
|
||||||
free(nxt);
|
{
|
||||||
|
int is_valid = desc && (wcscmp(desc+1,
|
||||||
|
COMPLETE_DIRECTORY_DESC)==0);
|
||||||
|
if( is_valid )
|
||||||
|
{
|
||||||
|
al_push( comp, nxt );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
free(nxt);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1320,10 +1356,10 @@ static void complete_cmd( const wchar_t *cmd,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Evaluate the argument list (as supplied by complete -a) and insert
|
Evaluate the argument list (as supplied by complete -a) and insert
|
||||||
any return matching completions. Matching is done using\c
|
any return matching completions. Matching is done using \c
|
||||||
copy_strings_with_prefix, meaning the completion may contain
|
copy_strings_with_prefix, meaning the completion may contain
|
||||||
wildcards. Logically, this is not always the right thing to do, but
|
wildcards. Logically, this is not always the right thing to do, but
|
||||||
I have yet to come up with a case where one would not want this.
|
I have yet to come up with a case where this matters.
|
||||||
|
|
||||||
\param str The string to complete.
|
\param str The string to complete.
|
||||||
\param args The list of option arguments to be evaluated.
|
\param args The list of option arguments to be evaluated.
|
||||||
@@ -1335,12 +1371,24 @@ static void complete_from_args( const wchar_t *str,
|
|||||||
const wchar_t *desc,
|
const wchar_t *desc,
|
||||||
array_list_t *comp_out )
|
array_list_t *comp_out )
|
||||||
{
|
{
|
||||||
|
int was_interactive = is_interactive;
|
||||||
|
|
||||||
array_list_t possible_comp;
|
array_list_t possible_comp;
|
||||||
|
int i;
|
||||||
|
|
||||||
al_init( &possible_comp );
|
al_init( &possible_comp );
|
||||||
|
|
||||||
|
is_interactive=0;
|
||||||
eval_args( args, &possible_comp );
|
eval_args( args, &possible_comp );
|
||||||
|
is_interactive=was_interactive;
|
||||||
debug( 3, L"desc is '%ls', %d long\n", desc, wcslen(desc) );
|
|
||||||
|
/* We need to unescape these strings before matching them */
|
||||||
|
for( i=0; i< al_get_count( &possible_comp ); i++ )
|
||||||
|
{
|
||||||
|
wchar_t *next = (wchar_t *)al_get( &possible_comp, i );
|
||||||
|
al_set( &possible_comp , i, unescape( next, 0 ) );
|
||||||
|
free( next );
|
||||||
|
}
|
||||||
|
|
||||||
copy_strings_with_prefix( comp_out, str, desc, 0, &possible_comp );
|
copy_strings_with_prefix( comp_out, str, desc, 0, &possible_comp );
|
||||||
|
|
||||||
@@ -1484,7 +1532,6 @@ void complete_load( wchar_t *cmd,
|
|||||||
|
|
||||||
expand_variable_array( path_var, &path_list );
|
expand_variable_array( path_var, &path_list );
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Iterate over path searching for suitable completion files
|
Iterate over path searching for suitable completion files
|
||||||
*/
|
*/
|
||||||
@@ -1695,12 +1742,13 @@ static int complete_param( wchar_t *cmd_orig,
|
|||||||
short_ok( str, o->short_opt, i->short_opt_str ) )
|
short_ok( str, o->short_opt, i->short_opt_str ) )
|
||||||
{
|
{
|
||||||
wchar_t *next_opt =
|
wchar_t *next_opt =
|
||||||
malloc( sizeof(wchar_t)*(2 + wcslen(o->desc)));
|
malloc( sizeof(wchar_t)*(3 + wcslen(o->desc)));
|
||||||
if( !next_opt )
|
if( !next_opt )
|
||||||
die_mem();
|
die_mem();
|
||||||
|
|
||||||
next_opt[0]=o->short_opt;
|
next_opt[0]=o->short_opt;
|
||||||
next_opt[1]=L'\0';
|
next_opt[1]=COMPLETE_SEP;
|
||||||
|
next_opt[2]=L'\0';
|
||||||
wcscat( next_opt, o->desc );
|
wcscat( next_opt, o->desc );
|
||||||
al_push( comp_out, next_opt );
|
al_push( comp_out, next_opt );
|
||||||
}
|
}
|
||||||
@@ -1727,14 +1775,14 @@ static int complete_param( wchar_t *cmd_orig,
|
|||||||
if( o->old_mode || !(o->result_mode & NO_COMMON ) )
|
if( o->old_mode || !(o->result_mode & NO_COMMON ) )
|
||||||
{
|
{
|
||||||
al_push( comp_out,
|
al_push( comp_out,
|
||||||
wcsdupcat(&((wchar_t *)whole_opt.buff)[wcslen(str)], o->desc) );
|
wcsdupcat2(&((wchar_t *)whole_opt.buff)[wcslen(str)], COMPLETE_SEP_STR, o->desc, (void *)0) );
|
||||||
// fwprintf( stderr, L"Add without param %ls\n", o->long_opt );
|
// fwprintf( stderr, L"Add without param %ls\n", o->long_opt );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !o->old_mode && ( wcslen(o->comp) || (o->result_mode & NO_COMMON ) ) )
|
if( !o->old_mode && ( wcslen(o->comp) || (o->result_mode & NO_COMMON ) ) )
|
||||||
{
|
{
|
||||||
al_push( comp_out,
|
al_push( comp_out,
|
||||||
wcsdupcat2(&((wchar_t *)whole_opt.buff)[wcslen(str)], L"=", o->desc, 0) );
|
wcsdupcat2(&((wchar_t *)whole_opt.buff)[wcslen(str)], L"=", COMPLETE_SEP_STR, o->desc, (void *)0) );
|
||||||
// fwprintf( stderr, L"Add with param %ls\n", o->long_opt );
|
// fwprintf( stderr, L"Add with param %ls\n", o->long_opt );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1766,7 +1814,10 @@ static void complete_param_expand( wchar_t *str,
|
|||||||
else
|
else
|
||||||
comp_str = str;
|
comp_str = str;
|
||||||
|
|
||||||
// fwprintf( stderr, L"expand_string( \"%ls\", [list], EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | %ls )\n", comp_str, do_file?L"0":L"EXPAND_SKIP_WILDCARDS" );
|
debug( 2,
|
||||||
|
L"expand_string( \"%ls\", comp_out, EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | %ls );",
|
||||||
|
comp_str,
|
||||||
|
do_file?L"0":L"EXPAND_SKIP_WILDCARDS" );
|
||||||
|
|
||||||
expand_string( wcsdup(comp_str), comp_out, EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | (do_file?0:EXPAND_SKIP_WILDCARDS) );
|
expand_string( wcsdup(comp_str), comp_out, EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | (do_file?0:EXPAND_SKIP_WILDCARDS) );
|
||||||
}
|
}
|
||||||
@@ -1801,7 +1852,7 @@ static int complete_variable( const wchar_t *var,
|
|||||||
/*
|
/*
|
||||||
Variable description is 'Variable: VALUE
|
Variable description is 'Variable: VALUE
|
||||||
*/
|
*/
|
||||||
blarg = wcsdupcat2( &name[varlen], COMPLETE_VAR_DESC_VAL, value, 0 );
|
blarg = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, 0 );
|
||||||
|
|
||||||
if( blarg )
|
if( blarg )
|
||||||
{
|
{
|
||||||
@@ -1928,6 +1979,7 @@ static int try_complete_user( const wchar_t *cmd,
|
|||||||
{
|
{
|
||||||
wchar_t *blarg = wcsdupcat2( &pw_name[name_len],
|
wchar_t *blarg = wcsdupcat2( &pw_name[name_len],
|
||||||
L"/",
|
L"/",
|
||||||
|
COMPLETE_SEP_STR,
|
||||||
COMPLETE_USER_DESC,
|
COMPLETE_USER_DESC,
|
||||||
0 );
|
0 );
|
||||||
if( blarg != 0 )
|
if( blarg != 0 )
|
||||||
@@ -1963,7 +2015,7 @@ void complete( const wchar_t *cmd,
|
|||||||
error_max=0;
|
error_max=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If we are completing a variable name or a tilde expantion user
|
If we are completing a variable name or a tilde expansion user
|
||||||
name, we do that and return. No need for any other competions.
|
name, we do that and return. No need for any other competions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2009,7 +2061,7 @@ void complete( const wchar_t *cmd,
|
|||||||
|
|
||||||
tok_init( &tok, buff, TOK_ACCEPT_UNFINISHED );
|
tok_init( &tok, buff, TOK_ACCEPT_UNFINISHED );
|
||||||
|
|
||||||
while( !end_loop )
|
while( tok_has_next( &tok) && !end_loop )
|
||||||
{
|
{
|
||||||
switch( tok_last_type( &tok ) )
|
switch( tok_last_type( &tok ) )
|
||||||
{
|
{
|
||||||
@@ -2055,7 +2107,8 @@ void complete( const wchar_t *cmd,
|
|||||||
reader_current_token_extent( &begin, &end, &prev_begin, &prev_end );
|
reader_current_token_extent( &begin, &end, &prev_begin, &prev_end );
|
||||||
|
|
||||||
current_token = wcsndup( begin, reader_get_cursor_pos()-(begin-reader_get_buffer()) );
|
current_token = wcsndup( begin, reader_get_cursor_pos()-(begin-reader_get_buffer()) );
|
||||||
prev_token = wcsndup( prev_begin, prev_end - prev_begin );
|
|
||||||
|
prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L"");
|
||||||
|
|
||||||
// fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token );
|
// fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token );
|
||||||
|
|
||||||
|
|||||||
97
config.h.in
97
config.h.in
@@ -1,97 +0,0 @@
|
|||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* CPU type */
|
|
||||||
#undef CPU
|
|
||||||
|
|
||||||
/* Documentation directory */
|
|
||||||
#undef DOCDIR
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `futimes' function. */
|
|
||||||
#undef HAVE_FUTIMES
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <getopt.h> header file. */
|
|
||||||
#undef HAVE_GETOPT_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#undef HAVE_INTTYPES_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `rt' library (-lrt). */
|
|
||||||
#undef HAVE_LIBRT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
|
||||||
#undef HAVE_LIBSOCKET
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#undef HAVE_MEMORY_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <ncurses.h> header file. */
|
|
||||||
#undef HAVE_NCURSES_H
|
|
||||||
|
|
||||||
/* Define to 1 if HAVE_RLIMIT_AS is defined in <sys/resource.h>. */
|
|
||||||
#undef HAVE_RLIMIT_AS
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#undef HAVE_STDINT_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#undef HAVE_STRINGS_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#undef HAVE_STRING_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
|
||||||
#undef HAVE_SYS_RESOURCE_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#undef HAVE_SYS_STAT_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#undef HAVE_SYS_TYPES_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <termio.h> header file. */
|
|
||||||
#undef HAVE_TERMIO_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#undef HAVE_UNISTD_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `wcswidth' function. */
|
|
||||||
#undef HAVE_WCSWIDTH
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `wcwidth' function. */
|
|
||||||
#undef HAVE_WCWIDTH
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `wprintf' function. */
|
|
||||||
#undef HAVE_WPRINTF
|
|
||||||
|
|
||||||
/* Define to 1 if you have the file `AC_File'. */
|
|
||||||
#undef HAVE__PROC_SELF_STAT
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#undef PACKAGE_BUGREPORT
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#undef PACKAGE_NAME
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#undef PACKAGE_STRING
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#undef PACKAGE_TARNAME
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#undef PACKAGE_VERSION
|
|
||||||
|
|
||||||
/* Installation directory */
|
|
||||||
#undef PREFIX
|
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
|
||||||
#undef STDC_HEADERS
|
|
||||||
|
|
||||||
/* System configuration directory */
|
|
||||||
#undef SYSCONFDIR
|
|
||||||
|
|
||||||
/* Evil kludge to get Power based machines to work */
|
|
||||||
#undef TPUTS_KLUDGE
|
|
||||||
112
configure.ac
112
configure.ac
@@ -1,22 +1,26 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(fish,1.16.1,axel@liljencrantz.se)
|
AC_INIT(fish,1.19.0,fish-users@lists.sf.net)
|
||||||
|
|
||||||
AC_CANONICAL_TARGET
|
# Run autoheader automatically, it's quick, and saves people the hassle of remembering to run it manually
|
||||||
|
autoheader
|
||||||
if test $target_cpu = powerpc; then
|
|
||||||
AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
|
|
||||||
|
|
||||||
|
# Tell autoconf to create config.h header
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
|
|
||||||
# Checks for programs.
|
# Set up various programs needed for install
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
#AC_ISC_POSIX
|
|
||||||
#AC_PROG_MAKE_SET
|
# Check for doxygen, needed to build
|
||||||
|
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
|
||||||
|
|
||||||
|
if ! test $has_doxygen = "true"; then
|
||||||
|
echo Could not find the Doxygen program in your path.
|
||||||
|
echo This program is needed to build fish.
|
||||||
|
echo Please install it and try again.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Optionally drop xsel
|
# Optionally drop xsel
|
||||||
AC_ARG_WITH( xsel,
|
AC_ARG_WITH( xsel,
|
||||||
@@ -35,21 +39,26 @@ else
|
|||||||
AC_SUBST( XSEL_MAN_PATH,[ ])
|
AC_SUBST( XSEL_MAN_PATH,[ ])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Test cpu for special handling of ppc
|
||||||
|
AC_CANONICAL_TARGET
|
||||||
|
|
||||||
|
if test $target_cpu = powerpc; then
|
||||||
|
AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
|
||||||
|
|
||||||
|
|
||||||
|
# Set up install locations
|
||||||
if [[ "$prefix" = NONE ]]; then
|
if [[ "$prefix" = NONE ]]; then
|
||||||
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
|
AC_DEFINE_UNQUOTED( [PREFIX], L"/usr/local", [Installation directory])
|
||||||
AC_SUBST( PREFIX, /usr/local)
|
AC_SUBST( PREFIX, /usr/local)
|
||||||
AC_SUBST(sysconfdir,[/etc])
|
|
||||||
export prefix=/usr/local
|
export prefix=/usr/local
|
||||||
else
|
else
|
||||||
AC_DEFINE_UNQUOTED( [PREFIX], L"$prefix", [Installation directory])
|
AC_DEFINE_UNQUOTED( [PREFIX], L"$prefix", [Installation directory])
|
||||||
AC_SUBST( PREFIX, [$prefix])
|
AC_SUBST( PREFIX, [$prefix])
|
||||||
AC_SUBST(sysconfdir,[/etc])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo $prefix | grep \^$HOME >/dev/null; then
|
|
||||||
AC_SUBST(sysconfdir,[$HOME/etc])
|
|
||||||
AC_MSG_NOTICE(["Install in $HOME"])
|
|
||||||
fi
|
|
||||||
AC_SUBST(fishdir,[/fish.d])
|
AC_SUBST(fishdir,[/fish.d])
|
||||||
AC_SUBST(fishfile,[/fish])
|
AC_SUBST(fishfile,[/fish])
|
||||||
AC_SUBST(fishinputfile,[/fish_inputrc])
|
AC_SUBST(fishinputfile,[/fish_inputrc])
|
||||||
@@ -61,7 +70,12 @@ if test -z $docdir; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
|
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
|
||||||
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$sysconfdir"], [System configuration directory] )
|
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
|
||||||
|
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
|
||||||
|
|
||||||
|
# Set up locale directory
|
||||||
|
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
|
||||||
|
AC_SUBST( [LOCALEDIR], [$datadir/locale])
|
||||||
|
|
||||||
# See if Linux procfs is present
|
# See if Linux procfs is present
|
||||||
AC_CHECK_FILES([/proc/self/stat])
|
AC_CHECK_FILES([/proc/self/stat])
|
||||||
@@ -70,9 +84,6 @@ AC_CHECK_FILES([/proc/self/stat])
|
|||||||
AC_CHECK_FILE([/usr/pkg/lib],[AC_SUBST(LIBDIR,[-L/usr/pkg/lib\ -R/usr/pkg/lib])])
|
AC_CHECK_FILE([/usr/pkg/lib],[AC_SUBST(LIBDIR,[-L/usr/pkg/lib\ -R/usr/pkg/lib])])
|
||||||
AC_CHECK_FILE([/usr/pkg/include],[AC_SUBST(INCLUDEDIR,[-I/usr/pkg/include])])
|
AC_CHECK_FILE([/usr/pkg/include],[AC_SUBST(INCLUDEDIR,[-I/usr/pkg/include])])
|
||||||
|
|
||||||
AC_CHECK_FUNCS( [wprintf futimes wcwidth wcswidth] )
|
|
||||||
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h])
|
|
||||||
|
|
||||||
# Check for RLIMIT_AS in sys/resource.h.
|
# Check for RLIMIT_AS in sys/resource.h.
|
||||||
AC_MSG_CHECKING([for RLIMIT_AS in sys/resource.h])
|
AC_MSG_CHECKING([for RLIMIT_AS in sys/resource.h])
|
||||||
AC_TRY_COMPILE([#include <sys/resource.h>],
|
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||||
@@ -85,16 +96,65 @@ else
|
|||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for RLIMIT_MEMLOCK in sys/resource.h.
|
||||||
|
AC_MSG_CHECKING([for RLIMIT_MEMLOCK in sys/resource.h])
|
||||||
|
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||||
|
[int tmp; tmp=RLIMIT_MEMLOCK;], have_rlimit_as=yes, have_rlimit_as=no)
|
||||||
|
if test "$have_rlimit_as" = yes; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE([HAVE_RLIMIT_MEMLOCK], [1],
|
||||||
|
[Define to 1 if HAVE_RLIMIT_MEMLOCK is defined in <sys/resource.h>.])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for RLIMIT_RSS in sys/resource.h.
|
||||||
|
AC_MSG_CHECKING([for RLIMIT_RSS in sys/resource.h])
|
||||||
|
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||||
|
[int tmp; tmp=RLIMIT_RSS;], have_rlimit_as=yes, have_rlimit_as=no)
|
||||||
|
if test "$have_rlimit_as" = yes; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE([HAVE_RLIMIT_RSS], [1],
|
||||||
|
[Define to 1 if HAVE_RLIMIT_RSS is defined in <sys/resource.h>.])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check for RLIMIT_NPROC in sys/resource.h.
|
||||||
|
AC_MSG_CHECKING([for RLIMIT_NPROC in sys/resource.h])
|
||||||
|
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||||
|
[int tmp; tmp=RLIMIT_NPROC;], have_rlimit_as=yes, have_rlimit_as=no)
|
||||||
|
if test "$have_rlimit_as" = yes; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE([HAVE_RLIMIT_NPROC], [1],
|
||||||
|
[Define to 1 if HAVE_RLIMIT_NPROC is defined in <sys/resource.h>.])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for libraries
|
||||||
AC_CHECK_LIB(socket, connect)
|
AC_CHECK_LIB(socket, connect)
|
||||||
AC_CHECK_LIB(rt, nanosleep)
|
AC_CHECK_LIB(rt, nanosleep)
|
||||||
|
|
||||||
|
# Check for various header files
|
||||||
|
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h])
|
||||||
|
|
||||||
|
# Check for various function
|
||||||
|
AC_CHECK_FUNCS(wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext wprintf futimes wcwidth wcswidth getopt_long )
|
||||||
|
|
||||||
|
# Check again for gettext library, so we can insert information
|
||||||
|
AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) )
|
||||||
|
|
||||||
# Check if we have ncurses, and use it rather than curses if possible.
|
# Check if we have ncurses, and use it rather than curses if possible.
|
||||||
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
|
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
|
||||||
|
|
||||||
#Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
|
# Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
|
||||||
#ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
|
# ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
|
||||||
#does not properly support terminfo.
|
# does not properly support terminfo.
|
||||||
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
|
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish])
|
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
echo "Now run 'make' and 'make install'"
|
||||||
|
|||||||
@@ -2,22 +2,16 @@
|
|||||||
\section and and - Conditionally execute a command
|
\section and and - Conditionally execute a command
|
||||||
|
|
||||||
\subsection and-synopsis Synopsis
|
\subsection and-synopsis Synopsis
|
||||||
<tt>and COMMAND1; COMMAND2</tt>
|
<tt>COMMAND1; and COMMAND2</tt>
|
||||||
|
|
||||||
\subsection and-description Description
|
\subsection and-description Description
|
||||||
|
|
||||||
The \c and builtin is used to execute one command, and if it returns
|
The \c and builtin is used to execute a command if the current exit status (as set by the last previous command) is zero
|
||||||
zero status, also execute a second command.
|
|
||||||
|
|
||||||
\subsection and-example Example
|
\subsection and-example Example
|
||||||
|
|
||||||
The following code runs the \c make command to build a program, and if it suceeds, it runs <tt>make install</tt>, which installs the program.
|
The following code runs the \c make command to build a program, and if it suceeds, it runs <tt>make install</tt>, which installs the program.
|
||||||
<pre>
|
<pre>
|
||||||
and make; make install
|
make; and make install
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
\c or and \c and can be nested, as in this example, that attempts to build and install a program, and removed the files created by the build process on failiure
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
or and make; make install; make clean
|
|
||||||
</pre>
|
|
||||||
|
|||||||
19
doc_src/block.txt
Normal file
19
doc_src/block.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
\section block block - Temporarily block delivery of events
|
||||||
|
|
||||||
|
\subsection block-synopsis Synopsis
|
||||||
|
<tt>block [OPTIONS...]</tt>
|
||||||
|
|
||||||
|
\subsection block-description Description
|
||||||
|
|
||||||
|
- <tt>-l</tt> or <tt>--local</tt> Release the block at the end of the currently innermost block scope
|
||||||
|
- <tt>-g</tt> or <tt>--global</tt> Never automatically release the lock
|
||||||
|
- <tt>-e</tt> or <tt>--erase</tt> Release global block
|
||||||
|
|
||||||
|
\subsection block-example Example
|
||||||
|
|
||||||
|
<pre>block -g
|
||||||
|
\#Do something that should not be interrupted
|
||||||
|
block -e
|
||||||
|
</pre>
|
||||||
|
|
||||||
@@ -4,6 +4,11 @@
|
|||||||
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION] </tt>
|
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-d|--description) DESCRIPTION] </tt>
|
||||||
|
|
||||||
\subsection complete-description Description
|
\subsection complete-description Description
|
||||||
|
|
||||||
|
For an introduction to how to specify completions, see the section <a
|
||||||
|
href='index.html#completions-own'>Writing your own completions</a> of
|
||||||
|
the fish manual.
|
||||||
|
|
||||||
- <tt>COMMAND</tt> is the name of the command for which to add a completion
|
- <tt>COMMAND</tt> is the name of the command for which to add a completion
|
||||||
- <tt>SHORT_OPTION</tt> is a one character option for the command
|
- <tt>SHORT_OPTION</tt> is a one character option for the command
|
||||||
- <tt>LONG_OPTION</tt> is a multi character option for the command
|
- <tt>LONG_OPTION</tt> is a multi character option for the command
|
||||||
@@ -61,7 +66,9 @@ are valid, like the \c nodeps switch.
|
|||||||
|
|
||||||
This can be written as:
|
This can be written as:
|
||||||
|
|
||||||
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d 'Dont check dependencies'</tt>
|
<tt>complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d
|
||||||
|
"Don't check dependencies"</tt>
|
||||||
|
|
||||||
where \c __fish_contains_opt is a function that checks the commandline buffer for the presense of a specified set of options.
|
where \c __fish_contains_opt is a function that checks the commandline
|
||||||
|
buffer for the presense of a specified set of options.
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ the user does not have to worry about an array containing elements
|
|||||||
such as dashes. \c fish performs a special check when invoking the
|
such as dashes. \c fish performs a special check when invoking the
|
||||||
count program, and if the user uses a help option, this help page is
|
count program, and if the user uses a help option, this help page is
|
||||||
displayed, but if a help option is contained inside of a variable or
|
displayed, but if a help option is contained inside of a variable or
|
||||||
is the result of expantion, it will be passed on to the count program.
|
is the result of expansion, it will be passed on to the count program.
|
||||||
|
|
||||||
\subsection count-example Example
|
\subsection count-example Example
|
||||||
|
|
||||||
|
|||||||
511
doc_src/doc.hdr
511
doc_src/doc.hdr
@@ -1,15 +1,20 @@
|
|||||||
/** \mainpage fish
|
/** \mainpage Fish user documentation
|
||||||
|
|
||||||
\c fish is a user friendly shell intended mostly for interactive use.
|
\section introduction The friendly interactive shell
|
||||||
A shell is a program which allows you to execute other programs by
|
|
||||||
typing their names. For updates on \c fish, go to the <a
|
This is the documentation for \c fish, the friendly interactive
|
||||||
|
shell. \c fish is a user friendly commandline shell intended
|
||||||
|
mostly for interactive use. A shell is a program used to execute other
|
||||||
|
programs. For the latest information on \c fish, please visit the <a
|
||||||
href="http://roo.no-ip.org/fish/"><tt>fish</tt> homepage</a>.
|
href="http://roo.no-ip.org/fish/"><tt>fish</tt> homepage</a>.
|
||||||
|
|
||||||
\section syntax Syntax overview
|
\section syntax Syntax overview
|
||||||
|
|
||||||
Shells like \c fish are used by giving them commands. Every \c fish command follows the same simple syntax.
|
Shells like fish are used by giving them commands. Every \c fish
|
||||||
|
command follows the same simple syntax.
|
||||||
|
|
||||||
A command is executed by writing the name of the command followed by any arguments.
|
A command is executed by writing the name of the command followed by
|
||||||
|
any arguments.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@@ -18,7 +23,7 @@ Example:
|
|||||||
calls the \c echo command. \c echo is a command which will write its
|
calls the \c echo command. \c echo is a command which will write its
|
||||||
arguments to the screen. In the example above, the output will be
|
arguments to the screen. In the example above, the output will be
|
||||||
'hello world'. Everything in fish is done with commands. There are
|
'hello world'. Everything in fish is done with commands. There are
|
||||||
commonds for performing a set of command multiple times, commands for
|
commands for performing a set of commands multiple times, commands for
|
||||||
assigning variables, commands for treating a group of commands as a
|
assigning variables, commands for treating a group of commands as a
|
||||||
single command, etc.. And every single command follows the same simple
|
single command, etc.. And every single command follows the same simple
|
||||||
syntax.
|
syntax.
|
||||||
@@ -33,7 +38,7 @@ topic. There are manual pages for almost every command on most
|
|||||||
computers. There are also manual pages for many other things, such as
|
computers. There are also manual pages for many other things, such as
|
||||||
system libraries and important files.
|
system libraries and important files.
|
||||||
|
|
||||||
Every program on a computer can be used as a command in \c fish. If
|
Every program on your computer can be used as a command in \c fish. If
|
||||||
the program file is located in one of the directories in the <a
|
the program file is located in one of the directories in the <a
|
||||||
href="#variables-special">PATH</a>, it is sufficient to type the name
|
href="#variables-special">PATH</a>, it is sufficient to type the name
|
||||||
of the program to use it. Otherwise the whole filename, including the
|
of the program to use it. Otherwise the whole filename, including the
|
||||||
@@ -61,17 +66,23 @@ written on the same line by separating them with semicolons.
|
|||||||
Sometimes features such as <a href="#globbing">parameter expansion</a>
|
Sometimes features such as <a href="#globbing">parameter expansion</a>
|
||||||
and <a href="#escapes">character escapes</a> get in the way. When that
|
and <a href="#escapes">character escapes</a> get in the way. When that
|
||||||
happens, the user can write a parameter within quotes, either '
|
happens, the user can write a parameter within quotes, either '
|
||||||
(single quote) or " (double quote). There is no difference between
|
(single quote) or " (double quote). There is one important difference
|
||||||
single quoted and double quoted strings. A quoted parameter will not
|
between single quoted and double quoted strings: When using double
|
||||||
be parameter expanded, may contain spaces, and the only escape
|
quoted string, <a href='#expand-variable'>variable expansion</a> still
|
||||||
sequences allowed is the corresponding quote character. Single and
|
takes place. Other than that, a quoted parameter will not be
|
||||||
double quotes may be nested.
|
parameter expanded, may contain spaces, and escape sequences are
|
||||||
|
ignored. Single quotes have no special meaning withing double quotes
|
||||||
|
and vice versa.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
<tt>rm "cumbersome filename.txt"</tt>
|
<tt>rm "cumbersome filename.txt"</tt>
|
||||||
|
|
||||||
Will remove the file 'cumbersome filename.txt'.
|
Will remove the file 'cumbersome filename.txt', while
|
||||||
|
|
||||||
|
<tt>rm cumbersome filename.txt</tt>
|
||||||
|
|
||||||
|
would remove the two files 'cumbersome' and 'filenmae.txt'.
|
||||||
|
|
||||||
\subsection escapes Escaping characters
|
\subsection escapes Escaping characters
|
||||||
|
|
||||||
@@ -113,11 +124,11 @@ a number called a file descriptor (FD). These are:
|
|||||||
- Standard output, FD 1, for writing, defaults to writing to the screen.
|
- Standard output, FD 1, for writing, defaults to writing to the screen.
|
||||||
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
|
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
|
||||||
|
|
||||||
The reason for providing for two methods of output is so errors and
|
The reason for providing for two methods of output is that errors and
|
||||||
warnings can be separated from regular program output.
|
warnings can be separated from regular program output.
|
||||||
|
|
||||||
Any file descriptor can be directed to a different output than it's
|
Any file descriptor can be directed to a different output than it's
|
||||||
default through a simple mechanism called a redirecton.
|
default through a simple mechanism called a redirection.
|
||||||
|
|
||||||
An example of a file redirection is <tt> echo hello \>output.txt</tt>,
|
An example of a file redirection is <tt> echo hello \>output.txt</tt>,
|
||||||
which directs the output of the echo command to the file error.txt.
|
which directs the output of the echo command to the file error.txt.
|
||||||
@@ -131,8 +142,8 @@ which directs the output of the echo command to the file error.txt.
|
|||||||
<tt>DESTINATION</tt> can be one of the following:
|
<tt>DESTINATION</tt> can be one of the following:
|
||||||
|
|
||||||
- A filename. The output will be written to the specified file.
|
- A filename. The output will be written to the specified file.
|
||||||
- An ampersand (\&) followed by the number of a file descriptor. The file descriptor will be a duplicate of the specified file descriptor.
|
- An ampersand (\&) followed by the number of another file descriptor. The file descriptor will be a duplicate of the specified file descriptor.
|
||||||
- A minus sign (-). The FD will be closed.
|
- A minus sign (-). The file descriptor will be closed.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@@ -210,7 +221,7 @@ This is a short explanation of some of the commonly used words in fish.
|
|||||||
- argument, a parameter given to a command
|
- argument, a parameter given to a command
|
||||||
- builtin, a command that is implemented as part of the shell
|
- builtin, a command that is implemented as part of the shell
|
||||||
- command, a program
|
- command, a program
|
||||||
- function, a command that is implemented as a set of fish commands
|
- function, a block of one or more fish commands that can be called as a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
||||||
- job, a running pipeline or command
|
- job, a running pipeline or command
|
||||||
- pipeline, a set of commands stringed together so that the output of one command is the input of the next command
|
- pipeline, a set of commands stringed together so that the output of one command is the input of the next command
|
||||||
- redirection, a operation that changes one of the input/output streams associated with a job
|
- redirection, a operation that changes one of the input/output streams associated with a job
|
||||||
@@ -232,15 +243,16 @@ type <tt>fg -h</tt> or <tt>help fg</tt>.
|
|||||||
|
|
||||||
Tab completion is one of the most time saving features of any modern
|
Tab completion is one of the most time saving features of any modern
|
||||||
shell. By tapping the tab key, the user asks \c fish to guess the rest
|
shell. By tapping the tab key, the user asks \c fish to guess the rest
|
||||||
of the command or parameter that the user is currently typing. If
|
of the command or parameter that the user is currently typing. If \c
|
||||||
there is only one possible completion, \c fish will write it out. If
|
fish can only find one possible completion, \c fish will write it
|
||||||
there is more than one completion, \c fish will write out the longest
|
out. If there is more than one completion, \c fish will write out the
|
||||||
common prefix that all completions have in common. If all completions
|
longest common prefix that all completions have in common. If all
|
||||||
differ on the first character, a list of all possible completions is
|
completions differ on the first character, a list of all possible
|
||||||
printed. The list features descriptions of the completions and if the
|
completions is printed. The list features descriptions of the
|
||||||
list doesn't fit the screen, it is scrollable by using the arrow keys,
|
completions and if the list doesn't fit the screen, it is scrollable
|
||||||
the page up/page down keys or the space bar. Press any other key will
|
by using the arrow keys, the page up/page down keys or the space
|
||||||
exit the list and insert the presssed key into the command line.
|
bar. Press any other key will exit the list and insert the pressed key
|
||||||
|
into the command line.
|
||||||
|
|
||||||
These are the general purpose tab completions that \c fish provides:
|
These are the general purpose tab completions that \c fish provides:
|
||||||
|
|
||||||
@@ -254,44 +266,72 @@ These are the general purpose tab completions that \c fish provides:
|
|||||||
of these completions are simple options like the \c -l option for \c
|
of these completions are simple options like the \c -l option for \c
|
||||||
ls, but some are more advanced. The latter include:
|
ls, but some are more advanced. The latter include:
|
||||||
|
|
||||||
- The programs 'man' and 'whatis' complete using all installed
|
- The programs 'man' and 'whatis' show all installed
|
||||||
manual pages.
|
manual pages as completions.
|
||||||
- The 'make' program complete using all targets in the Makefile in
|
- The 'make' program uses all targets in the Makefile in
|
||||||
the current directory.
|
the current directory as completions.
|
||||||
- The 'mount' command complete using all mount points specified in fstab.
|
- The 'mount' command uses all mount points specified in fstab as completions.
|
||||||
- The 'ssh' command complete using all hosts in that are stored
|
- The 'ssh' command uses all hosts in that are stored
|
||||||
in the known_hosts file. (see the ssh documentation for more information)
|
in the known_hosts file as completions. (see the ssh documentation for more information)
|
||||||
- The 'su' command complete using all users on the system
|
- The 'su' command uses all users on the system as completions.
|
||||||
- The \c apt-get, \c rpm and \c tym commands complete using all installed packages.
|
- The \c apt-get, \c rpm and \c yum commands use all installed packages as completions.
|
||||||
|
|
||||||
Specifying your own completions is easy. If the command 'myprog' has
|
\subsection completion-own Writing your own completions
|
||||||
an option '-o' which can also be written as '--output', which requires
|
|
||||||
an additional value of either 'yes' or 'no' and decides if the program
|
|
||||||
should write anything, this can be specified by writing:
|
|
||||||
|
|
||||||
<tt>complete -c myprog -s o -l output -r -a "yes no" -d "Write output"</tt>
|
Specifying your own completions is not complicated. To specify a
|
||||||
|
completion, use the \c complete command. \c complete takes
|
||||||
|
as a parameter the name of the command to specify a completion
|
||||||
|
for. For example, to add a completion for the program \c myprog, one
|
||||||
|
would start the completion command with <tt>complete -c myprog
|
||||||
|
...</tt>. To provide a list of possible completions for myprog, use
|
||||||
|
the \c -a switch. If \c myprog accepts the arguments start and stop,
|
||||||
|
this can be specified as <tt>complete -c myprog -a 'start
|
||||||
|
stop'</tt>. The argument to the \c -a switch is always a single
|
||||||
|
string. At completion time, it will be tokenized on spaces and tabs,
|
||||||
|
and variable expansion, command substitution and other forms of
|
||||||
|
parameter expansion will take place.
|
||||||
|
|
||||||
For a more complete description of how to specify your own
|
Fish has a special syntax to support specifying switches accepted by a
|
||||||
completions, go <a href="builtins.html#complete">here</a> or write 'complete --help' in the \c fish shell.
|
command. The switches \c -s, \c -l and \c -o are used to specify a
|
||||||
|
short switch (single character, such as -l), a gnu style long switch (such as
|
||||||
|
--color) and an old-style long switch (like -shuffle),
|
||||||
|
respectively. If the command 'myprog' has an option '-o' which can
|
||||||
|
also be written as '--output', and which can take an additional value
|
||||||
|
of either 'yes' or 'no', this can be specified by writing:
|
||||||
|
|
||||||
|
<tt>complete -c myprog -s o -l output -a "yes no"</tt>
|
||||||
|
|
||||||
|
There are also special switches for specifying that a switch requires
|
||||||
|
an argument, to disable filename completion, to create completions
|
||||||
|
that are only available in some combinations, etc.. For a complete
|
||||||
|
description of the various switches accepted by the \c complete
|
||||||
|
command, see the documentation for the <a
|
||||||
|
href="builtins.html#complete">complete</a> builtin, or write 'complete
|
||||||
|
--help' inside the \c fish shell.
|
||||||
|
|
||||||
|
For examples of how to write your own complex completions, study the
|
||||||
|
completions in /etc/fish.d/completions (or ~/etc/fish.d/completions if
|
||||||
|
you installed fish in your home directory).
|
||||||
|
|
||||||
If you wish to use a completion, you should consider adding it to your
|
If you wish to use a completion, you should consider adding it to your
|
||||||
startup files. When completion has been requested for a command \c
|
startup files. When completion has been requested for a command \c
|
||||||
COMMAND, fish will automatically look for the file
|
COMMAND, fish will automatically look for the file
|
||||||
~/.fish.d/completions/COMMAND.fish. If it exists, it will be
|
~/.fish.d/completions/COMMAND.fish. If it exists, it will be
|
||||||
automatically loaded. For examples of how to write your own complex
|
automatically loaded. If you have written new completions for a common
|
||||||
completions, study the completions in /etc/fish.d/completions (or ~/etc/fish.d/completions if you installed fish in your home directory).
|
Unix command, please consider sharing your work by sending it to <a
|
||||||
|
href='mailto: fish-users@lists.sf.net'>the fish mailinglist</a>.
|
||||||
|
|
||||||
\section expand Parameter expansion (Globbing)
|
\section expand Parameter expansion (Globbing)
|
||||||
|
|
||||||
When an argument for a program is given on the commandline, it
|
When an argument for a program is given on the commandline, it
|
||||||
undergoes the process of parameter expantion before it is sent on to
|
undergoes the process of parameter expansion before it is sent on to
|
||||||
the command. There are many ways in which the user can specify a
|
the command. There are many ways in which the user can specify a
|
||||||
parameter to be expanded. These include:
|
parameter to be expanded. These include:
|
||||||
|
|
||||||
\subsection expand-wildcards Wildcards
|
\subsection expand-wildcard Wildcards
|
||||||
|
|
||||||
If a star (*) or a question mark (?) is present in the parameter, \c
|
If a star (*) or a question mark (?) is present in the parameter, \c
|
||||||
fish attempts to mach the given parameter to any files in such a
|
fish attempts to match the given parameter to any files in such a
|
||||||
way that '?' can match any character except '/' and '*' can match any
|
way that '?' can match any character except '/' and '*' can match any
|
||||||
string of characters not containing '/'.
|
string of characters not containing '/'.
|
||||||
|
|
||||||
@@ -300,17 +340,24 @@ Example:
|
|||||||
|
|
||||||
<code>???</code> matches any file in the current directory whose name is exactly three characters long.
|
<code>???</code> matches any file in the current directory whose name is exactly three characters long.
|
||||||
|
|
||||||
|
If no matches are found for a specific wildcard, it will expand into
|
||||||
|
zero arguments, i.e. to nothing. If none of the wildcarded arguments
|
||||||
|
sent to a command result in any matches, the command will not be
|
||||||
|
executed. If this happens when using the shell interactively, a
|
||||||
|
warning will also be printed.
|
||||||
|
|
||||||
\subsection expand-command-substitution Command substitution
|
\subsection expand-command-substitution Command substitution
|
||||||
|
|
||||||
If a parameter contains a set of parenthesis, the text enclosed by the
|
If a parameter contains a set of parenthesis, the text enclosed by the
|
||||||
parentesis will be interpreted as a list of commands. Om expantion,
|
parenthesis will be interpreted as a list of commands. Om expansion,
|
||||||
this list is executed, and substituted by the output. If the output is
|
this list is executed, and substituted by the output. If the output is
|
||||||
more than one line long, each line will be expanded to a new
|
more than one line long, each line will be expanded to a new
|
||||||
parameter.
|
parameter.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
The command <code>echo (basename image.jpg .jpg).png</code> will output 'image.png'.
|
The command <code>echo (basename image.jpg .jpg).png</code> will
|
||||||
|
output 'image.png'.
|
||||||
|
|
||||||
The command <tt>for i in *.jpg; convert $i (basename $i .jpg).png;
|
The command <tt>for i in *.jpg; convert $i (basename $i .jpg).png;
|
||||||
end</tt> will convert all Jpeg files in the current directory to the
|
end</tt> will convert all Jpeg files in the current directory to the
|
||||||
@@ -319,7 +366,7 @@ PNG format.
|
|||||||
|
|
||||||
\subsection expand-brace Brace expansion
|
\subsection expand-brace Brace expansion
|
||||||
|
|
||||||
A comma separated list of characters enclosed en curly braces will be
|
A comma separated list of characters enclosed in curly braces will be
|
||||||
expanded so each element of the list becomes a new parameter.
|
expanded so each element of the list becomes a new parameter.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@@ -339,11 +386,45 @@ href="#variables"> Environment variables</a> section.
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
<tt> echo \$HOME</tt> prints the home directory of the current
|
<tt> echo \$HOME</tt> prints the home directory of the current
|
||||||
user. If you wish to combine environment variables with text, you can
|
user.
|
||||||
|
|
||||||
|
If you wish to combine environment variables with text, you can
|
||||||
encase the variables within braces to embed a variable inside running
|
encase the variables within braces to embed a variable inside running
|
||||||
text like <tt>echo Konnichiwa {$USER}san</tt>, which will print a
|
text like <tt>echo Konnichiwa {$USER}san</tt>, which will print a
|
||||||
personalized Japanese greeting.
|
personalized Japanese greeting.
|
||||||
|
|
||||||
|
The {$USER}san syntax might need a bit of an elaboration. Posix
|
||||||
|
shells allow you to specify a variable name using '$VARNAME' or
|
||||||
|
'${VARNAME}'. Fish only supports the former, but has no support
|
||||||
|
whatsoever for the latter or anything remotely like it. So what is
|
||||||
|
'{$VARNAME}' then? Well, '{WHATEVER}' is <a href='#brace'>brace
|
||||||
|
expansion</a>, the same as supported by Posix shells, i.e. 'a{b,c}d'
|
||||||
|
-> 'abd acd' works both in bash and on fish. So '{$VARNAME}' is a
|
||||||
|
bracket-expansion with only a single element, i.e. it becomes
|
||||||
|
expanded to '$VARNAME', which will be variable expanded to the value
|
||||||
|
of the variable 'VARNAME'. So you might think that the brackets don't
|
||||||
|
actually do anything, and that is nearly the truth. The snag is that
|
||||||
|
there once along the way was a '}' in there somewhere, and } is not a
|
||||||
|
valid character in a variable name. So anything after the otherwise
|
||||||
|
pointless bracket expansion becomes NOT a part of the variable name,
|
||||||
|
even if it happens to be a legal variable name character. That's why
|
||||||
|
'{$USER}san' looks for the variable '$USER' and not for the variable
|
||||||
|
'$USERsan'. It's a case of one syntax lending itself nicely to
|
||||||
|
solving an unrelated problem in it's spare time.
|
||||||
|
|
||||||
|
Variable expansion is the only type of expansion performed on double
|
||||||
|
quoted strings. There is, however, an important difference in how
|
||||||
|
variables are expanded when quoted and when unquoted. An unquoted
|
||||||
|
variable expansion will result in a variable number of arguments. For
|
||||||
|
example, if the variable $foo has zero elements or is undefined, the
|
||||||
|
argument $foo will expand to zero elements. If the variable $foo is an
|
||||||
|
array of five elements, the argument $foo will expand to five
|
||||||
|
elements. When quoted, like "$foo", a variable expansion will always
|
||||||
|
result in exactly one argument. Undefined variables will expand to the
|
||||||
|
empty string, and array variables will be concatenated using the space
|
||||||
|
character.
|
||||||
|
|
||||||
|
|
||||||
\subsection expand-home Home directory expansion
|
\subsection expand-home Home directory expansion
|
||||||
|
|
||||||
The ~ (tilde) character at the beginning of a parameter, followed by a
|
The ~ (tilde) character at the beginning of a parameter, followed by a
|
||||||
@@ -354,7 +435,7 @@ directory of the process owner.
|
|||||||
\subsection expand-process Process expansion
|
\subsection expand-process Process expansion
|
||||||
|
|
||||||
The \% (percent) character at the beginning of a parameter followed by
|
The \% (percent) character at the beginning of a parameter followed by
|
||||||
a string is expanded into a process id. The following expantions are
|
a string is expanded into a process id. The following expansions are
|
||||||
performed:
|
performed:
|
||||||
|
|
||||||
- If the string is the entire word \c self, the shells pid is the result
|
- If the string is the entire word \c self, the shells pid is the result
|
||||||
@@ -394,7 +475,9 @@ will output 'abar1 abar2 abar3 afoo1 afoo2 afoo3'.
|
|||||||
|
|
||||||
The concept of environment variables are central to any
|
The concept of environment variables are central to any
|
||||||
shell. Environment variables are variables, whose values can be set
|
shell. Environment variables are variables, whose values can be set
|
||||||
and used by the user.
|
and used by the user. For information on how to use the current value
|
||||||
|
of a variable, see the section on <a href='#expand-variable'>variable
|
||||||
|
expansion</a>.
|
||||||
|
|
||||||
To set a variable value, use the <a href="builtins.html#set"> \c set
|
To set a variable value, use the <a href="builtins.html#set"> \c set
|
||||||
command</a>.
|
command</a>.
|
||||||
@@ -409,25 +492,25 @@ the shell through <a href="expand-variable">variable expansion</a>.
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
To use the value of a the variable \c smurf, use the command <tt>echo
|
To use the value of a the variable \c smurf, write $ (dollar symbol)
|
||||||
Smurfs are $smurf</tt>, which would print the result 'Smurfs are
|
followed by the name of the variable, like <tt>echo Smurfs are
|
||||||
blue'.
|
$smurf</tt>, which would print the result 'Smurfs are blue'.
|
||||||
|
|
||||||
\subsection variables-scope Variable scope
|
\subsection variables-scope Variable scope
|
||||||
|
|
||||||
There are three kinds of variables in fish, universal, global and
|
There are three kinds of variables in fish, universal, global and
|
||||||
local variables. Universal variables are shared between all fish
|
local variables. Universal variables are shared between all fish
|
||||||
sessions a user is running on one computer. Global variables are
|
sessions a user is running on one computer. Global variables are
|
||||||
specific to the current fish session, and will never be erased unless
|
specific to the current fish session, but are not associated with any
|
||||||
the user explicitly requests it using <tt>set -e</tt>. Local variables
|
specific block scope, and will never be erased unless the user
|
||||||
are specific to the current fish session, and associated with a
|
explicitly requests it using <tt>set -e</tt>. Local variables are
|
||||||
specific block of commands, and is automatically erased when a
|
specific to the current fish session, and associated with a specific
|
||||||
specific block goes out of scope. A block of commands is a series of
|
block of commands, and is automatically erased when a specific block
|
||||||
commands that begins with one of the commands \c 'for, \c 'while' , \c
|
goes out of scope. A block of commands is a series of commands that
|
||||||
'if', \c 'function', \c 'begin' or \c 'switch', and ends with the
|
begins with one of the commands \c 'for, \c 'while' , \c 'if', \c
|
||||||
command \c 'end'. The user can specify that a variable should have
|
'function', \c 'begin' or \c 'switch', and ends with the command \c
|
||||||
either global or local scope using the \c -g/--global or \c -l/--local
|
'end'. The user can specify that a variable should have either global
|
||||||
switches.
|
or local scope using the \c -g/--global or \c -l/--local switches.
|
||||||
|
|
||||||
Variables can be explicitly set to be universal with the \c -U or \c
|
Variables can be explicitly set to be universal with the \c -U or \c
|
||||||
--universal switch, global with the \c -g or \c --global switch, or
|
--universal switch, global with the \c -g or \c --global switch, or
|
||||||
@@ -436,21 +519,24 @@ creating or updating a variable are:
|
|||||||
|
|
||||||
-# If a variable is explicitly set to either universal, global or local, that setting will be honored
|
-# If a variable is explicitly set to either universal, global or local, that setting will be honored
|
||||||
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed
|
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed
|
||||||
-# If a variable is not explicitly set to be either universal, global or local and has never befor been defined, the variable will be local to the current scope
|
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing functions. If no function is executing, the variable will be global.
|
||||||
|
|
||||||
|
There may be many variables with the same name, but different scopes.
|
||||||
When using a variable, the variable scope will be searched from the
|
When using a variable, the variable scope will be searched from the
|
||||||
inside out, i.e. a local variable will be used rather than a global
|
inside out, i.e. a local variable will be used rather than a global
|
||||||
variable with the same name, a global variable will be used rather
|
variable with the same name, a global variable will be used rather
|
||||||
than a universal variable with the same name.
|
than a universal variable with the same name.
|
||||||
|
|
||||||
For example, the following code will not output anything:
|
Example:
|
||||||
|
|
||||||
|
The following code will not output anything:
|
||||||
<pre>
|
<pre>
|
||||||
if true
|
begin
|
||||||
# This is a nice local scope where all variables will die
|
# This is a nice local scope where all variables will die
|
||||||
set pirate 'There be treasure in them thar hills'
|
set -l pirate 'There be treasure in them thar hills'
|
||||||
end
|
end
|
||||||
|
|
||||||
# This will not output anything, since the pirate is dead
|
# This will not output anything, since the pirate was local
|
||||||
echo $pirate
|
echo $pirate
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -472,9 +558,9 @@ prompt will instantly change to blue on both terminals.
|
|||||||
\subsection variables-functions Variable scope for functions
|
\subsection variables-functions Variable scope for functions
|
||||||
|
|
||||||
When calling a function, all non-global variables temporarily
|
When calling a function, all non-global variables temporarily
|
||||||
dissapear. This shadowing of the local scope is needed since the
|
disappear. This shadowing of the local scope is needed since the
|
||||||
variable namespace would become cluttered, making it very easy to
|
variable namespace would become cluttered, making it very easy to
|
||||||
accidentaly overwrite variables from another function.
|
accidentally overwrite variables from another function.
|
||||||
|
|
||||||
For example, the following code will output 'Avast, mateys':
|
For example, the following code will output 'Avast, mateys':
|
||||||
|
|
||||||
@@ -510,7 +596,7 @@ identical to the scoping rules for variables:
|
|||||||
|
|
||||||
-# If a variable is explicitly set to either be exported or not exported, that setting will be honored
|
-# If a variable is explicitly set to either be exported or not exported, that setting will be honored
|
||||||
-# If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept
|
-# If a variable is not explicitly set to be exported or not exported, but has been previously defined, the previous exporting rule for the variable is kept
|
||||||
-# If a variable is not explicitly set to be either global or local and has never befor been defined, the variable will not be exported
|
-# If a variable is not explicitly set to be either global or local and has never before been defined, the variable will not be exported
|
||||||
|
|
||||||
|
|
||||||
\subsection variables-arrays Arrays
|
\subsection variables-arrays Arrays
|
||||||
@@ -557,28 +643,48 @@ echo $smurf
|
|||||||
\subsection variables-special Special variables
|
\subsection variables-special Special variables
|
||||||
|
|
||||||
The user can change the settings of \c fish by changing the values of
|
The user can change the settings of \c fish by changing the values of
|
||||||
certain environment variables.
|
certain environment variables.
|
||||||
|
|
||||||
- \c BROWSER, which is the users preferred web browser. If this variable is set, fish will use the specified browser instead of the system default browser to display the fish documentation.
|
- \c BROWSER, which is the users preferred web browser. If this variable is set, fish will use the specified browser instead of the system default browser to display the fish documentation.
|
||||||
- \c CDPATH, which is an array of directories in which to search for the new directory for the \c cd builtin.
|
- \c CDPATH, which is an array of directories in which to search for the new directory for the \c cd builtin.
|
||||||
- \c fish_color_normal, \c fish_color_command, \c fish_color_substitution, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c fish_pager_color_description and \c fish_pager_color_progress are used to change the color of various elements in \c fish. These variables are universal, i.e. when changing them, their new value will be used by all running fish sessions. The new value will also be retained when restarting fish.
|
- \c fish_color_normal, \c fish_color_command, \c fish_color_substitution, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c fish_pager_color_description and \c fish_pager_color_progress are used to change the color of various elements in \c fish. These variables are universal, i.e. when changing them, their new value will be used by all running fish sessions. The new value will also be retained when restarting fish.
|
||||||
- \c PATH, which is an array of directories in which to search for commands
|
- \c PATH, which is an array of directories in which to search for commands
|
||||||
- \c umask, which is the current file creation mask. The preffered way to change the umask variable is through the <a href="commands.html#umask">umask shellscript function</a>. An attempt to set umask to an invalid value will always fail.
|
- \c umask, which is the current file creation mask. The preferred way to change the umask variable is through the <a href="commands.html#umask">umask shellscript function</a>. An attempt to set umask to an invalid value will always fail.
|
||||||
|
|
||||||
\c fish also sends additional information to the user through the
|
\c fish also sends additional information to the user through the
|
||||||
values of certain environment variables. The user can not change the values of these variables. They are:
|
values of certain environment variables. The user can not change the
|
||||||
|
values of these variables. They are:
|
||||||
|
|
||||||
- \c _, which is the name of the currently running command.
|
- \c _, which is the name of the currently running command.
|
||||||
- \c history, which is an array containing the last commands that where entered
|
- \c history, which is an array containing the last commands that where entered.
|
||||||
- \c HOME, which is the users home directory. This variable can only be changed by the root user.
|
- \c HOME, which is the users home directory. This variable can only be changed by the root user.
|
||||||
- \c PWD, which is the current working directory.
|
- \c PWD, which is the current working directory.
|
||||||
- \c status, which is the exit status of the last foreground job to exit. If a job contains pipelines, the status of the last command in the pipeline is the status for the job.
|
- \c status, which is the exit status of the last foreground job to exit. If a job contains pipelines, the status of the last command in the pipeline is the status for the job.
|
||||||
- \c USER, which is the username. This variable can only be changed by the root user.
|
- \c USER, which is the username. This variable can only be changed by the root user.
|
||||||
|
- \c LANG, \c LC_ALL, \c LC_COLLATE, \c LC_CTYPE, \c LC_MESSAGES, \c LC_MONETARY, \c LC_NUMERIC and \c LC_TIME set the language option for the shell and subprograms. See the section <a href='#variables-locale'>Locale variables</a> for more information.
|
||||||
|
|
||||||
Variables whose name are in uppercase are exported to the commands
|
Variables whose name are in uppercase are exported to the commands
|
||||||
started by fish. \c fish also uses several variables internally. Such
|
started by fish. This rule is not enforced by fish, but it is good
|
||||||
variables are prefixed with the string __FISH or __fish. These should
|
coding practice to use casing to distinguish between exported and
|
||||||
be ignored by the user.
|
unexported variables. \c fish also uses several variables
|
||||||
|
internally. Such variables are prefixed with the string __FISH or
|
||||||
|
__fish. These should be ignored by the user.
|
||||||
|
|
||||||
|
\subsection variables-locale Locale variables
|
||||||
|
|
||||||
|
The most common way to set the locale to use a command like 'set -x
|
||||||
|
LANG en_GB.utf8', which sets the current locale to be the english
|
||||||
|
language, as used in Great Britain, using the UTF-8 character set. For
|
||||||
|
a list of available locales, use 'locale -a'.
|
||||||
|
|
||||||
|
\c LANG, \c LC_ALL, \c LC_COLLATE, \c LC_CTYPE, \c LC_MESSAGES, \c
|
||||||
|
LC_MONETARY, \c LC_NUMERIC and LC_TIME set the language option for the
|
||||||
|
shell and subprograms. These variables work as follows: \c LC_ALL
|
||||||
|
forces all the aspects of the locale to the specified value. If LC_ALL
|
||||||
|
is set, all other locale variables will be ignored. The other LC_
|
||||||
|
variables set the specified aspect of the locale information. LANG
|
||||||
|
is a fallback value, it will be used if none of the LC_ variables are
|
||||||
|
specified.
|
||||||
|
|
||||||
\section builtin-overview Builtins
|
\section builtin-overview Builtins
|
||||||
|
|
||||||
@@ -595,10 +701,12 @@ The following commands are distributed with fish. Many of them are
|
|||||||
builtins or shellscript functions, and can only be used inside fish.
|
builtins or shellscript functions, and can only be used inside fish.
|
||||||
|
|
||||||
- <a href="builtins.html#source">.</a>, read and execute the commands in a file
|
- <a href="builtins.html#source">.</a>, read and execute the commands in a file
|
||||||
|
- <a href="builtins.html#and">and</a>, execute command if previous command suceeded
|
||||||
- <a href="builtins.html#bg">bg</a>, set a command to the background
|
- <a href="builtins.html#bg">bg</a>, set a command to the background
|
||||||
- <a href="builtins.html#begin">begin</a>, execute a block of commands
|
- <a href="builtins.html#begin">begin</a>, execute a block of commands
|
||||||
- <a href="builtins.html#bind">bind</a>, change keyboard bindings
|
- <a href="builtins.html#bind">bind</a>, change keyboard bindings
|
||||||
- <a href="builtins.html#break">break</a>, stop the execution of a loop
|
- <a href="builtins.html#break">break</a>, stop the execution of a loop
|
||||||
|
- <a href="builtins.html#block">block</a>, Temporarily block delivery of events
|
||||||
- <a href="builtins.html#builtin">builtin</a>, execute a builtin command
|
- <a href="builtins.html#builtin">builtin</a>, execute a builtin command
|
||||||
- <a href="builtins.html#case">case</a>, conditionally execute a block of commands
|
- <a href="builtins.html#case">case</a>, conditionally execute a block of commands
|
||||||
- <a href="builtins.html#cd">cd</a>, change the current directory
|
- <a href="builtins.html#cd">cd</a>, change the current directory
|
||||||
@@ -625,6 +733,7 @@ builtins or shellscript functions, and can only be used inside fish.
|
|||||||
- <a href="commands.html#mimedb">mimedb</a>, view mimedata about a file
|
- <a href="commands.html#mimedb">mimedb</a>, view mimedata about a file
|
||||||
- <a href="commands.html#nextd">nextd</a>, move forward in the directory history
|
- <a href="commands.html#nextd">nextd</a>, move forward in the directory history
|
||||||
- <a href="builtins.html#not">not</a>, negates the exit status of any command
|
- <a href="builtins.html#not">not</a>, negates the exit status of any command
|
||||||
|
- <a href="builtins.html#or">or</a>, execute a command if previous command failed
|
||||||
- <a href="commands.html#popd">popd</a>, move to the topmost directory on the directory stack
|
- <a href="commands.html#popd">popd</a>, move to the topmost directory on the directory stack
|
||||||
- <a href="commands.html#prevd">prevd</a>, move backwards in the direcotry stack
|
- <a href="commands.html#prevd">prevd</a>, move backwards in the direcotry stack
|
||||||
- <a href="commands.html#pushd">pushd</a>, push the surrent directory onto the directory stack
|
- <a href="commands.html#pushd">pushd</a>, push the surrent directory onto the directory stack
|
||||||
@@ -636,7 +745,7 @@ builtins or shellscript functions, and can only be used inside fish.
|
|||||||
- <a href="builtins.html#switch">switch</a>, conditionally execute a block of commands
|
- <a href="builtins.html#switch">switch</a>, conditionally execute a block of commands
|
||||||
- <a href="commands.html#tokenize">tokenize</a>, split a string up into multiple tokens
|
- <a href="commands.html#tokenize">tokenize</a>, split a string up into multiple tokens
|
||||||
- <a href="builtins.html#ulimit">ulimit</a>, set or get the shells resurce usage limits
|
- <a href="builtins.html#ulimit">ulimit</a>, set or get the shells resurce usage limits
|
||||||
- <a href="commandss.html#umask">umask</a>, set or get the file creation mask
|
- <a href="commands.html#umask">umask</a>, set or get the file creation mask
|
||||||
- <a href="builtins.html#while">while</a>, perform a block of commands while a condition is met
|
- <a href="builtins.html#while">while</a>, perform a block of commands while a condition is met
|
||||||
|
|
||||||
For more information about these commands, use the <tt>--help</tt>
|
For more information about these commands, use the <tt>--help</tt>
|
||||||
@@ -654,24 +763,26 @@ Here are some of the commands available in the editor:
|
|||||||
- End or Ctrl-e moves to the end of line
|
- End or Ctrl-e moves to the end of line
|
||||||
- Left and right moves one character left or right
|
- Left and right moves one character left or right
|
||||||
- Alt-left and Alt-right moves one word left or right, or moves forward/backward in the directory history if the commandline is empty
|
- Alt-left and Alt-right moves one word left or right, or moves forward/backward in the directory history if the commandline is empty
|
||||||
|
- Up and down search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the <a href='#history'>history </a>section for more information on history searching.
|
||||||
|
- Alt-up and Alt-down search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the <a href='#history'>history </a>section for more information on history searching.
|
||||||
- Delete and backspace removes one character forwards or backwards
|
- Delete and backspace removes one character forwards or backwards
|
||||||
- Ctrl-c delete entire line
|
- Ctrl-c delete entire line
|
||||||
- Ctrl-d delete one character to the right of the cursor, unless the buffer is empty, in which case the shell will exit
|
- Ctrl-d delete one character to the right of the cursor, unless the buffer is empty, in which case the shell will exit
|
||||||
- Ctrl-k move contents from cursor to end of line to <a href="#killring">killring</a>
|
- Ctrl-k move contents from the cursor to the end of line to the <a href="#killring">killring</a>
|
||||||
- Ctrl-u move contents from beginning of line to cursor <a href="#killring">killring</a>
|
- Ctrl-u move contents from the beginning of line to the cursor to the <a href="#killring">killring</a>
|
||||||
- Ctrl-l clear and repaint screen
|
- Ctrl-l clear and repaint screen
|
||||||
- Ctrl-w move previous word to <a href="#killring">killring</a>
|
- Ctrl-w move previous word to the <a href="#killring">killring</a>
|
||||||
- Alt-d move next word to <a href="#killring">killring</a>
|
- Alt-d move next word to the <a href="#killring">killring</a>
|
||||||
- Alt-w prints a short description of the command under the cursor
|
- Alt-w prints a short description of the command under the cursor
|
||||||
- Alt-l lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed
|
- Alt-l lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed
|
||||||
- Alt-k prints a list of all key bindings
|
- Alt-p adds the string '| less;' to the end of the job under the cursor. The result is that the output of the command will be paged.
|
||||||
|
|
||||||
You can change these key bindings by making an inputrc file. To do
|
You can change these key bindings by making an inputrc file. To do
|
||||||
this, copy the file /etc/fish_inputrc to your home directory and
|
this, copy the file /etc/fish_inputrc to your home directory and
|
||||||
rename it to '.fish_inputrc'. Now you can edit the file .fish_inputrc,
|
rename it to '.fish_inputrc'. Now you can edit the file .fish_inputrc,
|
||||||
to change your key bindings. The fileformat of this file is described
|
to change your key bindings. The fileformat of this file is described
|
||||||
in the manual page for readline. Use the command <tt>man readline</tt>
|
in the manual page for readline. Use the command <tt>man readline</tt>
|
||||||
to read up on this syntax. Please note thet the list of key binding
|
to read up on this syntax. Please note that the list of key binding
|
||||||
functions in fish is different to that offered by readline. Currently,
|
functions in fish is different to that offered by readline. Currently,
|
||||||
the following functions are available:
|
the following functions are available:
|
||||||
|
|
||||||
@@ -700,7 +811,11 @@ the following functions are available:
|
|||||||
- \c yank, insert the latest entry of the killring into the buffer
|
- \c yank, insert the latest entry of the killring into the buffer
|
||||||
- \c yank-pop, rotate to the previous entry of the killring
|
- \c yank-pop, rotate to the previous entry of the killring
|
||||||
|
|
||||||
|
You can also bind a pice of shellscript to a key using the same
|
||||||
|
syntax. For example, the Alt-p functionality described above is
|
||||||
|
implemented using the following keybinding.
|
||||||
|
|
||||||
|
<pre>"\M-p": if commandline -j|grep -v 'less *$' >/dev/null; commandline -aj "|less;"; end</pre>
|
||||||
|
|
||||||
\subsection killring Copy and paste (Kill Ring)
|
\subsection killring Copy and paste (Kill Ring)
|
||||||
|
|
||||||
@@ -721,24 +836,34 @@ After a command has been entered, it is inserted at the end of a
|
|||||||
history list. Any duplicate history items are automatically
|
history list. Any duplicate history items are automatically
|
||||||
removed. By pressing the up and down keys, the user can search
|
removed. By pressing the up and down keys, the user can search
|
||||||
forwards and backwards in the history. If the current command line is
|
forwards and backwards in the history. If the current command line is
|
||||||
not empty when starting a history search, only the commands starting
|
not empty when starting a history search, only the commands containing
|
||||||
with the string entered into the command line are searched.
|
the string entered into the command line are shown.
|
||||||
|
|
||||||
|
By pressing Alt-up and Alt-down, a history search is also performed,
|
||||||
|
but instead of searching for a complete commandline, each commandline
|
||||||
|
is tokenized into separate elements just like it would be before
|
||||||
|
execution, and each such token is matched agains the token under the
|
||||||
|
cursor when the search began.
|
||||||
|
|
||||||
|
History searches can be aborted by pressing the escape key.
|
||||||
|
|
||||||
The history is stored in the file '.fish_history'. It is automatically
|
The history is stored in the file '.fish_history'. It is automatically
|
||||||
read on startup and merged on program exit.
|
read on startup and merged on program exit.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
To search for previous entries starting with the letter 'l', type 'l'
|
To search for previous entries containing the word 'make', type 'make'
|
||||||
in the console and press the up key.
|
in the console and press the up key.
|
||||||
|
|
||||||
\section job-control Running multiple programs
|
\section job-control Running multiple programs
|
||||||
|
|
||||||
Normally when \c fish starts a program, this program will be put
|
Normally when \c fish starts a program, this program will be put in
|
||||||
in the foreground, meaning it will take control of the terminal and
|
the foreground, meaning it will take control of the terminal and \c
|
||||||
\c fish will be stopped until the program finishes. Sometimes
|
fish will be stopped until the program finishes. Sometimes this is not
|
||||||
this is not desirable. In such cases, there are several ways in which
|
desirable. For example, you may wish to start an application with a
|
||||||
the user can change <tt>fish</tt>'s behaviour.
|
graphical user interface from the terminal, and then be able to
|
||||||
|
continue using the shell. In such cases, there are several ways in
|
||||||
|
which the user can change <tt>fish</tt>'s behaviour.
|
||||||
|
|
||||||
-# By ending a command with the \& (ampersand) symbol, the user tells \c fish to put the specified command into the background. A background process will be run simultaneous with \c fish. \c fish will retain control of the terminal, so the program will not be able to read from the keyboard.
|
-# By ending a command with the \& (ampersand) symbol, the user tells \c fish to put the specified command into the background. A background process will be run simultaneous with \c fish. \c fish will retain control of the terminal, so the program will not be able to read from the keyboard.
|
||||||
-# By pressing ^Z, the user stops a currently running foreground program and returns control to \c fish. Some programs do not support this feature, or remap it to another key. Gnu emacs uses ^X z to stop running.
|
-# By pressing ^Z, the user stops a currently running foreground program and returns control to \c fish. Some programs do not support this feature, or remap it to another key. Gnu emacs uses ^X z to stop running.
|
||||||
@@ -746,14 +871,29 @@ the user can change <tt>fish</tt>'s behaviour.
|
|||||||
|
|
||||||
\section initialization Initialization files
|
\section initialization Initialization files
|
||||||
|
|
||||||
On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you installed fish in your home directory) and ~/.fish, in that
|
On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you
|
||||||
order. If you want to run a command only on starting an interactive
|
installed fish in your home directory) and ~/.fish, in that order. If
|
||||||
shell, use the output of the 'status --is-interactive' command. If
|
you want to run a command only on starting an interactive shell, use
|
||||||
you want to run a command only on starting a login shell, use 'status --is-login' instead.
|
the exit status of the command 'status --is-interactive' to determine
|
||||||
|
if the shell is interactive. If you want to run a command only on
|
||||||
|
starting a login shell, use 'status --is-login' instead.
|
||||||
|
|
||||||
If you want to run a set of commands when \c fish exits, redefine the
|
Example:
|
||||||
<a href="#hooks">function hook</a> \c fish_on_exit. If the \c
|
|
||||||
fish_on_exit is defined, it will be execute before the shell exits.
|
If you want to add the directory ~/linux/bin to your PATH variable
|
||||||
|
when loging in, add the following to your ~/.fish file:
|
||||||
|
|
||||||
|
<pre>if status --is-login
|
||||||
|
set PATH $PATH ~/linux/bin
|
||||||
|
end</pre>
|
||||||
|
|
||||||
|
If you want to run a set of commands when \c fish exits, use an <a
|
||||||
|
href='#event'>event handler</a> that is triggered by the exit of the
|
||||||
|
shell:
|
||||||
|
|
||||||
|
<pre>function on_exit --on-process %self
|
||||||
|
echo fish is now exiting
|
||||||
|
end</pre>
|
||||||
|
|
||||||
<a href="#variables-universal">Universal variables</a> are stored in
|
<a href="#variables-universal">Universal variables</a> are stored in
|
||||||
the file .fishd.HOSTNAME, where HOSTNAME is the name of your
|
the file .fishd.HOSTNAME, where HOSTNAME is the name of your
|
||||||
@@ -772,7 +912,7 @@ marked red.
|
|||||||
Detected errors include:
|
Detected errors include:
|
||||||
|
|
||||||
- Non existing commands.
|
- Non existing commands.
|
||||||
- Reading or appending from non existing files.
|
- Reading from or appending to a non existing file.
|
||||||
- Incorrect use of output redirects
|
- Incorrect use of output redirects
|
||||||
- Mismatched parenthesis
|
- Mismatched parenthesis
|
||||||
|
|
||||||
@@ -789,7 +929,7 @@ fish_pager_color_description and \c fish_pager_color_progress. Valid
|
|||||||
values are \c black, \c red, \c green, \c brown, \c yellow, \c blue,
|
values are \c black, \c red, \c green, \c brown, \c yellow, \c blue,
|
||||||
\c magenta, \c purple, \c cyan, \c white or \c normal. Setting one of
|
\c magenta, \c purple, \c cyan, \c white or \c normal. Setting one of
|
||||||
the above variables to normal will mean that the text color will be
|
the above variables to normal will mean that the text color will be
|
||||||
set to the default color for the terminal.
|
set to the default foreground color for the terminal.
|
||||||
|
|
||||||
\subsection prompt Programmable prompt
|
\subsection prompt Programmable prompt
|
||||||
|
|
||||||
@@ -804,17 +944,14 @@ The default \c fish prompt is
|
|||||||
<p>
|
<p>
|
||||||
<pre>
|
<pre>
|
||||||
function fish_prompt -d "Write out the prompt"
|
function fish_prompt -d "Write out the prompt"
|
||||||
printf '\%s\@\%s\%s\\n\%s\%s\\n> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
|
printf '\%s\@\%s\%s\%s\%s> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||||
end
|
end
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
where \c prompt_pwd is a shellscript function that displays a condensed version of the current working direcotry.
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
If you are using \c set_color or other commands that output escape
|
|
||||||
codes to change the font settings of the terminal, you must always and
|
|
||||||
every such sequence with a newline. This is needed since fish needs to
|
|
||||||
know that exact length of the prompt in order to tetect when the
|
|
||||||
cursor reaches the end of the line. Any newlines in the output of the
|
|
||||||
\c fish_prompt command are ignored.
|
|
||||||
|
|
||||||
\subsection title Programmable title
|
\subsection title Programmable title
|
||||||
|
|
||||||
@@ -835,15 +972,28 @@ end
|
|||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
\subsection hooks Event hooks
|
\subsection event Event handlers
|
||||||
|
|
||||||
There are several special function names in fish. If a function is
|
When defining a new function in fish, it is possible to make it into an
|
||||||
given this name, it will be automatically called when a specific event
|
event handler, i.e. a function that is automatically run when a
|
||||||
has occured. These functions are:
|
specific event takes place. Events that can trigger a handler currently are:
|
||||||
|
|
||||||
- \c fish_on_exit, which is called before the shell exits
|
* When a signal is delivered
|
||||||
- \c fish_on_exec, which is called before interactively executing a command
|
* When a process or job exits
|
||||||
- \c fish_on_return, which is called when control returns to the shell after interactively executing a command
|
* When the value of a variable is updated
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
To specify a signal handler for the WINCH signal, write:
|
||||||
|
|
||||||
|
<pre>function --on-signal WINCH my_signal_handler
|
||||||
|
echo Got WINCH signal!
|
||||||
|
end
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
For more information on how to define new event handlers, see the
|
||||||
|
documentation for the <a href='builtins.html#function'>function</a>
|
||||||
|
command.
|
||||||
|
|
||||||
\section issues Common issues with fish
|
\section issues Common issues with fish
|
||||||
|
|
||||||
@@ -853,16 +1003,75 @@ it's initalization files to function properly. To solve this
|
|||||||
problem, either copy the initialization files to each fish users home
|
problem, either copy the initialization files to each fish users home
|
||||||
directory, or install them in /etc.
|
directory, or install them in /etc.
|
||||||
|
|
||||||
|
\section i18n Translating fish to other languages
|
||||||
|
|
||||||
|
Fish uses the GNU gettext library to implement translation to multiple
|
||||||
|
languages. If fish is not available in your language, please consider
|
||||||
|
making a translation. Currently, only the shell itself can be
|
||||||
|
translated, a future version of fish should also include translated
|
||||||
|
manuals.
|
||||||
|
|
||||||
|
To make a translation of fish, you will first need the sourcecode,
|
||||||
|
available from the <a href='http://roo.no-ip.org/fish'>fish
|
||||||
|
homepage</a>. Download the latest version, and then extract it using a
|
||||||
|
command like <code>tar -zxf fish-VERSION.tar.gz</code>.
|
||||||
|
|
||||||
|
Next, cd into the newly created fish directory using <code>cd
|
||||||
|
fish-VERSION</code>.
|
||||||
|
|
||||||
|
You will now need to configure the sourcecode using the command
|
||||||
|
<code>./configure</code>. This step might take a while.
|
||||||
|
|
||||||
|
Before you continue, you will need to know the ISO 639 language code
|
||||||
|
of the language you are translating to. These codes can be found <a
|
||||||
|
href='http://www.w3.org/WAI/ER/IG/ert/iso639.htm'>here</a>. For
|
||||||
|
example, the language code for Uighur is ug.
|
||||||
|
|
||||||
|
Now you have the sourcecode and it is properly configured. Lets start
|
||||||
|
translating. To do this, first create an empty translation table for
|
||||||
|
the language you wish to translate to by writing <code>make
|
||||||
|
po/[LANGUAGE CODE].po</code> in the fish terminal. For example, if you
|
||||||
|
are translating to Uighur, you should write <code>make
|
||||||
|
po/ug.po</code>. This should create the file po/ug.po, a template
|
||||||
|
translation table containing all the strings that need to be
|
||||||
|
translated.
|
||||||
|
|
||||||
|
Now you are all set up to translate fish to a new language. Open the
|
||||||
|
newly created .po file in your editor of choice, and start
|
||||||
|
translating. The .po file format is rather simple. It contains pairs
|
||||||
|
of string in a format like:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
msgid "%ls: No suitable job\n"
|
||||||
|
msgstr ""
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
The first line is the english string to translate, the second line
|
||||||
|
should contain your translation. For example, in swedish the above
|
||||||
|
might become:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
msgid "%ls: No suitable job\n"
|
||||||
|
msgstr "%ls: Inget jobb matchar\n"
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
%s, %ls, %d and other tokens beginning with a '%' are
|
||||||
|
placeholders. These will be replaced by a value by fish at
|
||||||
|
runtime. You must always take care to use exactly the same
|
||||||
|
placeholders in the same order in your translation. (Actually, there
|
||||||
|
are ways to avoid this, but they are to complicated for this short
|
||||||
|
introduction. See the full manual for the printf C function for more
|
||||||
|
information.)
|
||||||
|
|
||||||
|
Once you have provided a translation for fish, please send it to <a
|
||||||
|
href='fish-users@lists.sf.net'>fish-users@lists.sf.net</a>.
|
||||||
|
|
||||||
\section todo Missing features and bugs
|
\section todo Missing features and bugs
|
||||||
|
|
||||||
\subsection todo-features Missing features
|
\subsection todo-features Missing features
|
||||||
|
|
||||||
- Complete vi-mode key bindings
|
- Complete vi-mode key bindings
|
||||||
- '**' wildcard for recursive wildcard matching
|
|
||||||
- next-history-complete
|
- next-history-complete
|
||||||
- umask shellscript function
|
|
||||||
- builtin wait command
|
- builtin wait command
|
||||||
- More completions (for example xterm, vim,
|
- More completions (for example xterm, vim,
|
||||||
konsole, gnome-terminal, dcop, cdrecord, cron, xargs
|
konsole, gnome-terminal, dcop, cdrecord, cron, xargs
|
||||||
@@ -871,11 +1080,10 @@ bibtex, patch, aspell, xpdf,
|
|||||||
zip, compress, wine, xmms, dig, wine, batch, cron,
|
zip, compress, wine, xmms, dig, wine, batch, cron,
|
||||||
g++, javac, java, gcj, lpr, doxygen, whois, find)
|
g++, javac, java, gcj, lpr, doxygen, whois, find)
|
||||||
- Undo support
|
- Undo support
|
||||||
- Multiple input characters should be inserted in one batch whenever possible, to avoid flickering
|
|
||||||
- Check keybinding commands for output - if non has happened, don't repaint to reduce flicker
|
- Check keybinding commands for output - if non has happened, don't repaint to reduce flicker
|
||||||
- the jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job
|
- The jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job
|
||||||
- Syntax highlighting should mark cd to non-existing directories as an error
|
- Syntax highlighting should mark cd to non-existing directories as an error
|
||||||
|
- wait shellscript
|
||||||
|
|
||||||
\subsection todo-possible Possible features
|
\subsection todo-possible Possible features
|
||||||
|
|
||||||
@@ -897,20 +1105,22 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
|
|||||||
- show the whole list of commands on using tab on an empty commandline
|
- show the whole list of commands on using tab on an empty commandline
|
||||||
- Automatically move cursor to the end of the current token before completing
|
- Automatically move cursor to the end of the current token before completing
|
||||||
- Map variables. (export only the values. When expanding with no key specified, expand to all values.)
|
- Map variables. (export only the values. When expanding with no key specified, expand to all values.)
|
||||||
|
- Descriptions for variables using 'set -d'.
|
||||||
|
- Parse errors should when possible honor IO redirections
|
||||||
|
|
||||||
\subsection bugs Known bugs
|
\subsection bugs Known bugs
|
||||||
|
|
||||||
- Completion for gcc -\#\#\# option doesn't work.
|
- Completion for gcc -\#\#\# option doesn't work.
|
||||||
- Many completions are made specifically for the GNU
|
- Many completions are made specifically for the GNU version of a POSIX command
|
||||||
version of a POSIX command
|
|
||||||
- Yanking weird characters from clipboard prints Unicode escapes
|
- Yanking weird characters from clipboard prints Unicode escapes
|
||||||
- Prefix string in completion display is sometimes incorrect
|
- Suspending and then resuming pipelines containing a builtin seems to be broken.
|
||||||
|
- Interactive input seems broken inside blocks. Is local echo and other terminal values not restored when in an interactive block?
|
||||||
|
|
||||||
If you think you have found a bug not described here, please send a
|
If you think you have found a bug not described here, please send a
|
||||||
report to <a href="mailto:axel@liljencrantz.se"> axel@liljencrantz.se
|
report to <a href="mailto:axel@liljencrantz.se"> axel@liljencrantz.se
|
||||||
</a>.
|
</a>.
|
||||||
|
|
||||||
\subsection Known issues
|
\subsection issues Known issues
|
||||||
|
|
||||||
Older versions of Doxygen has bugs in the man-page generation which
|
Older versions of Doxygen has bugs in the man-page generation which
|
||||||
cause the builtin help to render incorrectly. Version 1.2.14 is known
|
cause the builtin help to render incorrectly. Version 1.2.14 is known
|
||||||
@@ -942,6 +1152,10 @@ Most tradeoffs between power and ease of use can be avoided with careful design.
|
|||||||
-# Whenever possible without breaking the above goals, fish should
|
-# Whenever possible without breaking the above goals, fish should
|
||||||
follow the Posix syntax.
|
follow the Posix syntax.
|
||||||
|
|
||||||
|
To achive these high-level goals, the fish design relies on a number
|
||||||
|
of more specific design principles. These are presented below,
|
||||||
|
together with a rationale and a few examples for each.
|
||||||
|
|
||||||
\subsection ortho The law of orthogonality
|
\subsection ortho The law of orthogonality
|
||||||
|
|
||||||
The shell language should have a small set of orthogonal features. Any
|
The shell language should have a small set of orthogonal features. Any
|
||||||
@@ -958,7 +1172,10 @@ program harder to maintain and update.
|
|||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Here documents are too similar to using echo inside of a pipeline.
|
- Here documents are too similar to using echo inside of a pipeline.
|
||||||
- The different quoting styles are silly. ("", '' and \$'')
|
- Subshells, command substitution and process substitution are strongly related. \c fish only supports command substitution, the others can be achived either using a block or the psub shellscript function.
|
||||||
|
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. \c fish sunctions have none of the drawbacks of either syntax.
|
||||||
|
- The many Posix quoting styles are silly, especially \$''.
|
||||||
|
|
||||||
|
|
||||||
\subsection sep The law of minimalism
|
\subsection sep The law of minimalism
|
||||||
|
|
||||||
@@ -990,9 +1207,8 @@ and many other funtions can easily be done in external programs. They
|
|||||||
should not be supported internally by the shell.
|
should not be supported internally by the shell.
|
||||||
|
|
||||||
The law of minimalism does not imply that a large feature set is
|
The law of minimalism does not imply that a large feature set is
|
||||||
bad. So long as a feature is not part of the language itself, but a
|
bad. So long as a feature is not part of the shell itself, but a
|
||||||
separate command or at least a shellscript function, bloat is much
|
separate command or at least a shellscript function, bloat is fine.
|
||||||
more acceptable.
|
|
||||||
|
|
||||||
\subsection conf Configurability is the root of all evil
|
\subsection conf Configurability is the root of all evil
|
||||||
|
|
||||||
@@ -1015,7 +1231,7 @@ enough approximation of it.
|
|||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
- Fish allows the user to set various syntax highlighting colors. This is needed because fish does not know what colors the terminal uses by default, which might make some things unreadable. The proper solution would be for text color preferences to be defined centrally by the user for all programs, and for the terminal emulator to send these color properties to fish.
|
||||||
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common cshell configuration options
|
- Fish does not allow you to set the history filename, the number of history entries, different language substyles or any number of other common shell configuration options.
|
||||||
|
|
||||||
A special note on the evils of configurability is the long list of
|
A special note on the evils of configurability is the long list of
|
||||||
very useful features found in some shells, that are not turned on by
|
very useful features found in some shells, that are not turned on by
|
||||||
@@ -1033,13 +1249,18 @@ considered once a user interface has been designed.
|
|||||||
|
|
||||||
Rationale:
|
Rationale:
|
||||||
|
|
||||||
If too much attention is given to what is easy to implement the law of
|
This design rule is different than the others, since it describes how
|
||||||
orthogonality and the law of minimalism will by necessity be disobeyed.
|
one should go about designing new features, not what the features
|
||||||
|
should be. The problem with focusing on what can be done, and what is
|
||||||
|
easy to do, is that to much of the implementation is exposed. This
|
||||||
|
means that the user must know a great deal about the underlying system
|
||||||
|
to be able to guess how the shell works, it also means that the
|
||||||
|
language will often be rather low-level.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
|
||||||
- The differences between builtin commands, shellscript functions and builtin commands should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expantion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
|
- The differences between builtin commands, shellscript functions and builtin commands should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
|
||||||
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping
|
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping
|
||||||
- All blocks end with the \c end builtin
|
- All blocks end with the \c end builtin
|
||||||
|
|
||||||
@@ -1074,7 +1295,6 @@ Examples:
|
|||||||
/** \page about About fish
|
/** \page about About fish
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\section about-program About the program
|
\section about-program About the program
|
||||||
|
|
||||||
\c fish is meant to be used for interactive shell tasks on a modern
|
\c fish is meant to be used for interactive shell tasks on a modern
|
||||||
@@ -1255,17 +1475,6 @@ builtin. The are very few builtins, \c fish relies on normal commands
|
|||||||
like <tt>echo</tt>, <tt>kill</tt>, <tt>printf</tt> and <tt>time</tt>
|
like <tt>echo</tt>, <tt>kill</tt>, <tt>printf</tt> and <tt>time</tt>
|
||||||
instead of reimplementing them as builtins.
|
instead of reimplementing them as builtins.
|
||||||
|
|
||||||
The globbing in fish is significantly simplified. Since I can never
|
|
||||||
remember all the subtle differences between single and double quotes,
|
|
||||||
which kind of tick is used for command substitution and all the other
|
|
||||||
strange quirks of of the Posix shell language, that aspect of shells
|
|
||||||
has been significantly simplified. This makes \c fish unsuitable for
|
|
||||||
strange shell scripting, but much more suited to interactive needs
|
|
||||||
than regular shells.
|
|
||||||
|
|
||||||
There is no difference between double and single quotes. They both
|
|
||||||
turn of all globbing and escape sequences. They can be nested.
|
|
||||||
|
|
||||||
Token separation is performed before variable expansion. This means
|
Token separation is performed before variable expansion. This means
|
||||||
that even if a variable contains spaces, it will never be separated
|
that even if a variable contains spaces, it will never be separated
|
||||||
into multiple arguments. If you want to tokenize a string, you can use
|
into multiple arguments. If you want to tokenize a string, you can use
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
\section jobs jobs - print currently running jobs
|
\section jobs jobs - print currently running jobs
|
||||||
|
|
||||||
\subsection jobs-synopsis
|
\subsection jobs-synopsis
|
||||||
<tt>jobs</tt>
|
<tt>jobs [OPTIONS] [PID]</tt>
|
||||||
|
|
||||||
\subsection jobs-description Description
|
\subsection jobs-description Description
|
||||||
The <tt>jobs</tt> builtin causes fish to print a list of the currently
|
The <tt>jobs</tt> builtin causes fish to print a list of the currently
|
||||||
running jobs and their status.
|
running jobs and their status.
|
||||||
|
|
||||||
On systems that supports this feature, jobs will also print the CPU
|
jobs accepts the following switches:
|
||||||
usage of each job since the last command was executed. The CPU usage
|
|
||||||
is expressed as a percentage of full CPU activity. Note that on
|
- <tt>-c</tt> or <tt>--command</tt> print the command name for each process in jobs
|
||||||
|
- <tt>-g</tt> or <tt>--group</tt> only print the group id of each job
|
||||||
|
- <tt>-l</tt> or <tt>--last</tt> only the last job to be started is printed
|
||||||
|
- <tt>-p</tt> or <tt>--process</tt> print the procces id for each process in all jobs
|
||||||
|
|
||||||
|
On systems that supports this feature, jobs will print the CPU usage
|
||||||
|
of each job since the last command was executed. The CPU usage is
|
||||||
|
expressed as a percentage of full CPU activity. Note that on
|
||||||
multiprocessor systems, the total activity may be more than 100\%.
|
multiprocessor systems, the total activity may be more than 100\%.
|
||||||
|
|||||||
@@ -2,22 +2,16 @@
|
|||||||
\section or or - Conditionally execute a command
|
\section or or - Conditionally execute a command
|
||||||
|
|
||||||
\subsection or-synopsis Synopsis
|
\subsection or-synopsis Synopsis
|
||||||
<tt>or COMMAND1; COMMAND2</tt>
|
<tt>COMMAND1; or COMMAND2</tt>
|
||||||
|
|
||||||
\subsection or-description Description
|
\subsection or-description Description
|
||||||
|
|
||||||
The \c or builtin is used to execute one command, and if it returns
|
The \c or builtin is used to execute a command if the current exit status (as set by the last previous command) is non-zero
|
||||||
non-zero status, also execute a second command.
|
|
||||||
|
|
||||||
\subsection or-example Example
|
\subsection or-example Example
|
||||||
|
|
||||||
The following code runs the \c make command to build a program, or if it fails, it runs <tt>make clean</tt>, which removes the files created by the build process
|
The following code runs the \c make command to build a program, or if it fails, it runs <tt>make clean</tt>, which removes the files created by the build process
|
||||||
<pre>
|
<pre>
|
||||||
or make; make clean
|
make; or make clean
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
\c or and \c and can be nested, as in this example, that attempts to build and install a program, and removed the files created by the build process on failiure
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
or and make; make install; make clean
|
|
||||||
</pre>
|
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
\section set set - Handle environment variables.
|
\section set set - Handle environment variables.
|
||||||
|
|
||||||
\subsection set-synopsis Synopsis
|
\subsection set-synopsis Synopsis
|
||||||
<tt>set [OPTIONS] VARIABLE_NAME [VALUES...]</tt>
|
<code>set [OPTIONS] [VARIABLE_NAME [VALUES...]]</code>
|
||||||
|
|
||||||
The <tt>set</tt> builtin causes fish to assign the variable <tt>VARIABLE_NAME</tt> the values <tt>VALUES...</tt>.
|
The <code>set</code> builtin causes fish to assign the variable <code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
|
||||||
|
|
||||||
\subsection set-description Description
|
\subsection set-description Description
|
||||||
- <tt>-e</tt> or <tt>--erase</tt> causes the specified environment variable to be erased
|
- <code>-e</code> or <code>--erase</code> causes the specified environment variable to be erased
|
||||||
- <tt>-g</tt> or <tt>--global</tt> causes the specified environment variable to be made global. If this option is not supplied, the specified variable will dissapear when the current block ends
|
- <code>-g</code> or <code>--global</code> causes the specified environment variable to be made global. If this option is not supplied, the specified variable will dissapear when the current block ends
|
||||||
- <tt>-l</tt> or <tt>--local</tt> forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
|
- <code>-l</code> or <code>--local</code> forces the specified environment variable to be made local to the current block, even if the variable already exists and is non-local
|
||||||
- <tt>-n</tt> or <tt>--names</tt> List only the names of all defined variables
|
- <code>-n</code> or <code>--names</code> List only the names of all defined variables
|
||||||
- <tt>-q</tt> or <tt>--query</tt> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
|
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
|
||||||
- <tt>-u</tt> or <tt>--unexport</tt> causes the specified environment not to be exported to child processes
|
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
|
||||||
- <tt>-U</tt> or <tt>--universal</tt> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
|
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
|
||||||
- <tt>-x</tt> or <tt>--export</tt> causes the specified environment variable to be exported to child processes
|
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
|
||||||
|
|
||||||
If set is called with no arguments, the names and values of all
|
If set is called with no arguments, the names and values of all
|
||||||
environment variables are printed.
|
environment variables are printed. If some of the scope or export
|
||||||
|
flags have been given, only the variables matching the specified scope
|
||||||
If set is called with only one argument, the scope of the variable
|
are printed.
|
||||||
with the given name will be changed as specified, but it's value will
|
|
||||||
remain the same. If the variable did not previously exist, it's value
|
|
||||||
will be an empty string.
|
|
||||||
|
|
||||||
If the \c -e or \c --erase option is specified, the variable
|
If the \c -e or \c --erase option is specified, the variable
|
||||||
specified by the following arguments will be erased
|
specified by the following arguments will be erased
|
||||||
|
|
||||||
If a variable is set to more than one value, the variable will be an
|
If a variable is set to more than one value, the variable will be an
|
||||||
array with the specified elements.
|
array with the specified elements. If a variable is set to zero
|
||||||
|
elements, it will become an array with zero elements.
|
||||||
|
|
||||||
If the variable name is one or more array elements, such as <tt>PATH[1
|
If the variable name is one or more array elements, such as <code>PATH[1
|
||||||
3 7]</tt>, only those array elements specified will be changed.
|
3 7]</code>, only those array elements specified will be changed.
|
||||||
|
|
||||||
\subsection set-example Example
|
\subsection set-example Example
|
||||||
|
|
||||||
<tt>set foo hi</tt> sets the value of the variable foo to be hi.
|
<code>set -xg</code> will print all global, exported variables.
|
||||||
|
|
||||||
<tt>set -e smurf</tt> removes the variable \c smurf.
|
<code>set foo hi</code> sets the value of the variable foo to be hi.
|
||||||
|
|
||||||
<tt>set PATH[4] ~/bin</tt> changes the fourth element of the \c PATH array to \c ~/bin
|
<code>set -e smurf</code> removes the variable \c smurf.
|
||||||
|
|
||||||
|
<code>set PATH[4] ~/bin</code> changes the fourth element of the \c PATH array to \c ~/bin
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
\section tokenize tokenize - tokenize a string
|
|
||||||
|
|
||||||
\subsection tokenize-synopsis Synopsis
|
|
||||||
<tt>tokenize [STRING...]</tt>
|
|
||||||
|
|
||||||
\subsection tokenize-description Description
|
|
||||||
- STRING is the string or list of strings to tokenize. Each token will be printed on a line by itself
|
|
||||||
- \c -e, \c --with-empty allow empty tokens
|
|
||||||
- \c -n, \c --no-empty ignore empty tokens (Default)
|
|
||||||
- <tt>-d DELIMITER</tt>, <tt>--delimiter=DELIMITER</tt> is the list of characters that will be used as delimiters. If unspecified, the IFS environment variable will be used as the delimiter string,
|
|
||||||
- \c -h, \c --help Display help message and exit
|
|
||||||
- \c -v, \c --version Display version and exit
|
|
||||||
|
|
||||||
37
doc_src/trap.txt
Normal file
37
doc_src/trap.txt
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
\section trap trap - perform an action when the shell recives a signal
|
||||||
|
|
||||||
|
\subsection trap-synopsis Synopsis
|
||||||
|
<tt>trap [OPTIONS] [[ARG] SIGSPEC ... ]</tt>
|
||||||
|
|
||||||
|
\subsection trap-description Description
|
||||||
|
|
||||||
|
Trap is a shellscript wrapper around the fish event delivery
|
||||||
|
framework. IT is defined for backwards compatibility reasons. For
|
||||||
|
other uses, it is recomended to define a <a
|
||||||
|
href='index.html#event'>event handler</a>.
|
||||||
|
|
||||||
|
- ARG is the command to be executed on signal delivary
|
||||||
|
- SIGSPEC is the name of the signal to trap
|
||||||
|
- \c -h or \c --help Display help and exit
|
||||||
|
- \c -l or \c --list-signals print a list of signal names
|
||||||
|
- \c -p or \c --print print all defined signal handlers
|
||||||
|
|
||||||
|
If ARG and SIGSPEC are both specified, ARG is the command to be
|
||||||
|
executed when the signal specified by SIGSPEC is delivered.
|
||||||
|
|
||||||
|
If ARG is absent (and there is a single SIGSPEC) or -, each specified
|
||||||
|
signal is reset to its original disposition (the value it had upon
|
||||||
|
entrance to the shell). If ARG is the null string the signal
|
||||||
|
specified by each SIGSPEC is ignored by the shell and by the commands
|
||||||
|
it invokes.
|
||||||
|
|
||||||
|
If ARG is not present and -p has been supplied, then the trap commands
|
||||||
|
associated with each SIGSPEC are displayed. If no arguments are
|
||||||
|
supplied or if only -p is given, trap prints the list of commands
|
||||||
|
associated with each signal.
|
||||||
|
|
||||||
|
Signal names are case insensitive and the SIG prefix is optional.
|
||||||
|
|
||||||
|
The return status is 1 if any SIGSPEC is invalid; otherwise trap
|
||||||
|
returns 0.
|
||||||
15
doc_src/vared.txt
Normal file
15
doc_src/vared.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
\section vared vared - Interactively edit the value of an environment variable
|
||||||
|
|
||||||
|
\subsection vared-synopsis Synopsis
|
||||||
|
<tt>vared VARIABLE_NAME</tt>
|
||||||
|
|
||||||
|
\subsection vared-description Description
|
||||||
|
|
||||||
|
vared is used to interactively edit the value of an environment
|
||||||
|
variable. Array variables as a whole can not be edited using vared,
|
||||||
|
but individual array elements can.
|
||||||
|
|
||||||
|
\subsection vared-example Example
|
||||||
|
|
||||||
|
<code>vared PATH[3]</code> edits the third element of the PATH array
|
||||||
246
env.c
246
env.c
@@ -41,11 +41,13 @@
|
|||||||
#include "env_universal.h"
|
#include "env_universal.h"
|
||||||
#include "input_common.h"
|
#include "input_common.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "translate.h"
|
||||||
|
#include "complete.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Command used to start fishd
|
Command used to start fishd
|
||||||
*/
|
*/
|
||||||
#define FISHD_CMD L"if which fishd >/dev/null; fishd ^/tmp/fish.%s.log; end"
|
#define FISHD_CMD L"if which fishd >/dev/null; fishd ^/tmp/fishd.%s.log; end"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Value denoting a null string
|
Value denoting a null string
|
||||||
@@ -190,7 +192,7 @@ static void start_fishd()
|
|||||||
|
|
||||||
if( !pw )
|
if( !pw )
|
||||||
{
|
{
|
||||||
debug( 0, L"Could not get user information" );
|
debug( 0, _( L"Could not get user information" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +215,87 @@ static mode_t get_umask()
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
List of all locale variable names
|
||||||
|
*/
|
||||||
|
static const wchar_t *locale_variable[] =
|
||||||
|
{
|
||||||
|
L"LANG", L"LC_ALL", L"LC_COLLATE", L"LC_CTYPE", L"LC_MESSAGES", L"LC_MONETARY", L"LC_NUMERIC", L"LC_TIME", (void *)0
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks if the specified variable is a locale variable
|
||||||
|
*/
|
||||||
|
static int is_locale( const wchar_t *key )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for( i=0; locale_variable[i]; i++ )
|
||||||
|
if( wcscmp(locale_variable[i], key ) == 0 )
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Properly sets all locale information
|
||||||
|
*/
|
||||||
|
static void handle_locale()
|
||||||
|
{
|
||||||
|
const wchar_t *lc_all = env_get( L"LC_ALL" );
|
||||||
|
const wchar_t *lang;
|
||||||
|
int i;
|
||||||
|
wchar_t *old = wcsdup(wsetlocale( LC_MESSAGES, (void *)0 ));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Array of locale constants corresponding to the local variable names defined in locale_variable
|
||||||
|
*/
|
||||||
|
static const int cat[] =
|
||||||
|
{
|
||||||
|
0, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
if( lc_all )
|
||||||
|
{
|
||||||
|
wsetlocale( LC_ALL, lc_all );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lang = env_get( L"LANG" );
|
||||||
|
if( lang )
|
||||||
|
{
|
||||||
|
wsetlocale( LC_ALL, lang );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i=2; locale_variable[i]; i++ )
|
||||||
|
{
|
||||||
|
const wchar_t *val = env_get( locale_variable[i] );
|
||||||
|
if( val )
|
||||||
|
wsetlocale( cat[i], val );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( wcscmp( wsetlocale( LC_MESSAGES, (void *)0 ), old ) != 0 )
|
||||||
|
{
|
||||||
|
/* Make change known to gettext. */
|
||||||
|
{
|
||||||
|
extern int _nl_msg_cat_cntr;
|
||||||
|
++_nl_msg_cat_cntr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( is_interactive )
|
||||||
|
{
|
||||||
|
complete_destroy();
|
||||||
|
complete_init();
|
||||||
|
|
||||||
|
debug( 0, _(L"Changing language to english") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free( old );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Universal variable callback function. This function makes sure the
|
Universal variable callback function. This function makes sure the
|
||||||
proper events are triggered when an event occurs.
|
proper events are triggered when an event occurs.
|
||||||
@@ -223,6 +306,9 @@ static void universal_callback( int type,
|
|||||||
{
|
{
|
||||||
wchar_t *str=0;
|
wchar_t *str=0;
|
||||||
|
|
||||||
|
if( is_locale( name ) )
|
||||||
|
handle_locale();
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case SET:
|
case SET:
|
||||||
@@ -236,7 +322,6 @@ static void universal_callback( int type,
|
|||||||
|
|
||||||
if( str )
|
if( str )
|
||||||
{
|
{
|
||||||
array_list_t arg;
|
|
||||||
event_t ev;
|
event_t ev;
|
||||||
|
|
||||||
has_changed=1;
|
has_changed=1;
|
||||||
@@ -245,12 +330,12 @@ static void universal_callback( int type,
|
|||||||
ev.param1.variable=name;
|
ev.param1.variable=name;
|
||||||
ev.function_name=0;
|
ev.function_name=0;
|
||||||
|
|
||||||
al_init( &arg );
|
al_init( &ev.arguments );
|
||||||
al_push( &arg, L"VARIABLE" );
|
al_push( &ev.arguments, L"VARIABLE" );
|
||||||
al_push( &arg, str );
|
al_push( &ev.arguments, str );
|
||||||
al_push( &arg, name );
|
al_push( &ev.arguments, name );
|
||||||
event_fire( &ev, &arg );
|
event_fire( &ev );
|
||||||
al_destroy( &arg );
|
al_destroy( &ev.arguments );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,43 +428,66 @@ void env_init()
|
|||||||
if( !path )
|
if( !path )
|
||||||
{
|
{
|
||||||
env_set( L"PATH", L"/bin" ARRAY_SEP_STR L"/usr/bin", ENV_EXPORT | ENV_GLOBAL );
|
env_set( L"PATH", L"/bin" ARRAY_SEP_STR L"/usr/bin", ENV_EXPORT | ENV_GLOBAL );
|
||||||
|
path = env_get( L"PATH" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
array_list_t l;
|
array_list_t l;
|
||||||
int has_bin=0, has_usr_bin=0;
|
|
||||||
|
|
||||||
al_init( &l );
|
al_init( &l );
|
||||||
expand_variable_array( path, &l );
|
expand_variable_array( path, &l );
|
||||||
|
|
||||||
|
debug( 3, L"PATH is %ls", path );
|
||||||
|
|
||||||
for( i=0; i<al_get_count( &l); i++ )
|
|
||||||
{
|
const wchar_t *path_el[] =
|
||||||
wchar_t * el = (wchar_t *)al_get( &l, i );
|
|
||||||
if( contains_str( el, L"/bin", L"/bin/", (void *)0) )
|
|
||||||
{
|
{
|
||||||
has_bin = 1;
|
L"/bin",
|
||||||
|
L"/usr/bin",
|
||||||
|
PREFIX L"/bin",
|
||||||
|
0
|
||||||
}
|
}
|
||||||
if( contains_str( el, L"/usr/bin", L"/usr/bin/", (void *)0) )
|
;
|
||||||
|
|
||||||
|
for( j=0; path_el[j]; j++ )
|
||||||
|
{
|
||||||
|
int has_el=0;
|
||||||
|
|
||||||
|
debug( 3, L"Check directory %ls", path_el[j] );
|
||||||
|
|
||||||
|
|
||||||
|
for( i=0; i<al_get_count( &l); i++ )
|
||||||
{
|
{
|
||||||
has_bin = 1;
|
wchar_t * el = (wchar_t *)al_get( &l, i );
|
||||||
|
size_t len = wcslen( el );
|
||||||
|
while( (len > 0) && (el[len-1]==L'/') )
|
||||||
|
len--;
|
||||||
|
if( (wcslen( path_el[j] ) == len) && (wcsncmp( el, path_el[j], len)==0) )
|
||||||
|
{
|
||||||
|
has_el = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !has_el )
|
||||||
|
{
|
||||||
|
string_buffer_t b;
|
||||||
|
debug( 3, L"directory %ls was missing", path_el[j] );
|
||||||
|
sb_init( &b );
|
||||||
|
sb_append2( &b, path,
|
||||||
|
ARRAY_SEP_STR,
|
||||||
|
path_el[j],
|
||||||
|
(void *)0 );
|
||||||
|
|
||||||
|
env_set( L"PATH", (wchar_t *)b.buff, ENV_GLOBAL | ENV_EXPORT );
|
||||||
|
sb_destroy( &b );
|
||||||
|
path = env_get( L"PATH" );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !( has_bin && has_usr_bin ) )
|
debug( 3, L"After: PATH is %ls", path );
|
||||||
{
|
|
||||||
string_buffer_t b;
|
|
||||||
sb_init( &b );
|
|
||||||
sb_append( &b, path );
|
|
||||||
if( !has_bin )
|
|
||||||
sb_append( &b, ARRAY_SEP_STR L"/bin" );
|
|
||||||
if( !has_usr_bin )
|
|
||||||
sb_append( &b, ARRAY_SEP_STR L"/usr/bin" );
|
|
||||||
|
|
||||||
env_set( L"PATH", (wchar_t *)b.buff, ENV_GLOBAL | ENV_EXPORT );
|
|
||||||
sb_destroy( &b );
|
|
||||||
}
|
|
||||||
|
|
||||||
al_foreach( &l, (void (*)(const void *))&free );
|
al_foreach( &l, (void (*)(const void *))&free );
|
||||||
al_destroy( &l );
|
al_destroy( &l );
|
||||||
|
|
||||||
@@ -395,7 +503,7 @@ void env_init()
|
|||||||
free( uname );
|
free( uname );
|
||||||
}
|
}
|
||||||
|
|
||||||
env_universal_init( env_get( L"FISHD_SOKET_DIR"),
|
env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
|
||||||
env_get( L"USER" ),
|
env_get( L"USER" ),
|
||||||
&start_fishd,
|
&start_fishd,
|
||||||
&universal_callback );
|
&universal_callback );
|
||||||
@@ -452,7 +560,7 @@ static env_node_t *env_get_node( const wchar_t *key )
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void env_set( const wchar_t *key,
|
void env_set( const wchar_t *key,
|
||||||
const wchar_t *val,
|
const wchar_t *val,
|
||||||
int var_mode )
|
int var_mode )
|
||||||
@@ -466,20 +574,14 @@ void env_set( const wchar_t *key,
|
|||||||
int done=0;
|
int done=0;
|
||||||
|
|
||||||
event_t ev;
|
event_t ev;
|
||||||
array_list_t ev_list;
|
|
||||||
int is_universal = 0;
|
int is_universal = 0;
|
||||||
|
|
||||||
if( (var_mode & ENV_USER ) &&
|
if( (var_mode & ENV_USER ) &&
|
||||||
hash_get( &env_read_only, key ) )
|
hash_get( &env_read_only, key ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( wcscmp(key, L"LANG" )==0 )
|
|
||||||
{
|
|
||||||
fish_setlocale(LC_ALL,val);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( wcscmp( key, L"umask" ) == 0)
|
if( wcscmp( key, L"umask" ) == 0)
|
||||||
{
|
{
|
||||||
wchar_t *end;
|
wchar_t *end;
|
||||||
@@ -503,7 +605,6 @@ void env_set( const wchar_t *key,
|
|||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Zero element arrays are internaly not coded as null but as this placeholder string
|
Zero element arrays are internaly not coded as null but as this placeholder string
|
||||||
@@ -569,8 +670,11 @@ void env_set( const wchar_t *key,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !proc_had_barrier)
|
if( !proc_had_barrier)
|
||||||
|
{
|
||||||
|
proc_had_barrier=1;
|
||||||
env_universal_barrier();
|
env_universal_barrier();
|
||||||
|
}
|
||||||
|
|
||||||
if( env_universal_get( key ) )
|
if( env_universal_get( key ) )
|
||||||
{
|
{
|
||||||
int export = 0;
|
int export = 0;
|
||||||
@@ -643,18 +747,26 @@ void env_set( const wchar_t *key,
|
|||||||
ev.param1.variable = key;
|
ev.param1.variable = key;
|
||||||
ev.function_name = 0;
|
ev.function_name = 0;
|
||||||
|
|
||||||
al_init( &ev_list );
|
al_init( &ev.arguments );
|
||||||
al_push( &ev_list, L"VARIABLE" );
|
al_push( &ev.arguments, L"VARIABLE" );
|
||||||
al_push( &ev_list, key );
|
al_push( &ev.arguments, key );
|
||||||
|
|
||||||
// debug( 1, L"env_set: fire events on variable %ls", key );
|
// debug( 1, L"env_set: fire events on variable %ls", key );
|
||||||
event_fire( &ev, &ev_list );
|
event_fire( &ev );
|
||||||
// debug( 1, L"env_set: return from event firing" );
|
// debug( 1, L"env_set: return from event firing" );
|
||||||
al_destroy( &ev_list );
|
al_destroy( &ev.arguments );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( is_locale( key ) )
|
||||||
|
{
|
||||||
|
handle_locale();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Attempt to remove/free the specified key/value pair from the
|
Attempt to remove/free the specified key/value pair from the
|
||||||
specified hash table.
|
specified hash table.
|
||||||
@@ -702,6 +814,10 @@ void env_remove( const wchar_t *key, int var_mode )
|
|||||||
{
|
{
|
||||||
env_universal_remove( key );
|
env_universal_remove( key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( is_locale( key ) )
|
||||||
|
handle_locale();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -730,7 +846,7 @@ wchar_t *env_get( const wchar_t *key )
|
|||||||
wchar_t *next = history_get( i-add_current );
|
wchar_t *next = history_get( i-add_current );
|
||||||
if( !next )
|
if( !next )
|
||||||
{
|
{
|
||||||
debug( 1, L"No history at idx %d\n", i );
|
debug( 1, _( L"No history item at index %d\n" ), i );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +901,11 @@ wchar_t *env_get( const wchar_t *key )
|
|||||||
env = env->next;
|
env = env->next;
|
||||||
}
|
}
|
||||||
if( !proc_had_barrier)
|
if( !proc_had_barrier)
|
||||||
|
{
|
||||||
|
proc_had_barrier=1;
|
||||||
env_universal_barrier();
|
env_universal_barrier();
|
||||||
|
}
|
||||||
|
|
||||||
item = env_universal_get( key );
|
item = env_universal_get( key );
|
||||||
|
|
||||||
if( !item || (wcscmp( item, ENV_NULL )==0))
|
if( !item || (wcscmp( item, ENV_NULL )==0))
|
||||||
@@ -822,7 +942,11 @@ int env_exist( const wchar_t *key )
|
|||||||
env = env->next;
|
env = env->next;
|
||||||
}
|
}
|
||||||
if( !proc_had_barrier)
|
if( !proc_had_barrier)
|
||||||
|
{
|
||||||
|
proc_had_barrier=1;
|
||||||
env_universal_barrier();
|
env_universal_barrier();
|
||||||
|
}
|
||||||
|
|
||||||
item = env_universal_get( key );
|
item = env_universal_get( key );
|
||||||
|
|
||||||
return item != 0;
|
return item != 0;
|
||||||
@@ -866,8 +990,20 @@ void env_pop()
|
|||||||
{
|
{
|
||||||
if( &top->env != global )
|
if( &top->env != global )
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
int locale_changed = 0;
|
||||||
|
|
||||||
env_node_t *killme = top;
|
env_node_t *killme = top;
|
||||||
|
|
||||||
|
for( i=0; locale_variable[i]; i++ )
|
||||||
|
{
|
||||||
|
if( hash_get( &killme->env, locale_variable[i] ) )
|
||||||
|
{
|
||||||
|
locale_changed = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( killme->new_scope )
|
if( killme->new_scope )
|
||||||
{
|
{
|
||||||
has_changed |= killme->export || local_scope_exports( killme->next );
|
has_changed |= killme->export || local_scope_exports( killme->next );
|
||||||
@@ -877,12 +1013,15 @@ void env_pop()
|
|||||||
hash_foreach( &killme->env, &clear_hash_entry );
|
hash_foreach( &killme->env, &clear_hash_entry );
|
||||||
hash_destroy( &killme->env );
|
hash_destroy( &killme->env );
|
||||||
free( killme );
|
free( killme );
|
||||||
|
|
||||||
|
if( locale_changed )
|
||||||
|
handle_locale();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug( 0,
|
debug( 0,
|
||||||
L"Tried to pop empty environment stack." );
|
_( L"Tried to pop empty environment stack." ) );
|
||||||
sanity_lose();
|
sanity_lose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1056,8 +1195,11 @@ static void export_func2( const void *k, const void *v, void *aux )
|
|||||||
char **env_export_arr( int recalc)
|
char **env_export_arr( int recalc)
|
||||||
{
|
{
|
||||||
if( recalc && !proc_had_barrier)
|
if( recalc && !proc_had_barrier)
|
||||||
|
{
|
||||||
|
proc_had_barrier=1;
|
||||||
env_universal_barrier();
|
env_universal_barrier();
|
||||||
|
}
|
||||||
|
|
||||||
if( has_changed )
|
if( has_changed )
|
||||||
{
|
{
|
||||||
array_list_t uni;
|
array_list_t uni;
|
||||||
|
|||||||
@@ -112,24 +112,21 @@ static int get_socket( int fork_ok )
|
|||||||
local.sun_family = AF_UNIX;
|
local.sun_family = AF_UNIX;
|
||||||
strcpy(local.sun_path, name );
|
strcpy(local.sun_path, name );
|
||||||
free( name );
|
free( name );
|
||||||
len = strlen(local.sun_path) + sizeof(local.sun_family);
|
len = sizeof(local);
|
||||||
|
|
||||||
if( connect( s, (struct sockaddr *)&local, len) == -1 )
|
if( connect( s, (struct sockaddr *)&local, len) == -1 )
|
||||||
{
|
{
|
||||||
close( s );
|
close( s );
|
||||||
if( fork_ok )
|
if( fork_ok && start_fishd )
|
||||||
{
|
{
|
||||||
debug( 2, L"Could not connect to socket %d, starting fishd", s );
|
debug( 2, L"Could not connect to socket %d, starting fishd", s );
|
||||||
|
|
||||||
if( start_fishd )
|
start_fishd();
|
||||||
{
|
|
||||||
start_fishd();
|
|
||||||
}
|
|
||||||
|
|
||||||
return get_socket( 0 );
|
return get_socket( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
debug( 3, L"Could not connect to socket %d, already tried forking, giving up", s );
|
debug( 2, L"Could not connect to socket %d, already tried manual restart (or no command supplied), giving up", s );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +171,7 @@ static void check_connection()
|
|||||||
|
|
||||||
if( env_universal_server.killme )
|
if( env_universal_server.killme )
|
||||||
{
|
{
|
||||||
debug( 2, L"Lost connection to universal variable server." );
|
debug( 3, L"Lost connection to universal variable server." );
|
||||||
close( env_universal_server.fd );
|
close( env_universal_server.fd );
|
||||||
env_universal_server.fd = -1;
|
env_universal_server.fd = -1;
|
||||||
env_universal_server.killme=0;
|
env_universal_server.killme=0;
|
||||||
@@ -193,7 +190,7 @@ static void reconnect()
|
|||||||
if( get_socket_count >= RECONNECT_COUNT )
|
if( get_socket_count >= RECONNECT_COUNT )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
debug( 2, L"Get new fishd connection" );
|
debug( 3, L"Get new fishd connection" );
|
||||||
|
|
||||||
init = 0;
|
init = 0;
|
||||||
env_universal_server.fd = get_socket(1);
|
env_universal_server.fd = get_socket(1);
|
||||||
@@ -262,6 +259,8 @@ int env_universal_read_all()
|
|||||||
if( !init)
|
if( !init)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
debug( 3, L"env_universal_read_all()" );
|
||||||
|
|
||||||
if( env_universal_server.fd == -1 )
|
if( env_universal_server.fd == -1 )
|
||||||
{
|
{
|
||||||
reconnect();
|
reconnect();
|
||||||
@@ -290,11 +289,13 @@ wchar_t *env_universal_get( const wchar_t *name )
|
|||||||
if( !name )
|
if( !name )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
debug( 3, L"env_universal_get( \"%ls\" )", name );
|
||||||
return env_universal_common_get( name );
|
return env_universal_common_get( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
int env_universal_get_export( const wchar_t *name )
|
int env_universal_get_export( const wchar_t *name )
|
||||||
{
|
{
|
||||||
|
debug( 3, L"env_universal_get_export()" );
|
||||||
return env_universal_common_get_export( name );
|
return env_universal_common_get_export( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +306,7 @@ void env_universal_barrier()
|
|||||||
|
|
||||||
if( !init || ( env_universal_server.fd == -1 ))
|
if( !init || ( env_universal_server.fd == -1 ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
barrier_reply = 0;
|
barrier_reply = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -330,6 +331,7 @@ void env_universal_barrier()
|
|||||||
if( env_universal_server.fd == -1 )
|
if( env_universal_server.fd == -1 )
|
||||||
{
|
{
|
||||||
reconnect();
|
reconnect();
|
||||||
|
debug( 2, L"barrier interrupted, exiting" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,6 +349,7 @@ void env_universal_barrier()
|
|||||||
if( env_universal_server.fd == -1 )
|
if( env_universal_server.fd == -1 )
|
||||||
{
|
{
|
||||||
reconnect();
|
reconnect();
|
||||||
|
debug( 2, L"barrier interrupted, exiting (2)" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FD_ZERO( &fds );
|
FD_ZERO( &fds );
|
||||||
@@ -365,7 +368,7 @@ void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
|
|||||||
if( !init )
|
if( !init )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
debug( 3, L"env_universal_set( %ls, %ls )", name, value );
|
debug( 3, L"env_universal_set( \"%ls\", \"%ls\" )", name, value );
|
||||||
|
|
||||||
msg = create_message( export?SET_EXPORT:SET,
|
msg = create_message( export?SET_EXPORT:SET,
|
||||||
name,
|
name,
|
||||||
@@ -388,8 +391,8 @@ void env_universal_remove( const wchar_t *name )
|
|||||||
if( !init )
|
if( !init )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
debug( 2,
|
debug( 3,
|
||||||
L"env_universal_remove( %ls )",
|
L"env_universal_remove( \"%ls\" )",
|
||||||
name );
|
name );
|
||||||
|
|
||||||
msg= create_message( ERASE, name, 0);
|
msg= create_message( ERASE, name, 0);
|
||||||
|
|||||||
157
event.c
157
event.c
@@ -19,6 +19,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
|
#include "translate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Number of signals that can be queued before an overflow occurs
|
Number of signals that can be queued before an overflow occurs
|
||||||
@@ -67,6 +68,12 @@ static array_list_t *events;
|
|||||||
*/
|
*/
|
||||||
static array_list_t *killme;
|
static array_list_t *killme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
List of events that have been sent but have not yet been delivered because they are blocked.
|
||||||
|
*/
|
||||||
|
static array_list_t *blocked;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests if one event instance matches the definition of a event
|
Tests if one event instance matches the definition of a event
|
||||||
class. If the class defines a function name, that will also be a
|
class. If the class defines a function name, that will also be a
|
||||||
@@ -120,7 +127,7 @@ static int event_match( event_t *class, event_t *instance )
|
|||||||
Create an identical copy of an event. Use deep copying, i.e. make
|
Create an identical copy of an event. Use deep copying, i.e. make
|
||||||
duplicates of any strings used as well.
|
duplicates of any strings used as well.
|
||||||
*/
|
*/
|
||||||
static event_t *event_copy( event_t *event )
|
static event_t *event_copy( event_t *event, int copy_arguments )
|
||||||
{
|
{
|
||||||
event_t *e = malloc( sizeof( event_t ) );
|
event_t *e = malloc( sizeof( event_t ) );
|
||||||
if( !e )
|
if( !e )
|
||||||
@@ -133,12 +140,55 @@ static event_t *event_copy( event_t *event )
|
|||||||
if( e->type == EVENT_VARIABLE )
|
if( e->type == EVENT_VARIABLE )
|
||||||
e->param1.variable = wcsdup( e->param1.variable );
|
e->param1.variable = wcsdup( e->param1.variable );
|
||||||
|
|
||||||
|
al_init( &e->arguments );
|
||||||
|
if( copy_arguments )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for( i=0; i<al_get_count( &event->arguments ); i++ )
|
||||||
|
{
|
||||||
|
al_push( &e->arguments, wcsdup( (wchar_t *)al_get( &event->arguments, i ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int event_is_blocked( event_t *e )
|
||||||
|
{
|
||||||
|
block_t *block;
|
||||||
|
event_block_t *eb;
|
||||||
|
|
||||||
|
for( block = current_block; block; block = block->outer )
|
||||||
|
{
|
||||||
|
for( eb = block->first_event_block; eb; eb=eb->next )
|
||||||
|
{
|
||||||
|
if( eb->type & (1<<EVENT_ANY ) )
|
||||||
|
return 1;
|
||||||
|
if( eb->type & (1<<e->type) )
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for( eb = global_event_block; eb; eb=eb->next )
|
||||||
|
{
|
||||||
|
if( eb->type & (1<<EVENT_ANY ) )
|
||||||
|
return 1;
|
||||||
|
if( eb->type & (1<<e->type) )
|
||||||
|
return 1;
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void event_add_handler( event_t *event )
|
void event_add_handler( event_t *event )
|
||||||
{
|
{
|
||||||
event_t *e = event_copy( event );
|
event_t *e;
|
||||||
|
|
||||||
|
e = event_copy( event, 0 );
|
||||||
|
|
||||||
if( !events )
|
if( !events )
|
||||||
events = al_new();
|
events = al_new();
|
||||||
@@ -268,11 +318,14 @@ static int event_is_killed( event_t *e )
|
|||||||
matches' path. This means that nothing is allocated/initialized
|
matches' path. This means that nothing is allocated/initialized
|
||||||
unless that is needed.
|
unless that is needed.
|
||||||
*/
|
*/
|
||||||
static void event_fire_internal( event_t *event, array_list_t *arguments )
|
static void event_fire_internal( event_t *event )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
string_buffer_t *b=0;
|
string_buffer_t *b=0;
|
||||||
array_list_t *fire=0;
|
array_list_t *fire=0;
|
||||||
|
|
||||||
|
int was_subshell = is_subshell;
|
||||||
|
// int was_interactive = is_interactive;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
First we free all events that have been removed
|
First we free all events that have been removed
|
||||||
@@ -334,9 +387,9 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
|
|||||||
|
|
||||||
sb_append( b, criterion->function_name );
|
sb_append( b, criterion->function_name );
|
||||||
|
|
||||||
for( j=0; j<al_get_count(arguments); j++ )
|
for( j=0; j<al_get_count(&event->arguments); j++ )
|
||||||
{
|
{
|
||||||
wchar_t *arg_esc = escape( (wchar_t *)al_get( arguments, j), 0 );
|
wchar_t *arg_esc = escape( (wchar_t *)al_get( &event->arguments, j), 0 );
|
||||||
sb_append( b, L" " );
|
sb_append( b, L" " );
|
||||||
sb_append( b, arg_esc );
|
sb_append( b, arg_esc );
|
||||||
free( arg_esc );
|
free( arg_esc );
|
||||||
@@ -344,15 +397,22 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
|
|||||||
|
|
||||||
// debug( 1, L"Event handler fires command '%ls'", (wchar_t *)b->buff );
|
// debug( 1, L"Event handler fires command '%ls'", (wchar_t *)b->buff );
|
||||||
|
|
||||||
|
/*
|
||||||
|
Event handlers are not part of the main flow of code, so
|
||||||
|
they are marked as non-interactive and as a subshell
|
||||||
|
*/
|
||||||
is_subshell=1;
|
is_subshell=1;
|
||||||
is_interactive=1;
|
// is_interactive=0;
|
||||||
|
|
||||||
eval( (wchar_t *)b->buff, 0, TOP );
|
eval( (wchar_t *)b->buff, 0, TOP );
|
||||||
is_subshell=0;
|
|
||||||
is_interactive=1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Restore interactivity flags
|
||||||
|
*/
|
||||||
|
is_subshell = was_subshell;
|
||||||
|
// is_interactive = was_interactive;
|
||||||
|
|
||||||
if( b )
|
if( b )
|
||||||
{
|
{
|
||||||
sb_destroy( b );
|
sb_destroy( b );
|
||||||
@@ -375,15 +435,40 @@ static void event_fire_internal( event_t *event, array_list_t *arguments )
|
|||||||
/**
|
/**
|
||||||
Handle all pending signal events
|
Handle all pending signal events
|
||||||
*/
|
*/
|
||||||
static void event_fire_signal_events()
|
static void event_fire_delayed()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( blocked && is_event==1)
|
||||||
|
{
|
||||||
|
array_list_t *new_blocked = 0;
|
||||||
|
|
||||||
|
for( i=0; i<al_get_count( blocked ); i++ )
|
||||||
|
{
|
||||||
|
event_t *e = (event_t *)al_get( blocked, i );
|
||||||
|
if( event_is_blocked( e ) )
|
||||||
|
{
|
||||||
|
if( !new_blocked )
|
||||||
|
new_blocked = al_new();
|
||||||
|
al_push( new_blocked, e );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event_fire_internal( e );
|
||||||
|
event_free( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
al_destroy( blocked );
|
||||||
|
free( blocked );
|
||||||
|
blocked = new_blocked;
|
||||||
|
}
|
||||||
|
|
||||||
while( sig_list[active_list].count > 0 )
|
while( sig_list[active_list].count > 0 )
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
signal_list_t *lst;
|
signal_list_t *lst;
|
||||||
event_t e;
|
event_t e;
|
||||||
array_list_t a;
|
al_init( &e.arguments );
|
||||||
al_init( &a );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Switch signal lists
|
Switch signal lists
|
||||||
@@ -402,7 +487,7 @@ static void event_fire_signal_events()
|
|||||||
|
|
||||||
if( lst->overflow )
|
if( lst->overflow )
|
||||||
{
|
{
|
||||||
debug( 0, L"Signal list overflow. Signals have been ignored" );
|
debug( 0, _( L"Signal list overflow. Signals have been ignored." ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -411,19 +496,27 @@ static void event_fire_signal_events()
|
|||||||
for( i=0; i<lst->count; i++ )
|
for( i=0; i<lst->count; i++ )
|
||||||
{
|
{
|
||||||
e.param1.signal = lst->signal[i];
|
e.param1.signal = lst->signal[i];
|
||||||
al_set( &a, 0, sig2wcs( e.param1.signal ) );
|
al_set( &e.arguments, 0, sig2wcs( e.param1.signal ) );
|
||||||
event_fire_internal( &e, &a );
|
if( event_is_blocked( &e ) )
|
||||||
|
{
|
||||||
|
if( !blocked )
|
||||||
|
blocked = al_new();
|
||||||
|
al_push( blocked, event_copy(&e, 1) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event_fire_internal( &e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
al_destroy( &a );
|
al_destroy( &e.arguments );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void event_fire( event_t *event, array_list_t *arguments )
|
void event_fire( event_t *event )
|
||||||
{
|
{
|
||||||
//int is_event_old = is_event;
|
|
||||||
is_event++;
|
is_event++;
|
||||||
|
|
||||||
if( event && (event->type == EVENT_SIGNAL) )
|
if( event && (event->type == EVENT_SIGNAL) )
|
||||||
@@ -442,13 +535,26 @@ void event_fire( event_t *event, array_list_t *arguments )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event_fire_signal_events();
|
|
||||||
|
|
||||||
|
event_fire_delayed();
|
||||||
|
|
||||||
if( event )
|
if( event )
|
||||||
event_fire_internal( event, arguments );
|
{
|
||||||
|
if( event_is_blocked( event ) )
|
||||||
|
{
|
||||||
|
if( !blocked )
|
||||||
|
blocked = al_new();
|
||||||
|
|
||||||
|
al_push( blocked, event_copy(event, 1) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event_fire_internal( event );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
is_event--;// = is_event_old;
|
is_event--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -477,9 +583,14 @@ void event_destroy()
|
|||||||
|
|
||||||
void event_free( event_t *e )
|
void event_free( event_t *e )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
When apropriate, we clear the argument vector
|
||||||
|
*/
|
||||||
|
al_foreach( &e->arguments, (void (*)(const void *))&free );
|
||||||
|
al_destroy( &e->arguments );
|
||||||
|
|
||||||
free( (void *)e->function_name );
|
free( (void *)e->function_name );
|
||||||
if( e->type == EVENT_VARIABLE )
|
if( e->type == EVENT_VARIABLE )
|
||||||
free( (void *)e->param1.variable );
|
free( (void *)e->param1.variable );
|
||||||
free( e );
|
free( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
event.h
27
event.h
@@ -17,6 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
#define EVENT_ANY_PID 0
|
#define EVENT_ANY_PID 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enumeration of event types
|
||||||
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
EVENT_ANY, /**< Matches any event type (Not always any event, as the function name may limit the choice as well */
|
EVENT_ANY, /**< Matches any event type (Not always any event, as the function name may limit the choice as well */
|
||||||
@@ -40,18 +43,24 @@ typedef struct
|
|||||||
Type of event
|
Type of event
|
||||||
*/
|
*/
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The type-specific parameter
|
||||||
|
*/
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
Signal number for signal-type events.Use EVENT_ANY_SIGNAL to match any signal
|
Signal number for signal-type events.Use EVENT_ANY_SIGNAL
|
||||||
|
to match any signal
|
||||||
*/
|
*/
|
||||||
int signal;
|
int signal;
|
||||||
/**
|
/**
|
||||||
Variable name for variable-type events.
|
Variable name for variable-type events.
|
||||||
*/
|
*/
|
||||||
const wchar_t *variable;
|
const wchar_t *variable;
|
||||||
/**
|
/**
|
||||||
Process id for process-type events. Use EVENT_ANY_PID to match any pid.
|
Process id for process-type events. Use EVENT_ANY_PID to
|
||||||
|
match any pid.
|
||||||
*/
|
*/
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +70,17 @@ typedef struct
|
|||||||
|
|
||||||
} param1;
|
} param1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The name of the event handler function
|
||||||
|
*/
|
||||||
const wchar_t *function_name;
|
const wchar_t *function_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The argument list. Only used when sending a new event using
|
||||||
|
event_fire. In all other situations, the value of this variable
|
||||||
|
is ignored.
|
||||||
|
*/
|
||||||
|
array_list_t arguments;
|
||||||
}
|
}
|
||||||
event_t;
|
event_t;
|
||||||
|
|
||||||
@@ -95,7 +114,7 @@ int event_get( event_t *criterion, array_list_t *out );
|
|||||||
\param event the specific event whose handlers should fire
|
\param event the specific event whose handlers should fire
|
||||||
\param arguments the argument string to send to the event handler function
|
\param arguments the argument string to send to the event handler function
|
||||||
*/
|
*/
|
||||||
void event_fire( event_t *event, array_list_t *arguments );
|
void event_fire( event_t *event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the event-handling library
|
Initialize the event-handling library
|
||||||
|
|||||||
352
exec.c
352
exec.c
@@ -36,6 +36,7 @@
|
|||||||
#include "expand.h"
|
#include "expand.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include "env_universal.h"
|
#include "env_universal.h"
|
||||||
|
#include "translate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prototype for the getpgid library function. The prototype for this
|
Prototype for the getpgid library function. The prototype for this
|
||||||
@@ -48,15 +49,15 @@ pid_t getpgid( pid_t pid );
|
|||||||
/**
|
/**
|
||||||
file descriptor redirection error message
|
file descriptor redirection error message
|
||||||
*/
|
*/
|
||||||
#define FD_ERROR L"An error occurred while redirecting file descriptor %d"
|
#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" )
|
||||||
/**
|
/**
|
||||||
file redirection error message
|
file redirection error message
|
||||||
*/
|
*/
|
||||||
#define FILE_ERROR L"An error occurred while redirecting file '%ls'"
|
#define FILE_ERROR _( L"An error occurred while redirecting file '%ls'" )
|
||||||
/**
|
/**
|
||||||
fork error message
|
fork error message
|
||||||
*/
|
*/
|
||||||
#define FORK_ERROR L"Could not create child process - exiting"
|
#define FORK_ERROR _( L"Could not create child process - exiting" )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +104,7 @@ void exec_close( int fd )
|
|||||||
int exec_pipe( int fd[2])
|
int exec_pipe( int fd[2])
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
while( ( res=pipe( fd ) ) )
|
while( ( res=pipe( fd ) ) )
|
||||||
{
|
{
|
||||||
if( errno != EINTR )
|
if( errno != EINTR )
|
||||||
@@ -111,23 +112,18 @@ int exec_pipe( int fd[2])
|
|||||||
wperror(L"pipe");
|
wperror(L"pipe");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug( 4, L"Created pipe using fds %d and %d", fd[0], fd[1]);
|
||||||
|
|
||||||
if( open_fds == 0 )
|
if( open_fds == 0 )
|
||||||
{
|
{
|
||||||
open_fds = malloc( sizeof( array_list_t ) );
|
open_fds = al_new();
|
||||||
if(!open_fds )
|
|
||||||
die_mem();
|
|
||||||
al_init( open_fds );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( res != -1 )
|
al_push( open_fds, (void *)(long)fd[0] );
|
||||||
{
|
al_push( open_fds, (void *)(long)fd[1] );
|
||||||
debug( 4, L"Created pipe using fds %d and %d", fd[0], fd[1]);
|
|
||||||
|
|
||||||
al_push( open_fds, (void *)(long)fd[0] );
|
|
||||||
al_push( open_fds, (void *)(long)fd[1] );
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +179,6 @@ static void close_unused_internal_pipes( io_data_t *io )
|
|||||||
|
|
||||||
void exec_init()
|
void exec_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec_destroy()
|
void exec_destroy()
|
||||||
@@ -241,14 +236,14 @@ void free_fd( io_data_t *io, int fd )
|
|||||||
redirections described by \c io.
|
redirections described by \c io.
|
||||||
|
|
||||||
\param io the list of IO redirections for the child
|
\param io the list of IO redirections for the child
|
||||||
|
\param exit_on_error whether to call exit() on errors
|
||||||
|
|
||||||
|
\return 1 on sucess, 0 on failiure
|
||||||
*/
|
*/
|
||||||
static void handle_child_io( io_data_t *io )
|
static int handle_child_io( io_data_t *io, int exit_on_error )
|
||||||
{
|
{
|
||||||
|
|
||||||
close_unused_internal_pipes( io );
|
close_unused_internal_pipes( io );
|
||||||
|
|
||||||
if( env_universal_server.fd >= 0 )
|
|
||||||
exec_close( env_universal_server.fd );
|
|
||||||
|
|
||||||
for( ; io; io=io->next )
|
for( ; io; io=io->next )
|
||||||
{
|
{
|
||||||
@@ -267,17 +262,13 @@ static void handle_child_io( io_data_t *io )
|
|||||||
free_fd( io, io->fd );
|
free_fd( io, io->fd );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
We don't mind if this fails, it is just a speculative close
|
|
||||||
to make sure no unexpected untracked fd causes us to fail
|
|
||||||
*/
|
|
||||||
close(io->fd);
|
|
||||||
|
|
||||||
switch( io->io_mode )
|
switch( io->io_mode )
|
||||||
{
|
{
|
||||||
case IO_CLOSE:
|
case IO_CLOSE:
|
||||||
|
close(io->fd);
|
||||||
break;
|
break;
|
||||||
case IO_FILE:
|
case IO_FILE:
|
||||||
|
{
|
||||||
if( (tmp=wopen( io->param1.filename,
|
if( (tmp=wopen( io->param1.filename,
|
||||||
io->param2.flags, 0777 ) )==-1 )
|
io->param2.flags, 0777 ) )==-1 )
|
||||||
{
|
{
|
||||||
@@ -286,55 +277,81 @@ static void handle_child_io( io_data_t *io )
|
|||||||
io->param1.filename );
|
io->param1.filename );
|
||||||
|
|
||||||
wperror( L"open" );
|
wperror( L"open" );
|
||||||
exit(1);
|
if( exit_on_error )
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( tmp != io->fd)
|
else if( tmp != io->fd)
|
||||||
{
|
{
|
||||||
|
close(io->fd);
|
||||||
|
|
||||||
if(dup2( tmp, io->fd ) == -1 )
|
if(dup2( tmp, io->fd ) == -1 )
|
||||||
{
|
{
|
||||||
debug( 1,
|
debug( 1,
|
||||||
FD_ERROR,
|
FD_ERROR,
|
||||||
io->fd );
|
io->fd );
|
||||||
wperror( L"dup2" );
|
wperror( L"dup2" );
|
||||||
exit(1);
|
if( exit_on_error )
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exec_close( tmp );
|
exec_close( tmp );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IO_FD:
|
case IO_FD:
|
||||||
/* debug( 3, L"Redirect fd %d in process %ls (%d) from fd %d",
|
{
|
||||||
io->fd,
|
close(io->fd);
|
||||||
p->actual_cmd,
|
|
||||||
p->pid,
|
|
||||||
io->old_fd );
|
|
||||||
*/
|
|
||||||
if( dup2( io->param1.old_fd, io->fd ) == -1 )
|
if( dup2( io->param1.old_fd, io->fd ) == -1 )
|
||||||
{
|
{
|
||||||
debug( 1,
|
debug( 1,
|
||||||
FD_ERROR,
|
FD_ERROR,
|
||||||
io->fd );
|
io->fd );
|
||||||
wperror( L"dup2" );
|
wperror( L"dup2" );
|
||||||
exit(1);
|
if( exit_on_error )
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IO_BUFFER:
|
case IO_BUFFER:
|
||||||
case IO_PIPE:
|
case IO_PIPE:
|
||||||
{
|
{
|
||||||
|
|
||||||
/* debug( 3, L"Pipe fd %d in process %ls (%d) (Through fd %d)",
|
|
||||||
io->fd,
|
|
||||||
p->actual_cmd,
|
|
||||||
p->pid,
|
|
||||||
io->pipe_fd[io->fd] );
|
|
||||||
*/
|
|
||||||
int fd_to_dup = io->fd;
|
int fd_to_dup = io->fd;
|
||||||
|
|
||||||
|
close(io->fd);
|
||||||
|
|
||||||
if( dup2( io->param1.pipe_fd[fd_to_dup?1:0], io->fd ) == -1 )
|
if( dup2( io->param1.pipe_fd[fd_to_dup?1:0], io->fd ) == -1 )
|
||||||
{
|
{
|
||||||
debug( 1, PIPE_ERROR );
|
debug( 1, PIPE_ERROR );
|
||||||
wperror( L"dup2" );
|
wperror( L"dup2" );
|
||||||
exit(1);
|
if( exit_on_error )
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fd_to_dup != 0 )
|
if( fd_to_dup != 0 )
|
||||||
@@ -343,28 +360,21 @@ static void handle_child_io( io_data_t *io )
|
|||||||
exec_close( io->param1.pipe_fd[1]);
|
exec_close( io->param1.pipe_fd[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
exec_close( io->param1.pipe_fd[0] );
|
exec_close( io->param1.pipe_fd[0] );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if( close( io[i].pipe_fd[ io->fd ] ) == -1 )
|
|
||||||
{
|
|
||||||
wperror( L"close" );
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* if( close( io[i].pipe_fd[1] ) == -1 )
|
|
||||||
{
|
|
||||||
wperror( L"close" );
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* fprintf( stderr, "fd %d points to fd %d\n", i, io[i].fd[i>0?1:0] );*/
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( env_universal_server.fd >= 0 )
|
||||||
|
exec_close( env_universal_server.fd );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -373,10 +383,17 @@ static void handle_child_io( io_data_t *io )
|
|||||||
process is put in the jobs group, all signal handlers are reset,
|
process is put in the jobs group, all signal handlers are reset,
|
||||||
SIGCHLD is unblocked (the exec call blocks blocks SIGCHLD), and all
|
SIGCHLD is unblocked (the exec call blocks blocks SIGCHLD), and all
|
||||||
IO redirections and other file descriptor actions are performed.
|
IO redirections and other file descriptor actions are performed.
|
||||||
|
|
||||||
|
\param j the job to set up the IO for
|
||||||
|
\param exit_on_error whether to call exit() on errors
|
||||||
|
|
||||||
|
\return 1 on sucess, 0 on failiure
|
||||||
*/
|
*/
|
||||||
static void setup_child_process( job_t *j )
|
static int setup_child_process( job_t *j, process_t *p )
|
||||||
{
|
{
|
||||||
if( is_interactive && !is_subshell && !is_block)
|
int res;
|
||||||
|
|
||||||
|
if( is_interactive && p->type==EXTERNAL )
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
/*
|
/*
|
||||||
@@ -401,14 +418,19 @@ static void setup_child_process( job_t *j )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res = handle_child_io( j->io, (p==0) );
|
||||||
|
|
||||||
/* Set the handling for job control signals back to the default. */
|
/* Set the handling for job control signals back to the default. */
|
||||||
signal_reset_handlers();
|
if( res )
|
||||||
|
{
|
||||||
handle_child_io( j->io );
|
signal_reset_handlers();
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove all signal blocks */
|
/* Remove all signal blocks */
|
||||||
signal_unblock();
|
signal_unblock();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -423,7 +445,7 @@ static void launch_process( process_t *p )
|
|||||||
|
|
||||||
execve (wcs2str(p->actual_cmd), wcsv2strv( (const wchar_t **) p->argv), env_export_arr( 0 ) );
|
execve (wcs2str(p->actual_cmd), wcsv2strv( (const wchar_t **) p->argv), env_export_arr( 0 ) );
|
||||||
debug( 0,
|
debug( 0,
|
||||||
L"Failed to execute process %ls",
|
_( L"Failed to execute process '%ls'" ),
|
||||||
p->actual_cmd );
|
p->actual_cmd );
|
||||||
wperror( L"execve" );
|
wperror( L"execve" );
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -440,11 +462,33 @@ static int has_fd( io_data_t *d, int fd )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Free a transmogrified io chain. Only the chain itself and resources
|
||||||
|
used by a transmogrified IO_FILE redirection are freed, since the
|
||||||
|
original chain may still be needed.
|
||||||
|
*/
|
||||||
|
static void io_untransmogrify( io_data_t * in, io_data_t *out )
|
||||||
|
{
|
||||||
|
if( !out )
|
||||||
|
return;
|
||||||
|
io_untransmogrify( in->next, out->next );
|
||||||
|
switch( in->io_mode )
|
||||||
|
{
|
||||||
|
case IO_FILE:
|
||||||
|
exec_close( out->param1.old_fd );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Make a copy of the specified io redirection chain, but change file
|
Make a copy of the specified io redirection chain, but change file
|
||||||
redirection into fd redirection. This makes the redirection chain
|
redirection into fd redirection. This makes the redirection chain
|
||||||
suitable for use as block-level io, since the file won't be
|
suitable for use as block-level io, since the file won't be
|
||||||
repeatedly reopened for every command in the block.
|
repeatedly reopened for every command in the block.
|
||||||
|
|
||||||
|
\return the transmogrified chain on sucess, or 0 on failiure
|
||||||
*/
|
*/
|
||||||
static io_data_t *io_transmogrify( io_data_t * in )
|
static io_data_t *io_transmogrify( io_data_t * in )
|
||||||
{
|
{
|
||||||
@@ -460,7 +504,8 @@ static io_data_t *io_transmogrify( io_data_t * in )
|
|||||||
out->fd = in->fd;
|
out->fd = in->fd;
|
||||||
out->io_mode = IO_FD;
|
out->io_mode = IO_FD;
|
||||||
out->param2.close_old = 1;
|
out->param2.close_old = 1;
|
||||||
|
out->next=0;
|
||||||
|
|
||||||
switch( in->io_mode )
|
switch( in->io_mode )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -489,7 +534,8 @@ static io_data_t *io_transmogrify( io_data_t * in )
|
|||||||
in->param1.filename );
|
in->param1.filename );
|
||||||
|
|
||||||
wperror( L"open" );
|
wperror( L"open" );
|
||||||
exit(1);
|
free( out );
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
out->param1.old_fd = fd;
|
out->param1.old_fd = fd;
|
||||||
@@ -497,31 +543,19 @@ static io_data_t *io_transmogrify( io_data_t * in )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out->next = io_transmogrify( in->next );
|
if( in->next)
|
||||||
|
{
|
||||||
|
out->next = io_transmogrify( in->next );
|
||||||
|
if( !out->next )
|
||||||
|
{
|
||||||
|
io_untransmogrify( in, out );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Free a transmogrified io chain. Only the chain itself and resources
|
|
||||||
used by a transmogrified IO_FILE redirection are freed, since the
|
|
||||||
original chain may still be needed.
|
|
||||||
*/
|
|
||||||
static void io_untransmogrify( io_data_t * in, io_data_t *out )
|
|
||||||
{
|
|
||||||
if( !in )
|
|
||||||
return;
|
|
||||||
io_untransmogrify( in->next, out->next );
|
|
||||||
switch( in->io_mode )
|
|
||||||
{
|
|
||||||
case IO_FILE:
|
|
||||||
exec_close( out->param1.old_fd );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
free(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Morph an io redirection chain into redirections suitable for
|
Morph an io redirection chain into redirections suitable for
|
||||||
passing to eval, call eval, and clean up morphed redirections.
|
passing to eval, call eval, and clean up morphed redirections.
|
||||||
@@ -531,32 +565,32 @@ static void io_untransmogrify( io_data_t * in, io_data_t *out )
|
|||||||
\param io the io redirections to be performed on this block
|
\param io the io redirections to be performed on this block
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int internal_exec_helper( const wchar_t *def,
|
static void internal_exec_helper( const wchar_t *def,
|
||||||
int block_type,
|
int block_type,
|
||||||
io_data_t *io )
|
io_data_t *io )
|
||||||
{
|
{
|
||||||
int res=0;
|
|
||||||
io_data_t *io_internal = io_transmogrify( io );
|
io_data_t *io_internal = io_transmogrify( io );
|
||||||
int is_block_old=is_block;
|
int is_block_old=is_block;
|
||||||
is_block=1;
|
is_block=1;
|
||||||
|
|
||||||
signal_unblock();
|
/*
|
||||||
|
Did the transmogrification fail - if so, set error status and return
|
||||||
|
*/
|
||||||
|
if( io && !io_internal )
|
||||||
|
{
|
||||||
|
proc_set_last_status( 1 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
signal_unblock();
|
||||||
|
|
||||||
eval( def, io_internal, block_type );
|
eval( def, io_internal, block_type );
|
||||||
|
|
||||||
signal_block();
|
signal_block();
|
||||||
|
|
||||||
/*
|
|
||||||
io_data_t *buff = io_get( io, 1 );
|
|
||||||
if( buff && buff->io_mode == IO_BUFFER )
|
|
||||||
fwprintf( stderr, L"block %ls produced %d bytes of output\n",
|
|
||||||
def,
|
|
||||||
buff->out_buffer->used );
|
|
||||||
*/
|
|
||||||
io_untransmogrify( io, io_internal );
|
io_untransmogrify( io, io_internal );
|
||||||
job_reap( 0 );
|
job_reap( 0 );
|
||||||
is_block=is_block_old;
|
is_block=is_block_old;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -567,7 +601,7 @@ static int internal_exec_helper( const wchar_t *def,
|
|||||||
static int handle_new_child( job_t *j, process_t *p )
|
static int handle_new_child( job_t *j, process_t *p )
|
||||||
{
|
{
|
||||||
|
|
||||||
if(is_interactive && !is_subshell && !is_block)
|
if( is_interactive && p->type==EXTERNAL )
|
||||||
{
|
{
|
||||||
int new_pgid=0;
|
int new_pgid=0;
|
||||||
|
|
||||||
@@ -582,7 +616,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
|||||||
if( getpgid( p->pid) != j->pgid )
|
if( getpgid( p->pid) != j->pgid )
|
||||||
{
|
{
|
||||||
debug( 1,
|
debug( 1,
|
||||||
L"Could not send process %d from group %d to group %d",
|
_( L"Could not send process %d from group %d to group %d" ),
|
||||||
p->pid,
|
p->pid,
|
||||||
getpgid( p->pid),
|
getpgid( p->pid),
|
||||||
j->pgid );
|
j->pgid );
|
||||||
@@ -594,7 +628,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
|||||||
{
|
{
|
||||||
if( tcsetpgrp (0, j->pgid) )
|
if( tcsetpgrp (0, j->pgid) )
|
||||||
{
|
{
|
||||||
debug( 1, L"Could not send job %d ('%ls')to foreground",
|
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||||
j->job_id,
|
j->job_id,
|
||||||
j->command );
|
j->command );
|
||||||
wperror( L"tcsetpgrp" );
|
wperror( L"tcsetpgrp" );
|
||||||
@@ -606,7 +640,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
|||||||
{
|
{
|
||||||
if( tcsetpgrp (0, j->pgid) )
|
if( tcsetpgrp (0, j->pgid) )
|
||||||
{
|
{
|
||||||
debug( 1, L"Could not send job %d ('%ls')to foreground",
|
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||||
j->job_id,
|
j->job_id,
|
||||||
j->command );
|
j->command );
|
||||||
wperror( L"tcsetpgrp" );
|
wperror( L"tcsetpgrp" );
|
||||||
@@ -656,11 +690,20 @@ void exec( job_t *j )
|
|||||||
/*
|
/*
|
||||||
setup_child_process make sure signals are propelry set up
|
setup_child_process make sure signals are propelry set up
|
||||||
*/
|
*/
|
||||||
setup_child_process( j );
|
if( setup_child_process( j, 0 ) )
|
||||||
launch_process( j->first_process );
|
{
|
||||||
/*
|
/*
|
||||||
launch_process _never_ returns...
|
launch_process never returns
|
||||||
*/
|
*/
|
||||||
|
launch_process( j->first_process );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
j->constructed=1;
|
||||||
|
j->first_process->completed=1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -672,7 +715,7 @@ void exec( job_t *j )
|
|||||||
pipe_write.io_mode=IO_PIPE;
|
pipe_write.io_mode=IO_PIPE;
|
||||||
pipe_read.next=0;
|
pipe_read.next=0;
|
||||||
pipe_write.next=0;
|
pipe_write.next=0;
|
||||||
pipe_write.param1.pipe_fd[0]=pipe_write.param1.pipe_fd[1]=0;
|
pipe_write.param1.pipe_fd[0]=pipe_write.param1.pipe_fd[1]=-1;
|
||||||
|
|
||||||
//fwprintf( stderr, L"Run command %ls\n", j->command );
|
//fwprintf( stderr, L"Run command %ls\n", j->command );
|
||||||
|
|
||||||
@@ -696,7 +739,7 @@ void exec( job_t *j )
|
|||||||
The loop also has to handle pipelining between the jobs.
|
The loop also has to handle pipelining between the jobs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (p = j->first_process; p; p = p->next)
|
for( p=j->first_process; p; p = p->next )
|
||||||
{
|
{
|
||||||
mypipe[1]=-1;
|
mypipe[1]=-1;
|
||||||
skip_fork=0;
|
skip_fork=0;
|
||||||
@@ -722,9 +765,11 @@ void exec( job_t *j )
|
|||||||
j->io = io_add( j->io, &pipe_read );
|
j->io = io_add( j->io, &pipe_read );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->next)
|
if( p->next )
|
||||||
{
|
{
|
||||||
if (exec_pipe( mypipe ) == -1)
|
// debug( 1, L"%ls|%ls" , p->argv[0], p->next->argv[0]);
|
||||||
|
|
||||||
|
if( exec_pipe( mypipe ) == -1 )
|
||||||
{
|
{
|
||||||
debug( 1, PIPE_ERROR );
|
debug( 1, PIPE_ERROR );
|
||||||
wperror (L"pipe");
|
wperror (L"pipe");
|
||||||
@@ -766,7 +811,7 @@ void exec( job_t *j )
|
|||||||
// fwprintf( stderr, L"run function %ls\n", argv[0] );
|
// fwprintf( stderr, L"run function %ls\n", argv[0] );
|
||||||
if( def == 0 )
|
if( def == 0 )
|
||||||
{
|
{
|
||||||
debug( 0, L"Unknown function %ls", p->argv[0] );
|
debug( 0, _( L"Unknown function '%ls'" ), p->argv[0] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parser_push_block( FUNCTION_CALL );
|
parser_push_block( FUNCTION_CALL );
|
||||||
@@ -775,7 +820,7 @@ void exec( job_t *j )
|
|||||||
{
|
{
|
||||||
sb_init( &sb );
|
sb_init( &sb );
|
||||||
|
|
||||||
for( i=1,arg = p->argv+1; *arg; i++, arg++ )
|
for( i=1, arg=p->argv+1; *arg; i++, arg++ )
|
||||||
{
|
{
|
||||||
if( i != 1 )
|
if( i != 1 )
|
||||||
sb_append( &sb, ARRAY_SEP_STR );
|
sb_append( &sb, ARRAY_SEP_STR );
|
||||||
@@ -874,7 +919,7 @@ void exec( job_t *j )
|
|||||||
{
|
{
|
||||||
builtin_stdin=-1;
|
builtin_stdin=-1;
|
||||||
debug( 1,
|
debug( 1,
|
||||||
L"Unknown input redirection type %d",
|
_( L"Unknown input redirection type %d" ),
|
||||||
in->io_mode);
|
in->io_mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -941,15 +986,23 @@ void exec( job_t *j )
|
|||||||
case INTERNAL_FUNCTION:
|
case INTERNAL_FUNCTION:
|
||||||
{
|
{
|
||||||
int status = proc_get_last_status();
|
int status = proc_get_last_status();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Handle output from a block or function. This usually
|
Handle output from a block or function. This usually
|
||||||
means do nothing, but in the case of pipes, we have
|
means do nothing, but in the case of pipes, we have
|
||||||
to buffer such io, since otherwisethe internal pipe
|
to buffer such io, since otherwise the internal pipe
|
||||||
buffer might overflow.
|
buffer might overflow.
|
||||||
*/
|
*/
|
||||||
if( !io_buffer)
|
if( !io_buffer )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
No buffer, se we exit directly. This means we
|
||||||
|
have to manually set the exit status.
|
||||||
|
*/
|
||||||
|
if( p->next == 0 )
|
||||||
|
{
|
||||||
|
proc_set_last_status( j->negate?(status?0:1):status);
|
||||||
|
}
|
||||||
p->completed = 1;
|
p->completed = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -960,22 +1013,20 @@ void exec( job_t *j )
|
|||||||
|
|
||||||
if( io_buffer->param2.out_buffer->used != 0 )
|
if( io_buffer->param2.out_buffer->used != 0 )
|
||||||
{
|
{
|
||||||
|
pid = fork();
|
||||||
|
if( pid == 0 )
|
||||||
pid = fork ();
|
|
||||||
if (pid == 0)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is the child process. Write out the contents of the pipeline.
|
This is the child process. Write out the contents of the pipeline.
|
||||||
*/
|
*/
|
||||||
p->pid = getpid();
|
p->pid = getpid();
|
||||||
setup_child_process( j );
|
setup_child_process( j, p );
|
||||||
write( io_buffer->fd,
|
write( io_buffer->fd,
|
||||||
io_buffer->param2.out_buffer->buff,
|
io_buffer->param2.out_buffer->buff,
|
||||||
io_buffer->param2.out_buffer->used );
|
io_buffer->param2.out_buffer->used );
|
||||||
exit( status );
|
exit( status );
|
||||||
}
|
}
|
||||||
else if (pid < 0)
|
else if( pid < 0 )
|
||||||
{
|
{
|
||||||
/* The fork failed. */
|
/* The fork failed. */
|
||||||
debug( 0, FORK_ERROR );
|
debug( 0, FORK_ERROR );
|
||||||
@@ -1024,7 +1075,7 @@ void exec( job_t *j )
|
|||||||
|
|
||||||
io_data_t *io = io_get( j->io, 1 );
|
io_data_t *io = io_get( j->io, 1 );
|
||||||
int buffer_stdout = io && io->io_mode == IO_BUFFER;
|
int buffer_stdout = io && io->io_mode == IO_BUFFER;
|
||||||
|
|
||||||
if( ( !sb_err->used ) &&
|
if( ( !sb_err->used ) &&
|
||||||
( !p->next ) &&
|
( !p->next ) &&
|
||||||
( sb_out->used ) &&
|
( sb_out->used ) &&
|
||||||
@@ -1044,22 +1095,20 @@ void exec( job_t *j )
|
|||||||
{
|
{
|
||||||
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
|
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
|
||||||
|
|
||||||
proc_set_last_status( p->status );
|
|
||||||
proc_set_last_status( j->negate?(p->status?0:1):p->status );
|
proc_set_last_status( j->negate?(p->status?0:1):p->status );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pid = fork ();
|
pid = fork();
|
||||||
if (pid == 0)
|
if( pid == 0 )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is the child process.
|
This is the child process.
|
||||||
*/
|
*/
|
||||||
p->pid = getpid();
|
p->pid = getpid();
|
||||||
setup_child_process( j );
|
setup_child_process( j, p );
|
||||||
if( sb_out->used )
|
if( sb_out->used )
|
||||||
fwprintf( stdout, L"%ls", sb_out->buff );
|
fwprintf( stdout, L"%ls", sb_out->buff );
|
||||||
if( sb_err->used )
|
if( sb_err->used )
|
||||||
@@ -1068,7 +1117,7 @@ void exec( job_t *j )
|
|||||||
exit( p->status );
|
exit( p->status );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (pid < 0)
|
else if( pid < 0 )
|
||||||
{
|
{
|
||||||
/* The fork failed. */
|
/* The fork failed. */
|
||||||
debug( 0, FORK_ERROR );
|
debug( 0, FORK_ERROR );
|
||||||
@@ -1094,29 +1143,26 @@ void exec( job_t *j )
|
|||||||
|
|
||||||
case EXTERNAL:
|
case EXTERNAL:
|
||||||
{
|
{
|
||||||
|
pid = fork();
|
||||||
// fwprintf( stderr,
|
if( pid == 0 )
|
||||||
// L"fork on %ls\n", j->command );
|
|
||||||
pid = fork ();
|
|
||||||
if (pid == 0)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is the child process.
|
This is the child process.
|
||||||
*/
|
*/
|
||||||
p->pid = getpid();
|
p->pid = getpid();
|
||||||
setup_child_process( j );
|
setup_child_process( j, p );
|
||||||
launch_process( p );
|
launch_process( p );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
launch_process _never_ returns...
|
launch_process _never_ returns...
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else if (pid < 0)
|
else if( pid < 0 )
|
||||||
{
|
{
|
||||||
/* The fork failed. */
|
/* The fork failed. */
|
||||||
debug( 0, FORK_ERROR );
|
debug( 0, FORK_ERROR );
|
||||||
wperror (L"fork");
|
wperror( L"fork" );
|
||||||
exit (1);
|
exit( 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1138,11 +1184,10 @@ void exec( job_t *j )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(p->type == INTERNAL_BUILTIN)
|
if( p->type == INTERNAL_BUILTIN )
|
||||||
builtin_pop_io();
|
builtin_pop_io();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Close the pipe the current process uses to read from the previous process_t
|
Close the pipe the current process uses to read from the previous process_t
|
||||||
*/
|
*/
|
||||||
@@ -1201,7 +1246,7 @@ int exec_subshell( const wchar_t *cmd,
|
|||||||
if( !cmd )
|
if( !cmd )
|
||||||
{
|
{
|
||||||
debug( 1,
|
debug( 1,
|
||||||
L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %ls",
|
_( L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s." ),
|
||||||
PACKAGE_BUGREPORT );
|
PACKAGE_BUGREPORT );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1223,7 +1268,7 @@ int exec_subshell( const wchar_t *cmd,
|
|||||||
b_append( io_buffer->param2.out_buffer, &z, 1 );
|
b_append( io_buffer->param2.out_buffer, &z, 1 );
|
||||||
|
|
||||||
begin=end=io_buffer->param2.out_buffer->buff;
|
begin=end=io_buffer->param2.out_buffer->buff;
|
||||||
|
|
||||||
if( l )
|
if( l )
|
||||||
{
|
{
|
||||||
while( 1 )
|
while( 1 )
|
||||||
@@ -1247,7 +1292,14 @@ int exec_subshell( const wchar_t *cmd,
|
|||||||
wchar_t *el;
|
wchar_t *el;
|
||||||
*end=0;
|
*end=0;
|
||||||
el = str2wcs( begin );
|
el = str2wcs( begin );
|
||||||
al_push( l, el );
|
if( !el )
|
||||||
|
{
|
||||||
|
debug( 0, _( L"Subshell '%ls' returned illegal string, discarded one entry" ), cmd );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
al_push( l, el );
|
||||||
|
}
|
||||||
begin = end+1;
|
begin = end+1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
2
exec.h
2
exec.h
@@ -16,7 +16,7 @@
|
|||||||
/**
|
/**
|
||||||
pipe redirection error message
|
pipe redirection error message
|
||||||
*/
|
*/
|
||||||
#define PIPE_ERROR L"An error occurred while setting up pipe"
|
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the exec library
|
Initialize the exec library
|
||||||
|
|||||||
453
expand.c
453
expand.c
@@ -20,6 +20,8 @@ parameter expansion.
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef SunOS
|
#ifdef SunOS
|
||||||
#include <procfs.h>
|
#include <procfs.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -67,6 +69,9 @@ parameter expansion.
|
|||||||
*/
|
*/
|
||||||
#define COMPLETE_LAST_DESC COMPLETE_SEP_STR L"Last background job"
|
#define COMPLETE_LAST_DESC COMPLETE_SEP_STR L"Last background job"
|
||||||
|
|
||||||
|
#define COMPLETE_VAR_DESC L"Variable name is zero characters long."
|
||||||
|
#define COMPLETE_VAR2_DESC L"Variable name is zero characters long. Did you mean{$VARIABLE}? To learn about variable expansion in fish, type 'help expand-variable'."
|
||||||
|
|
||||||
/**
|
/**
|
||||||
String in process expansion denoting ourself
|
String in process expansion denoting ourself
|
||||||
*/
|
*/
|
||||||
@@ -78,13 +83,55 @@ parameter expansion.
|
|||||||
#define LAST_STR L"last"
|
#define LAST_STR L"last"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the environment variable value for the string starting at in
|
Characters which make a string unclean if they are the first
|
||||||
|
character of the string. See \c is_clean().
|
||||||
|
*/
|
||||||
|
#define UNCLEAN_FIRST L"~%"
|
||||||
|
/**
|
||||||
|
Unclean characters. See \c is_clean().
|
||||||
|
*/
|
||||||
|
#define UNCLEAN L"$*?\\\"'({})"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Test if the specified argument is clean, i.e. it does not contain
|
||||||
|
any tokens which need to be expanded or otherwise altered. Clean
|
||||||
|
strings can be passed through expand_string and expand_one without
|
||||||
|
changing them. About 90% of all strings are clean, so skipping
|
||||||
|
expansion on them actually does save a small amount of time, since
|
||||||
|
it avoids multiple memory allocations during the expansion process.
|
||||||
|
*/
|
||||||
|
static int is_clean( const wchar_t *in )
|
||||||
|
{
|
||||||
|
|
||||||
|
const wchar_t * str = in;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Test characters that have a special meaning in the first character position
|
||||||
|
*/
|
||||||
|
if( wcschr( UNCLEAN_FIRST, *str ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Test characters that have a special meaning in any character position
|
||||||
|
*/
|
||||||
|
while( *str )
|
||||||
|
{
|
||||||
|
if( wcschr( UNCLEAN, *str ) )
|
||||||
|
return 0;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the environment variable value for the string starting at \c in.
|
||||||
*/
|
*/
|
||||||
static wchar_t *expand_var( wchar_t *in )
|
static wchar_t *expand_var( wchar_t *in )
|
||||||
{
|
{
|
||||||
if( !in )
|
if( !in )
|
||||||
return 0;
|
return 0;
|
||||||
return (in[0] == VARIABLE_EXPAND )? env_get( expand_var(in+1) ) : env_get( in );
|
return env_get( in );
|
||||||
}
|
}
|
||||||
|
|
||||||
void expand_variable_array( const wchar_t *val, array_list_t *out )
|
void expand_variable_array( const wchar_t *val, array_list_t *out )
|
||||||
@@ -97,7 +144,6 @@ void expand_variable_array( const wchar_t *val, array_list_t *out )
|
|||||||
if( !cpy )
|
if( !cpy )
|
||||||
{
|
{
|
||||||
die_mem();
|
die_mem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for( start=pos=cpy; *pos; pos++ )
|
for( start=pos=cpy; *pos; pos++ )
|
||||||
@@ -110,7 +156,7 @@ void expand_variable_array( const wchar_t *val, array_list_t *out )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
al_push( out, wcsdup(start) );
|
al_push( out, wcsdup(start) );
|
||||||
|
|
||||||
free(cpy);
|
free(cpy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +206,7 @@ wchar_t *expand_escape_variable( const wchar_t *in )
|
|||||||
switch( al_get_count( &l) )
|
switch( al_get_count( &l) )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sb_append( &buff, L"\'\'");
|
sb_append( &buff, L"''");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@@ -170,9 +216,9 @@ wchar_t *expand_escape_variable( const wchar_t *in )
|
|||||||
if( wcschr( el, L' ' ) && is_quotable( el ) )
|
if( wcschr( el, L' ' ) && is_quotable( el ) )
|
||||||
{
|
{
|
||||||
sb_append2( &buff,
|
sb_append2( &buff,
|
||||||
L"\'",
|
L"'",
|
||||||
el,
|
el,
|
||||||
L"\'",
|
L"'",
|
||||||
(void *)0 );
|
(void *)0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -196,9 +242,9 @@ wchar_t *expand_escape_variable( const wchar_t *in )
|
|||||||
if( is_quotable( el ) )
|
if( is_quotable( el ) )
|
||||||
{
|
{
|
||||||
sb_append2( &buff,
|
sb_append2( &buff,
|
||||||
L"\'",
|
L"'",
|
||||||
el,
|
el,
|
||||||
L"\'",
|
L"'",
|
||||||
(void *)0 );
|
(void *)0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -299,7 +345,8 @@ static int match_pid( const wchar_t *cmd,
|
|||||||
Searches for a job with the specified job id, or a job or process
|
Searches for a job with the specified job id, or a job or process
|
||||||
which has the string \c proc as a prefix of its commandline.
|
which has the string \c proc as a prefix of its commandline.
|
||||||
|
|
||||||
If accept_incomplete is true, the remaining string for any matches are inserted.
|
If accept_incomplete is true, the remaining string for any matches
|
||||||
|
are inserted.
|
||||||
|
|
||||||
If accept_incomplete is false, any job matching the specified
|
If accept_incomplete is false, any job matching the specified
|
||||||
string is matched, and the job pgid is returned. If no job
|
string is matched, and the job pgid is returned. If no job
|
||||||
@@ -322,8 +369,6 @@ static int find_process( const wchar_t *proc,
|
|||||||
wchar_t *result;
|
wchar_t *result;
|
||||||
|
|
||||||
job_t *j;
|
job_t *j;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( iswnumeric(proc) || (wcslen(proc)==0) )
|
if( iswnumeric(proc) || (wcslen(proc)==0) )
|
||||||
{
|
{
|
||||||
@@ -657,11 +702,10 @@ static int expand_variables( wchar_t *in, array_list_t *out )
|
|||||||
int is_ok= 1;
|
int is_ok= 1;
|
||||||
int empty=0;
|
int empty=0;
|
||||||
|
|
||||||
|
|
||||||
for( i=wcslen(in)-1; (i>=0) && is_ok && !empty; i-- )
|
for( i=wcslen(in)-1; (i>=0) && is_ok && !empty; i-- )
|
||||||
{
|
{
|
||||||
c = in[i];
|
c = in[i];
|
||||||
if( c == VARIABLE_EXPAND )
|
if( ( c == VARIABLE_EXPAND ) || (c == VARIABLE_EXPAND_SINGLE ) )
|
||||||
{
|
{
|
||||||
int start_pos = i+1;
|
int start_pos = i+1;
|
||||||
int stop_pos;
|
int stop_pos;
|
||||||
@@ -670,15 +714,8 @@ static int expand_variables( wchar_t *in, array_list_t *out )
|
|||||||
wchar_t * var_val;
|
wchar_t * var_val;
|
||||||
wchar_t * new_in;
|
wchar_t * new_in;
|
||||||
array_list_t l;
|
array_list_t l;
|
||||||
|
int is_single = (c==VARIABLE_EXPAND_SINGLE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// fwprintf( stderr, L"Expand %ls\n", in );
|
|
||||||
|
|
||||||
|
|
||||||
// while (in[stop_pos]==VARIABLE_EXPAND)
|
|
||||||
// stop_pos++;
|
|
||||||
|
|
||||||
stop_pos = start_pos;
|
stop_pos = start_pos;
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
@@ -695,106 +732,157 @@ static int expand_variables( wchar_t *in, array_list_t *out )
|
|||||||
/* printf( "Stop for '%c'\n", in[stop_pos]);*/
|
/* printf( "Stop for '%c'\n", in[stop_pos]);*/
|
||||||
|
|
||||||
var_len = stop_pos - start_pos;
|
var_len = stop_pos - start_pos;
|
||||||
|
|
||||||
|
if( var_len == 0 )
|
||||||
|
{
|
||||||
|
if( in[stop_pos] == BRACKET_BEGIN )
|
||||||
|
{
|
||||||
|
|
||||||
|
error( SYNTAX_ERROR,
|
||||||
|
-1, COMPLETE_VAR_DESC
|
||||||
|
COMPLETE_VAR2_DESC );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error( SYNTAX_ERROR,
|
||||||
|
-1,
|
||||||
|
COMPLETE_VAR_DESC);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_ok = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if( !(var_name = malloc( sizeof(wchar_t)*(var_len+1) )))
|
if( !(var_name = malloc( sizeof(wchar_t)*(var_len+1) )))
|
||||||
{
|
{
|
||||||
die_mem();
|
die_mem();
|
||||||
}
|
}
|
||||||
else
|
wcsncpy( var_name, &in[start_pos], var_len );
|
||||||
{
|
var_name[var_len]='\0';
|
||||||
wcsncpy( var_name, &in[start_pos], var_len );
|
|
||||||
var_name[var_len]='\0';
|
|
||||||
/* printf( "Variable name is %s, len is %d\n", var_name, var_len );*/
|
/* printf( "Variable name is %s, len is %d\n", var_name, var_len );*/
|
||||||
wchar_t *var_val_orig = expand_var( var_name );
|
wchar_t *var_val_orig = expand_var( var_name );
|
||||||
|
|
||||||
if( var_val_orig && (var_val = wcsdup( var_val_orig) ) )
|
if( var_val_orig && (var_val = wcsdup( var_val_orig) ) )
|
||||||
{
|
{
|
||||||
int all_vars=1;
|
int all_vars=1;
|
||||||
array_list_t idx;
|
array_list_t idx;
|
||||||
al_init( &idx );
|
al_init( &idx );
|
||||||
al_init( &l );
|
al_init( &l );
|
||||||
|
|
||||||
if( in[stop_pos] == L'[' )
|
if( in[stop_pos] == L'[' )
|
||||||
{
|
{
|
||||||
wchar_t *end;
|
wchar_t *end;
|
||||||
|
|
||||||
all_vars = 0;
|
all_vars = 0;
|
||||||
|
|
||||||
stop_pos++;
|
stop_pos++;
|
||||||
while( 1 )
|
while( 1 )
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
|
||||||
|
stop_pos++;
|
||||||
|
|
||||||
|
|
||||||
|
if( in[stop_pos] == L']' )
|
||||||
{
|
{
|
||||||
int tmp;
|
stop_pos++;
|
||||||
|
break;
|
||||||
while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
|
}
|
||||||
stop_pos++;
|
|
||||||
|
|
||||||
|
|
||||||
if( in[stop_pos] == L']' )
|
|
||||||
{
|
|
||||||
stop_pos++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
errno=0;
|
errno=0;
|
||||||
tmp = wcstol( &in[stop_pos], &end, 10 );
|
tmp = wcstol( &in[stop_pos], &end, 10 );
|
||||||
if( ( errno ) || ( end == &in[stop_pos] ) )
|
if( ( errno ) || ( end == &in[stop_pos] ) )
|
||||||
|
{
|
||||||
|
error( SYNTAX_ERROR,
|
||||||
|
-1,
|
||||||
|
L"Expected integer or \']\'" );
|
||||||
|
|
||||||
|
is_ok = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
al_push( &idx, (void *)tmp );
|
||||||
|
stop_pos = end-in;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( is_ok )
|
||||||
|
{
|
||||||
|
expand_variable_array( var_val, &l );
|
||||||
|
if( !all_vars )
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
for( j=0; j<al_get_count( &idx ); j++)
|
||||||
|
{
|
||||||
|
int tmp = (int)al_get( &idx, j );
|
||||||
|
if( tmp < 1 || tmp > al_get_count( &l ) )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR,
|
error( SYNTAX_ERROR,
|
||||||
L"Expected integer or \']\'",
|
-1,
|
||||||
-1 );
|
L"Array index out of bounds" );
|
||||||
is_ok = 0;
|
is_ok=0;
|
||||||
|
al_truncate( &idx, j );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
al_push( &idx, (void *)tmp );
|
else
|
||||||
stop_pos = end-in;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( is_ok )
|
|
||||||
{
|
|
||||||
expand_variable_array( var_val, &l );
|
|
||||||
if( !all_vars )
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for( j=0; j<al_get_count( &idx ); j++)
|
|
||||||
{
|
{
|
||||||
int tmp = (int)al_get( &idx, j );
|
/* Move string from list l to list idx */
|
||||||
if( tmp < 1 || tmp > al_get_count( &l ) )
|
al_set( &idx, j, al_get( &l, tmp-1 ) );
|
||||||
{
|
al_set( &l, tmp-1, 0 );
|
||||||
error( SYNTAX_ERROR, L"Array index out of bounds", -1 );
|
|
||||||
is_ok=0;
|
|
||||||
al_truncate( &idx, j );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Move string from list l to list idx */
|
|
||||||
al_set( &idx, j, al_get( &l, tmp-1 ) );
|
|
||||||
al_set( &l, tmp-1, 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Free remaining strings in list l and truncate it */
|
|
||||||
al_foreach( &l, (void (*)(const void *))&free );
|
|
||||||
al_truncate( &l, 0 );
|
|
||||||
/* Add items from list idx back to list l */
|
|
||||||
al_push_all( &l, &idx );
|
|
||||||
}
|
}
|
||||||
free( var_val );
|
/* Free remaining strings in list l and truncate it */
|
||||||
}
|
al_foreach( &l, (void (*)(const void *))&free );
|
||||||
|
al_truncate( &l, 0 );
|
||||||
|
/* Add items from list idx back to list l */
|
||||||
|
al_push_all( &l, &idx );
|
||||||
|
}
|
||||||
|
free( var_val );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( is_single )
|
||||||
|
{
|
||||||
|
string_buffer_t res;
|
||||||
|
sb_init( &res );
|
||||||
|
|
||||||
|
in[i]=0;
|
||||||
|
|
||||||
|
sb_append( &res, in );
|
||||||
|
sb_append_char( &res, INTERNAL_SEPARATOR );
|
||||||
|
|
||||||
|
for( j=0; j<al_get_count( &l); j++ )
|
||||||
|
{
|
||||||
|
wchar_t *next = (wchar_t *)al_get( &l, j );
|
||||||
|
|
||||||
|
if( is_ok )
|
||||||
|
{
|
||||||
|
if( j != 0 )
|
||||||
|
sb_append( &res, L" " );
|
||||||
|
sb_append( &res, next );
|
||||||
|
}
|
||||||
|
free( next );
|
||||||
|
}
|
||||||
|
sb_append( &res, &in[stop_pos] );
|
||||||
|
is_ok &= expand_variables( wcsdup((wchar_t *)res.buff), out );
|
||||||
|
|
||||||
|
sb_destroy( &res );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for( j=0; j<al_get_count( &l); j++ )
|
for( j=0; j<al_get_count( &l); j++ )
|
||||||
{
|
{
|
||||||
wchar_t *next = (wchar_t *)al_get( &l, j );
|
wchar_t *next = (wchar_t *)al_get( &l, j );
|
||||||
|
|
||||||
if( is_ok )
|
if( is_ok )
|
||||||
{
|
{
|
||||||
|
|
||||||
new_len = wcslen(in) - (stop_pos-start_pos+1) + wcslen( next) +2;
|
new_len = wcslen(in) - (stop_pos-start_pos+1) + wcslen( next) +2;
|
||||||
|
|
||||||
if( !(new_in = malloc( sizeof(wchar_t)*new_len )))
|
if( !(new_in = malloc( sizeof(wchar_t)*new_len )))
|
||||||
{
|
{
|
||||||
error( OOM, L"Out of memory", -1 );
|
die_mem();
|
||||||
is_ok = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -817,21 +905,54 @@ static int expand_variables( wchar_t *in, array_list_t *out )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
free( next );
|
free( next );
|
||||||
}
|
}
|
||||||
al_destroy( &l );
|
}
|
||||||
al_destroy( &idx );
|
|
||||||
free(in);
|
al_destroy( &l );
|
||||||
free(var_name );
|
al_destroy( &idx );
|
||||||
return is_ok;
|
free(in);
|
||||||
|
free(var_name );
|
||||||
|
return is_ok;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Expand a non-existing variable
|
||||||
|
*/
|
||||||
|
if( c == VARIABLE_EXPAND )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Regular expansion, i.e. expand this argument to nothing
|
||||||
|
*/
|
||||||
|
empty = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
empty = 1;
|
/*
|
||||||
|
Expansion to single argument.
|
||||||
|
*/
|
||||||
|
string_buffer_t res;
|
||||||
|
sb_init( &res );
|
||||||
|
|
||||||
|
in[i]=0;
|
||||||
|
|
||||||
|
sb_append( &res, in );
|
||||||
|
|
||||||
|
sb_append( &res, &in[stop_pos] );
|
||||||
|
is_ok &= expand_variables( wcsdup((wchar_t *)res.buff), out );
|
||||||
|
|
||||||
|
sb_destroy( &res );
|
||||||
|
free(in);
|
||||||
|
free(var_name );
|
||||||
|
return is_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(var_name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(var_name );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_char = c;
|
prev_char = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -930,7 +1051,9 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
|||||||
|
|
||||||
if( syntax_error )
|
if( syntax_error )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR, L"Mismatched brackets", -1 );
|
error( SYNTAX_ERROR,
|
||||||
|
-1,
|
||||||
|
L"Mismatched brackets" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,6 +1176,11 @@ int expand_locate_subshell( wchar_t *in,
|
|||||||
*begin = paran_begin;
|
*begin = paran_begin;
|
||||||
*end = paran_count?in+wcslen(in):paran_end;
|
*end = paran_count?in+wcslen(in):paran_end;
|
||||||
|
|
||||||
|
/* assert( *begin >= in );
|
||||||
|
assert( *begin < (in+wcslen(in) ) );
|
||||||
|
assert( *end >= *begin );
|
||||||
|
assert( *end < (in+wcslen(in) ) );
|
||||||
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1076,7 +1204,9 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
|
|||||||
0 ) )
|
0 ) )
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
error( SYNTAX_ERROR, L"Mismatched parans", -1 );
|
error( SYNTAX_ERROR,
|
||||||
|
-1,
|
||||||
|
L"Mismatched parans" );
|
||||||
return 0;
|
return 0;
|
||||||
case 0:
|
case 0:
|
||||||
al_push( out, in );
|
al_push( out, in );
|
||||||
@@ -1085,9 +1215,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
len1 = (paran_begin-in);
|
len1 = (paran_begin-in);
|
||||||
len2 = wcslen(paran_end)-1;
|
len2 = wcslen(paran_end)-1;
|
||||||
@@ -1111,10 +1239,10 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
|
|||||||
free( subcmd );
|
free( subcmd );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
al_init( &tail_expand );
|
al_init( &tail_expand );
|
||||||
expand_subshell( wcsdup(paran_end+1), &tail_expand );
|
expand_subshell( wcsdup(paran_end+1), &tail_expand );
|
||||||
|
|
||||||
for( i=0; i<al_get_count( &sub_res ); i++ )
|
for( i=0; i<al_get_count( &sub_res ); i++ )
|
||||||
{
|
{
|
||||||
wchar_t *sub_item, *sub_item2;
|
wchar_t *sub_item, *sub_item2;
|
||||||
@@ -1122,20 +1250,20 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
|
|||||||
sub_item2 = expand_escape( sub_item, 1 );
|
sub_item2 = expand_escape( sub_item, 1 );
|
||||||
free(sub_item);
|
free(sub_item);
|
||||||
int item_len = wcslen( sub_item2 );
|
int item_len = wcslen( sub_item2 );
|
||||||
|
|
||||||
for( j=0; j<al_get_count( &tail_expand ); j++ )
|
for( j=0; j<al_get_count( &tail_expand ); j++ )
|
||||||
{
|
{
|
||||||
string_buffer_t whole_item;
|
string_buffer_t whole_item;
|
||||||
wchar_t *tail_item = (wchar_t *)al_get( &tail_expand, j );
|
wchar_t *tail_item = (wchar_t *)al_get( &tail_expand, j );
|
||||||
|
|
||||||
sb_init( &whole_item );
|
sb_init( &whole_item );
|
||||||
|
|
||||||
sb_append_substring( &whole_item, in, len1 );
|
sb_append_substring( &whole_item, in, len1 );
|
||||||
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
|
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
|
||||||
sb_append_substring( &whole_item, sub_item2, item_len );
|
sb_append_substring( &whole_item, sub_item2, item_len );
|
||||||
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
|
sb_append_char( &whole_item, INTERNAL_SEPARATOR );
|
||||||
sb_append( &whole_item, tail_item );
|
sb_append( &whole_item, tail_item );
|
||||||
|
|
||||||
al_push( out, whole_item.buff );
|
al_push( out, whole_item.buff );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1147,7 +1275,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
|
|||||||
|
|
||||||
al_foreach( &tail_expand, (void (*)(const void *))&free );
|
al_foreach( &tail_expand, (void (*)(const void *))&free );
|
||||||
al_destroy( &tail_expand );
|
al_destroy( &tail_expand );
|
||||||
|
|
||||||
free( subcmd );
|
free( subcmd );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1157,26 +1285,25 @@ wchar_t *expand_unescape( const wchar_t * in, int escape_special )
|
|||||||
{
|
{
|
||||||
wchar_t *res = unescape( in, escape_special );
|
wchar_t *res = unescape( in, escape_special );
|
||||||
if( !res )
|
if( !res )
|
||||||
error( SYNTAX_ERROR, L"Unexpected end of string", -1 );
|
error( SYNTAX_ERROR, -1, L"Unexpected end of string" );
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Attempts tilde expansion. Of the string specified. If tilde
|
Attempts tilde expansion. Of the string specified. If tilde
|
||||||
expansion is performed, the argument is freed and a new string is
|
expansion is performed, the original string is freed and a new
|
||||||
allocated in its place. Horrible call signature. Should be
|
string allocated using malloc is returned, otherwise, the original
|
||||||
altered. Fugly!
|
string is returned.
|
||||||
*/
|
*/
|
||||||
static int tilde_expand( wchar_t **ptr )
|
static wchar_t * expand_tilde_internal( wchar_t *in )
|
||||||
{
|
{
|
||||||
wchar_t *in = *ptr;
|
|
||||||
|
|
||||||
if( in[0] == HOME_DIRECTORY )
|
if( in[0] == HOME_DIRECTORY )
|
||||||
{
|
{
|
||||||
int tilde_error = 0;
|
int tilde_error = 0;
|
||||||
wchar_t *home=0;
|
wchar_t *home=0;
|
||||||
wchar_t *new_in;
|
wchar_t *new_in=0;
|
||||||
wchar_t *old_in;
|
wchar_t *old_in=0;
|
||||||
|
|
||||||
// fwprintf( stderr, L"Tilde expand ~%ls\n", (*ptr)+1 );
|
// fwprintf( stderr, L"Tilde expand ~%ls\n", (*ptr)+1 );
|
||||||
if( in[1] == '/' || in[1] == '\0' )
|
if( in[1] == '/' || in[1] == '\0' )
|
||||||
@@ -1210,7 +1337,7 @@ static int tilde_expand( wchar_t **ptr )
|
|||||||
old_in = name_end;
|
old_in = name_end;
|
||||||
|
|
||||||
char *name_str = wcs2str( name );
|
char *name_str = wcs2str( name );
|
||||||
|
|
||||||
struct passwd *userinfo =
|
struct passwd *userinfo =
|
||||||
getpwnam( name_str );
|
getpwnam( name_str );
|
||||||
|
|
||||||
@@ -1233,26 +1360,23 @@ static int tilde_expand( wchar_t **ptr )
|
|||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !tilde_error )
|
if( !tilde_error && home && old_in )
|
||||||
{
|
{
|
||||||
new_in = wcsdupcat( home, old_in );
|
new_in = wcsdupcat( home, old_in );
|
||||||
free( in );
|
}
|
||||||
in = new_in;
|
free(home);
|
||||||
free(home);
|
free( in );
|
||||||
*ptr = in;
|
return new_in;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t *expand_tilde(wchar_t *in)
|
wchar_t *expand_tilde( wchar_t *in)
|
||||||
{
|
{
|
||||||
if( in[0] == L'~' )
|
if( in[0] == L'~' )
|
||||||
{
|
{
|
||||||
in[0] = HOME_DIRECTORY;
|
in[0] = HOME_DIRECTORY;
|
||||||
tilde_expand( &in );
|
return expand_tilde_internal( in );
|
||||||
return in;
|
|
||||||
}
|
}
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
@@ -1266,8 +1390,6 @@ static void remove_internal_separator( const void *s, int conv )
|
|||||||
wchar_t *in = (wchar_t *)s;
|
wchar_t *in = (wchar_t *)s;
|
||||||
wchar_t *out=in;
|
wchar_t *out=in;
|
||||||
|
|
||||||
// int changed=0;
|
|
||||||
|
|
||||||
while( *in )
|
while( *in )
|
||||||
{
|
{
|
||||||
switch( *in )
|
switch( *in )
|
||||||
@@ -1291,16 +1413,11 @@ static void remove_internal_separator( const void *s, int conv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*out=0;
|
*out=0;
|
||||||
/* if( changed )
|
|
||||||
{
|
|
||||||
fwprintf( stderr, L" -> %ls\n", s );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The real expansion function. All other expansion functions are wrappers to this one.
|
The real expansion function. expand_one is just a wrapper around this one.
|
||||||
*/
|
*/
|
||||||
int expand_string( wchar_t *str,
|
int expand_string( wchar_t *str,
|
||||||
array_list_t *end_out,
|
array_list_t *end_out,
|
||||||
@@ -1311,7 +1428,17 @@ int expand_string( wchar_t *str,
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
int subshell_ok = 1;
|
int subshell_ok = 1;
|
||||||
|
int res = EXPAND_OK;
|
||||||
|
|
||||||
|
// debug( 1, L"Expand %ls", str );
|
||||||
|
|
||||||
|
|
||||||
|
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( str ) )
|
||||||
|
{
|
||||||
|
al_push( end_out, str );
|
||||||
|
return EXPAND_OK;
|
||||||
|
}
|
||||||
|
|
||||||
al_init( &list1 );
|
al_init( &list1 );
|
||||||
al_init( &list2 );
|
al_init( &list2 );
|
||||||
|
|
||||||
@@ -1327,11 +1454,11 @@ int expand_string( wchar_t *str,
|
|||||||
|
|
||||||
if( (pos == str) || ( *(pos-1) != L'\\' ) )
|
if( (pos == str) || ( *(pos-1) != L'\\' ) )
|
||||||
{
|
{
|
||||||
error( SUBSHELL_ERROR, L"Subshells not allowed", -1 );
|
error( SUBSHELL_ERROR, -1, L"Subshells not allowed" );
|
||||||
free( str );
|
free( str );
|
||||||
al_destroy( &list1 );
|
al_destroy( &list1 );
|
||||||
al_destroy( &list2 );
|
al_destroy( &list2 );
|
||||||
return 0;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
@@ -1345,7 +1472,7 @@ int expand_string( wchar_t *str,
|
|||||||
if( !subshell_ok )
|
if( !subshell_ok )
|
||||||
{
|
{
|
||||||
al_destroy( &list1 );
|
al_destroy( &list1 );
|
||||||
return 0;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1355,12 +1482,12 @@ int expand_string( wchar_t *str,
|
|||||||
for( i=0; i<al_get_count( in ); i++ )
|
for( i=0; i<al_get_count( in ); i++ )
|
||||||
{
|
{
|
||||||
wchar_t *next;
|
wchar_t *next;
|
||||||
|
|
||||||
next = expand_unescape( (wchar_t *)al_get( in, i ),
|
next = expand_unescape( (wchar_t *)al_get( in, i ),
|
||||||
1);
|
1);
|
||||||
|
|
||||||
free( (void *)al_get( in, i ) );
|
free( (void *)al_get( in, i ) );
|
||||||
|
|
||||||
if( !next )
|
if( !next )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1379,7 +1506,7 @@ int expand_string( wchar_t *str,
|
|||||||
{
|
{
|
||||||
al_destroy( in );
|
al_destroy( in );
|
||||||
al_destroy( out );
|
al_destroy( out );
|
||||||
return 0;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1396,7 +1523,7 @@ int expand_string( wchar_t *str,
|
|||||||
{
|
{
|
||||||
al_destroy( in );
|
al_destroy( in );
|
||||||
al_destroy( out );
|
al_destroy( out );
|
||||||
return 0;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
al_truncate( in, 0 );
|
al_truncate( in, 0 );
|
||||||
@@ -1407,21 +1534,26 @@ int expand_string( wchar_t *str,
|
|||||||
for( i=0; i<al_get_count( in ); i++ )
|
for( i=0; i<al_get_count( in ); i++ )
|
||||||
{
|
{
|
||||||
wchar_t *next = (wchar_t *)al_get( in, i );
|
wchar_t *next = (wchar_t *)al_get( in, i );
|
||||||
if(!tilde_expand( &next ))
|
if( !(next=expand_tilde_internal( next ) ) )
|
||||||
{
|
{
|
||||||
al_destroy( in );
|
al_destroy( in );
|
||||||
al_destroy( out );
|
al_destroy( out );
|
||||||
return 0;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( flags & ACCEPT_INCOMPLETE )
|
if( flags & ACCEPT_INCOMPLETE )
|
||||||
{
|
{
|
||||||
if( *next == PROCESS_EXPAND )
|
if( *next == PROCESS_EXPAND )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
If process expansion matches, we are not
|
||||||
|
interested in other completions, so we
|
||||||
|
short-circut and return
|
||||||
|
*/
|
||||||
expand_pid( next, flags, end_out );
|
expand_pid( next, flags, end_out );
|
||||||
al_destroy( in );
|
al_destroy( in );
|
||||||
al_destroy( out );
|
al_destroy( out );
|
||||||
return 1;
|
return EXPAND_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
al_push( out, next );
|
al_push( out, next );
|
||||||
@@ -1432,7 +1564,7 @@ int expand_string( wchar_t *str,
|
|||||||
{
|
{
|
||||||
al_destroy( in );
|
al_destroy( in );
|
||||||
al_destroy( out );
|
al_destroy( out );
|
||||||
return 0;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1465,19 +1597,18 @@ int expand_string( wchar_t *str,
|
|||||||
case 0:
|
case 0:
|
||||||
if( !(flags & ACCEPT_INCOMPLETE) )
|
if( !(flags & ACCEPT_INCOMPLETE) )
|
||||||
{
|
{
|
||||||
|
if( res == EXPAND_OK )
|
||||||
|
res = EXPAND_WILDCARD_NO_MATCH;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
res = EXPAND_WILDCARD_MATCH;
|
||||||
sort_list( out );
|
sort_list( out );
|
||||||
al_push_all( end_out, out );
|
al_push_all( end_out, out );
|
||||||
al_truncate( out, 0 );
|
al_truncate( out, 0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
fwprintf( stderr, L"error\n" );
|
|
||||||
/*al_destroy( &list1 );*/
|
|
||||||
/*al_destroy( &list2 );*/
|
|
||||||
/*return 0;*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1492,7 +1623,8 @@ int expand_string( wchar_t *str,
|
|||||||
al_destroy( out );
|
al_destroy( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1501,6 +1633,9 @@ wchar_t *expand_one( wchar_t *string, int flags )
|
|||||||
array_list_t l;
|
array_list_t l;
|
||||||
int res;
|
int res;
|
||||||
wchar_t *one;
|
wchar_t *one;
|
||||||
|
|
||||||
|
if( (!(flags & ACCEPT_INCOMPLETE)) && is_clean( string ) )
|
||||||
|
return string;
|
||||||
|
|
||||||
al_init( &l );
|
al_init( &l );
|
||||||
res = expand_string( string, &l, flags );
|
res = expand_string( string, &l, flags );
|
||||||
@@ -1520,7 +1655,7 @@ wchar_t *expand_one( wchar_t *string, int flags )
|
|||||||
al_set( &l, 0, 0 );
|
al_set( &l, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
al_foreach( &l, (void(*)(const void *))&free );
|
al_foreach( &l, (void(*)(const void *))&free );
|
||||||
al_destroy( &l );
|
al_destroy( &l );
|
||||||
return one;
|
return one;
|
||||||
|
|||||||
61
expand.h
61
expand.h
@@ -1,12 +1,12 @@
|
|||||||
/**\file expand.h
|
/**\file expand.h
|
||||||
|
|
||||||
Prototypes for string expantion functions. These functions perform
|
Prototypes for string expansion functions. These functions perform
|
||||||
several kinds of parameter expantion. There are a lot of issues
|
several kinds of parameter expansion. There are a lot of issues
|
||||||
with regards to memory allocation. Overall, these functions would
|
with regards to memory allocation. Overall, these functions would
|
||||||
benefit from using a more clever memory allocation scheme, perhaps
|
benefit from using a more clever memory allocation scheme, perhaps
|
||||||
an evil combination of talloc, string buffers and reference
|
an evil combination of talloc, string buffers and reference
|
||||||
counting.
|
counting.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FISH_EXPAND_H
|
#ifndef FISH_EXPAND_H
|
||||||
@@ -20,17 +20,17 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flag specifying that subshell expantion should be skipped
|
Flag specifying that subshell expansion should be skipped
|
||||||
*/
|
*/
|
||||||
#define EXPAND_SKIP_SUBSHELL 1
|
#define EXPAND_SKIP_SUBSHELL 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flag specifying that variable expantion should be skipped
|
Flag specifying that variable expansion should be skipped
|
||||||
*/
|
*/
|
||||||
#define EXPAND_SKIP_VARIABLES 2
|
#define EXPAND_SKIP_VARIABLES 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flag specifying that wildcard expantion should be skipped
|
Flag specifying that wildcard expansion should be skipped
|
||||||
*/
|
*/
|
||||||
#define EXPAND_SKIP_WILDCARDS 4
|
#define EXPAND_SKIP_WILDCARDS 4
|
||||||
|
|
||||||
@@ -64,20 +64,45 @@ enum
|
|||||||
/** Character represeting a home directory */
|
/** Character represeting a home directory */
|
||||||
HOME_DIRECTORY = EXPAND_RESERVED,
|
HOME_DIRECTORY = EXPAND_RESERVED,
|
||||||
|
|
||||||
/** Character represeting process expantion */
|
/** Character represeting process expansion */
|
||||||
PROCESS_EXPAND,
|
PROCESS_EXPAND,
|
||||||
|
|
||||||
/** Character representing variable expantion */
|
/** Character representing variable expansion */
|
||||||
VARIABLE_EXPAND,
|
VARIABLE_EXPAND,
|
||||||
|
|
||||||
/** Character representing the start of a bracket expantion */
|
/** Character rpresenting variable expansion into a single element*/
|
||||||
|
VARIABLE_EXPAND_SINGLE,
|
||||||
|
|
||||||
|
/** Character representing the start of a bracket expansion */
|
||||||
BRACKET_BEGIN,
|
BRACKET_BEGIN,
|
||||||
|
|
||||||
/** Character representing the end of a bracket expantion */
|
/** Character representing the end of a bracket expansion */
|
||||||
BRACKET_END,
|
BRACKET_END,
|
||||||
|
|
||||||
/** Character representing separation between two bracket elements */
|
/** Character representing separation between two bracket elements */
|
||||||
BRACKET_SEP,
|
BRACKET_SEP,
|
||||||
|
/**
|
||||||
|
Separate subtokens in a token with this character.
|
||||||
|
*/
|
||||||
|
INTERNAL_SEPARATOR,
|
||||||
|
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
These are the possible return values for expand_string
|
||||||
|
*/
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
/** Error */
|
||||||
|
EXPAND_ERROR,
|
||||||
|
/** Ok */
|
||||||
|
EXPAND_OK,
|
||||||
|
/** Ok, a wildcard in the string matched no files */
|
||||||
|
EXPAND_WILDCARD_NO_MATCH,
|
||||||
|
/* Ok, a wildcard in the string matched a file */
|
||||||
|
EXPAND_WILDCARD_MATCH
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -87,18 +112,13 @@ enum
|
|||||||
/** String containing the character for separating two array elements */
|
/** String containing the character for separating two array elements */
|
||||||
#define ARRAY_SEP_STR L"\x1e"
|
#define ARRAY_SEP_STR L"\x1e"
|
||||||
|
|
||||||
/**
|
|
||||||
Separate subtokens in a token with this character.
|
|
||||||
*/
|
|
||||||
#define INTERNAL_SEPARATOR 0xfffffff0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform various forms of expansion on in, such as tilde expansion
|
Perform various forms of expansion on in, such as tilde expansion
|
||||||
(~USER becomes the users home directory), variable expansion
|
(~USER becomes the users home directory), variable expansion
|
||||||
($VAR_NAME becomes the value of the environment variable VAR_NAME),
|
($VAR_NAME becomes the value of the environment variable VAR_NAME),
|
||||||
subshell expantion and wildcard expansion. The results are inserted
|
subshell expansion and wildcard expansion. The results are inserted
|
||||||
into the list out.
|
into the list out.
|
||||||
|
|
||||||
If the parameter does not need expansion, it is copied into the list
|
If the parameter does not need expansion, it is copied into the list
|
||||||
@@ -106,8 +126,9 @@ enum
|
|||||||
newly allocated strings are inserted into the list out.
|
newly allocated strings are inserted into the list out.
|
||||||
|
|
||||||
\param in The parameter to expand
|
\param in The parameter to expand
|
||||||
\param flag Specifies if any expantion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||||
\param out The list to which the result will be appended.
|
\param out The list to which the result will be appended.
|
||||||
|
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH
|
||||||
*/
|
*/
|
||||||
int expand_string( wchar_t *in, array_list_t *out, int flag );
|
int expand_string( wchar_t *in, array_list_t *out, int flag );
|
||||||
|
|
||||||
@@ -117,7 +138,7 @@ int expand_string( wchar_t *in, array_list_t *out, int flag );
|
|||||||
names.
|
names.
|
||||||
|
|
||||||
\param in The parameter to expand
|
\param in The parameter to expand
|
||||||
\param flag Specifies if any expantion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||||
\return The expanded parameter, or 0 on failiure
|
\return The expanded parameter, or 0 on failiure
|
||||||
*/
|
*/
|
||||||
wchar_t *expand_one( wchar_t *in, int flag );
|
wchar_t *expand_one( wchar_t *in, int flag );
|
||||||
@@ -154,9 +175,9 @@ wchar_t *expand_escape_variable( const wchar_t *in );
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform tilde expantion and nothing else on the specified string.
|
Perform tilde expansion and nothing else on the specified string.
|
||||||
|
|
||||||
If tilde expantion is needed, the original string is freed and a
|
If tilde expansion is needed, the original string is freed and a
|
||||||
new string, allocated using malloc, is returned.
|
new string, allocated using malloc, is returned.
|
||||||
*/
|
*/
|
||||||
wchar_t *expand_tilde(wchar_t *in);
|
wchar_t *expand_tilde(wchar_t *in);
|
||||||
|
|||||||
@@ -51,14 +51,12 @@ fi
|
|||||||
%_mandir/man1/xsel.1x*
|
%_mandir/man1/xsel.1x*
|
||||||
%_mandir/man1/mimedb.1*
|
%_mandir/man1/mimedb.1*
|
||||||
%_mandir/man1/set_color.1*
|
%_mandir/man1/set_color.1*
|
||||||
%_mandir/man1/tokenize.1*
|
|
||||||
%_mandir/man1/count.1*
|
%_mandir/man1/count.1*
|
||||||
%attr(0755,root,root) %_bindir/fish
|
%attr(0755,root,root) %_bindir/fish
|
||||||
%attr(0755,root,root) %_bindir/fishd
|
%attr(0755,root,root) %_bindir/fishd
|
||||||
%attr(0755,root,root) %_bindir/fish_pager
|
%attr(0755,root,root) %_bindir/fish_pager
|
||||||
%attr(0755,root,root) %_bindir/xsel
|
%attr(0755,root,root) %_bindir/xsel
|
||||||
%attr(0755,root,root) %_bindir/set_color
|
%attr(0755,root,root) %_bindir/set_color
|
||||||
%attr(0755,root,root) %_bindir/tokenize
|
|
||||||
%attr(0755,root,root) %_bindir/mimedb
|
%attr(0755,root,root) %_bindir/mimedb
|
||||||
%attr(0755,root,root) %_bindir/count
|
%attr(0755,root,root) %_bindir/count
|
||||||
%config %_sysconfdir/fish
|
%config %_sysconfdir/fish
|
||||||
@@ -67,8 +65,12 @@ fi
|
|||||||
%config %_sysconfdir/fish.d/fish_*.fish
|
%config %_sysconfdir/fish.d/fish_*.fish
|
||||||
%dir %_sysconfdir/fish.d/completions
|
%dir %_sysconfdir/fish.d/completions
|
||||||
%config %_sysconfdir/fish.d/completions/*.fish
|
%config %_sysconfdir/fish.d/completions/*.fish
|
||||||
|
%_datadir/locale/*/LC_MESSAGES/fish.mo
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 29 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.17.0-0
|
||||||
|
- 1.17.0
|
||||||
|
|
||||||
* Sat Sep 24 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.14.0-0
|
* Sat Sep 24 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.14.0-0
|
||||||
- 1.14.0
|
- 1.14.0
|
||||||
|
|
||||||
|
|||||||
11
fish_pager.c
11
fish_pager.c
@@ -422,9 +422,10 @@ static void printed_length( wchar_t *str,
|
|||||||
case L'^':
|
case L'^':
|
||||||
case L'<':
|
case L'<':
|
||||||
case L'>':
|
case L'>':
|
||||||
case L'@':
|
|
||||||
case L'(':
|
case L'(':
|
||||||
case L')':
|
case L')':
|
||||||
|
case L'[':
|
||||||
|
case L']':
|
||||||
case L'{':
|
case L'{':
|
||||||
case L'}':
|
case L'}':
|
||||||
case L'?':
|
case L'?':
|
||||||
@@ -432,6 +433,11 @@ static void printed_length( wchar_t *str,
|
|||||||
case L'|':
|
case L'|':
|
||||||
case L';':
|
case L';':
|
||||||
case L':':
|
case L':':
|
||||||
|
case L'\'':
|
||||||
|
case L'"':
|
||||||
|
case L'%':
|
||||||
|
case L'~':
|
||||||
|
|
||||||
if( has_description )
|
if( has_description )
|
||||||
desc_len++;
|
desc_len++;
|
||||||
else
|
else
|
||||||
@@ -839,8 +845,7 @@ static void init()
|
|||||||
{
|
{
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
program_name = L"fish_pager";
|
program_name = L"fish_pager";
|
||||||
fish_setlocale( LC_ALL, L"" );
|
wsetlocale( LC_ALL, L"" );
|
||||||
|
|
||||||
|
|
||||||
int out = dup( 1 );
|
int out = dup( 1 );
|
||||||
close(1);
|
close(1);
|
||||||
|
|||||||
13
fish_tests.c
13
fish_tests.c
@@ -38,6 +38,9 @@
|
|||||||
#include "expand.h"
|
#include "expand.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "tokenizer.h"
|
#include "tokenizer.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "exec.h"
|
||||||
|
#include "event.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Number of laps to run performance testing loop
|
Number of laps to run performance testing loop
|
||||||
@@ -515,7 +518,7 @@ static void test_parser()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform parameter expantion and test if the output equals the zero-terminated parameter list supplied.
|
Perform parameter expansion and test if the output equals the zero-terminated parameter list supplied.
|
||||||
|
|
||||||
\param in the string to expand
|
\param in the string to expand
|
||||||
\param flags the flags to send to expand_string
|
\param flags the flags to send to expand_string
|
||||||
@@ -558,11 +561,11 @@ static int expand_test( const wchar_t *in, int flags, ... )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test globbing and other parameter expantion
|
Test globbing and other parameter expansion
|
||||||
*/
|
*/
|
||||||
static void test_expand()
|
static void test_expand()
|
||||||
{
|
{
|
||||||
say( L"Testing parameter expantion" );
|
say( L"Testing parameter expansion" );
|
||||||
|
|
||||||
if( !expand_test( L"foo", 0, L"foo", 0 ))
|
if( !expand_test( L"foo", 0, L"foo", 0 ))
|
||||||
{
|
{
|
||||||
@@ -571,12 +574,12 @@ static void test_expand()
|
|||||||
|
|
||||||
if( !expand_test( L"a{b,c,d}e", 0, L"abe", L"ace", L"ade", 0 ) )
|
if( !expand_test( L"a{b,c,d}e", 0, L"abe", L"ace", L"ade", 0 ) )
|
||||||
{
|
{
|
||||||
err( L"Bracket expantion is broken" );
|
err( L"Bracket expansion is broken" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !expand_test( L"a*", EXPAND_SKIP_WILDCARDS, L"a*", 0 ) )
|
if( !expand_test( L"a*", EXPAND_SKIP_WILDCARDS, L"a*", 0 ) )
|
||||||
{
|
{
|
||||||
err( L"Cannot skip wildcard expantion" );
|
err( L"Cannot skip wildcard expansion" );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
66
fishd.c
66
fishd.c
@@ -70,6 +70,11 @@ static connection_t *conn;
|
|||||||
*/
|
*/
|
||||||
static int sock;
|
static int sock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set to one when fishd should save and exit
|
||||||
|
*/
|
||||||
|
static int quit=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructs the fish socket filename
|
Constructs the fish socket filename
|
||||||
*/
|
*/
|
||||||
@@ -110,6 +115,15 @@ static char *get_socket_filename()
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Signal handler for the term signal.
|
||||||
|
*/
|
||||||
|
static void handle_term( int signal )
|
||||||
|
{
|
||||||
|
quit=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Acquire the lock for the socket
|
Acquire the lock for the socket
|
||||||
Returns the name of the lock file if successful or
|
Returns the name of the lock file if successful or
|
||||||
@@ -160,8 +174,8 @@ static int get_socket()
|
|||||||
|
|
||||||
local.sun_family = AF_UNIX;
|
local.sun_family = AF_UNIX;
|
||||||
strcpy( local.sun_path, sock_name );
|
strcpy( local.sun_path, sock_name );
|
||||||
len = strlen( local.sun_path ) + sizeof( local.sun_family );
|
len = sizeof(local);
|
||||||
|
|
||||||
debug(1, L"Connect to socket at %s", sock_name);
|
debug(1, L"Connect to socket at %s", sock_name);
|
||||||
|
|
||||||
if( ( s = socket( AF_UNIX, SOCK_STREAM, 0 ) ) == -1 )
|
if( ( s = socket( AF_UNIX, SOCK_STREAM, 0 ) ) == -1 )
|
||||||
@@ -268,26 +282,37 @@ static void daemonize()
|
|||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Make fishd ignore the HUP signal.
|
||||||
|
*/
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
sigemptyset( & act.sa_mask );
|
sigemptyset( & act.sa_mask );
|
||||||
act.sa_flags=0;
|
act.sa_flags=0;
|
||||||
act.sa_handler=SIG_IGN;
|
act.sa_handler=SIG_IGN;
|
||||||
sigaction( SIGHUP, &act, 0);
|
sigaction( SIGHUP, &act, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Make fishd save and exit on the TERM signal.
|
||||||
|
*/
|
||||||
|
sigfillset( & act.sa_mask );
|
||||||
|
act.sa_flags=0;
|
||||||
|
act.sa_handler=&handle_term;
|
||||||
|
sigaction( SIGTERM, &act, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
debug( 0, L"Parent calling exit" );
|
debug( 0, L"Parent process exiting (This is normal)" );
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Put ourself in out own processing group
|
Put ourself in out own processing group
|
||||||
*/
|
*/
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Close stdin and stdout. We only use stderr, anyway.
|
Close stdin and stdout. We only use stderr, anyway.
|
||||||
*/
|
*/
|
||||||
@@ -375,7 +400,7 @@ static void init()
|
|||||||
|
|
||||||
sock = get_socket();
|
sock = get_socket();
|
||||||
daemonize();
|
daemonize();
|
||||||
fish_setlocale( LC_ALL, L"" );
|
wsetlocale( LC_ALL, L"" );
|
||||||
env_universal_common_init( &broadcast );
|
env_universal_common_init( &broadcast );
|
||||||
|
|
||||||
load();
|
load();
|
||||||
@@ -386,8 +411,9 @@ static void init()
|
|||||||
*/
|
*/
|
||||||
int main( int argc, char ** argv )
|
int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
int child_socket, t;
|
int child_socket;
|
||||||
struct sockaddr_un remote;
|
struct sockaddr_un remote;
|
||||||
|
socklen_t t;
|
||||||
int max_fd;
|
int max_fd;
|
||||||
int update_count=0;
|
int update_count=0;
|
||||||
|
|
||||||
@@ -416,15 +442,27 @@ int main( int argc, char ** argv )
|
|||||||
FD_SET( c->fd, &write_fd );
|
FD_SET( c->fd, &write_fd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res=select( max_fd, &read_fd, &write_fd, 0, 0 );
|
while( 1 )
|
||||||
|
|
||||||
if( res==-1 )
|
|
||||||
{
|
{
|
||||||
wperror( L"select" );
|
res=select( max_fd, &read_fd, &write_fd, 0, 0 );
|
||||||
exit(1);
|
|
||||||
|
if( quit )
|
||||||
|
{
|
||||||
|
save();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( res != -1 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( errno != EINTR )
|
||||||
|
{
|
||||||
|
wperror( L"select" );
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FD_ISSET( sock, &read_fd ) )
|
if( FD_ISSET( sock, &read_fd ) )
|
||||||
{
|
{
|
||||||
if( (child_socket =
|
if( (child_socket =
|
||||||
|
|||||||
@@ -68,12 +68,20 @@ void function_add( const wchar_t *name,
|
|||||||
int is_binding )
|
int is_binding )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
wchar_t *cmd_end;
|
||||||
|
|
||||||
|
|
||||||
if( function_exists( name ) )
|
if( function_exists( name ) )
|
||||||
function_remove( name );
|
function_remove( name );
|
||||||
|
|
||||||
function_data_t *d = malloc( sizeof( function_data_t ) );
|
function_data_t *d = malloc( sizeof( function_data_t ) );
|
||||||
d->cmd = wcsdup( val );
|
d->cmd = wcsdup( val );
|
||||||
|
cmd_end = d->cmd + wcslen(d->cmd)-1;
|
||||||
|
while( (cmd_end>d->cmd) && wcschr( L"\n\r\t ", *cmd_end ) )
|
||||||
|
{
|
||||||
|
*cmd_end--=0;
|
||||||
|
}
|
||||||
|
|
||||||
d->desc = desc?wcsdup( desc ):0;
|
d->desc = desc?wcsdup( desc ):0;
|
||||||
d->is_binding = is_binding;
|
d->is_binding = is_binding;
|
||||||
hash_put( &function, intern(name), d );
|
hash_put( &function, intern(name), d );
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc );
|
|||||||
/**
|
/**
|
||||||
Returns true if the function witrh the name name exists.
|
Returns true if the function witrh the name name exists.
|
||||||
*/
|
*/
|
||||||
int function_exists( const wchar_t *name);
|
int function_exists( const wchar_t *name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Insert all function names into l. These are not copies of the strings and should not be freed after use.
|
Insert all function names into l. These are not copies of the strings and should not be freed after use.
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ static void history_load( wchar_t *name )
|
|||||||
|
|
||||||
Use a hashtable to check for duplicates instead.
|
Use a hashtable to check for duplicates instead.
|
||||||
*/
|
*/
|
||||||
if( !hash_get( &used,
|
if( wcslen(buff) && !hash_get( &used,
|
||||||
buff ) )
|
buff ) )
|
||||||
{
|
{
|
||||||
history_count++;
|
history_count++;
|
||||||
|
|
||||||
@@ -465,10 +465,7 @@ const wchar_t *history_prev_match( const wchar_t *str )
|
|||||||
|
|
||||||
if( history_current->prev == 0 )
|
if( history_current->prev == 0 )
|
||||||
{
|
{
|
||||||
if( history_test( str, history_current->data ) )
|
return str;
|
||||||
return (wchar_t *)history_current->data;
|
|
||||||
else
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
if( past_end )
|
if( past_end )
|
||||||
past_end = 0;
|
past_end = 0;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#apm
|
#apm
|
||||||
complete -f -c apm -s V -l version -d "print version"
|
complete -f -c apm -s V -l version -d (_ "Display version and exit")
|
||||||
complete -f -c apm -s v -l verbose -d "print APM info"
|
complete -f -c apm -s v -l verbose -d (_ "Print APM info")
|
||||||
complete -f -c apm -s m -l minutes -d "print time remaining"
|
complete -f -c apm -s m -l minutes -d (_ "Print time remaining")
|
||||||
complete -f -c apm -s M -l monitor -d "monitor status info"
|
complete -f -c apm -s M -l monitor -d (_ "Monitor status info")
|
||||||
complete -f -c apm -s S -l standby -d "request APM standby mode"
|
complete -f -c apm -s S -l standby -d (_ "Request APM standby mode")
|
||||||
complete -f -c apm -s s -l suspend -d "request APM suspend mode"
|
complete -f -c apm -s s -l suspend -d (_ "Request APM suspend mode")
|
||||||
complete -f -c apm -s d -l debug -d "APM status debuggin info"
|
complete -f -c apm -s d -l debug -d (_ "APM status debugging info")
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
|
|
||||||
function __fish_complete_apropos
|
function __fish_complete_apropos
|
||||||
if test (commandline -ct)
|
if test (commandline -ct)
|
||||||
set str (commandline -ct)
|
set str (commandline -ct)
|
||||||
apropos $str|sed -e 's/^\(.*'$str'\([^ ]*\).*\)$/'$str'\2\t\1/'
|
apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2\t\1/"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -xc apropos -a "(__fish_complete_apropos)" -d "Whatis entry"
|
complete -xc apropos -a '(__fish_complete_apropos)' -d (_ "whatis entry")
|
||||||
|
|
||||||
complete -c apropos -s h -l help -d "apropos command help"
|
complete -c apropos -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apropos -s d -l debug -d "print debugging info"
|
complete -f -c apropos -s d -l debug -d (_ "Print debugging info")
|
||||||
complete -f -c apropos -s v -l verbose -d "print verbose warning"
|
complete -f -c apropos -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete -f -c apropos -s r -l regex -d "keyword as regex"
|
complete -f -c apropos -s r -l regex -d (_ "Keyword as regex")
|
||||||
complete -f -c apropos -s w -l wildcard -d "keyword as wildwards"
|
complete -f -c apropos -s w -l wildcard -d (_ "Keyword as wildwards")
|
||||||
complete -f -c apropos -s e -l exact -d "keyword as exactly match"
|
complete -f -c apropos -s e -l exact -d (_ "Keyword as exactly match")
|
||||||
complete -x -c apropos -s m -l system -d "search for other system"
|
complete -x -c apropos -s m -l system -d (_ "Search for other system")
|
||||||
complete -x -c apropos -s M -l manpath -a "(echo $MANPATH)" -d "specify man path"
|
complete -x -c apropos -s M -l manpath -a '(echo $MANPATH)' -d (_ "Specify man path")
|
||||||
complete -x -c apropos -s C -l config-file -d "specify a conf file"
|
complete -x -c apropos -s C -l config-file -d (_ "Specify a configuration file")
|
||||||
complete -f -c apropos -s V -l version -d "Display version"
|
complete -f -c apropos -s V -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
|
|
||||||
#apt-build
|
#apt-build
|
||||||
complete -c apt-build -l help -d "apt-build command help"
|
complete -c apt-build -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-build -a update -d "update list of packages"
|
complete -f -c apt-build -a update -d (_ "Update list of packages")
|
||||||
complete -f -c apt-build -a upgrade -d "upgrade packages"
|
complete -f -c apt-build -a upgrade -d (_ "Upgrade packages")
|
||||||
complete -f -c apt-bulid -a world -d "rebuild your system"
|
complete -f -c apt-bulid -a world -d (_ "Rebuild your system")
|
||||||
complete -x -c apt-build -a install -d "build and install a new pkg"
|
complete -x -c apt-build -a install -d (_ "Build and install a new package")
|
||||||
complete -x -c apt-build -a source -d "download and extract a src"
|
complete -x -c apt-build -a source -d (_ "Download and extract a source")
|
||||||
complete -x -c apt-build -a info -d "info on a pkg"
|
complete -x -c apt-build -a info -d (_ "Info on a package")
|
||||||
complete -x -c apt-build -a remove -d "remove packages"
|
complete -x -c apt-build -a remove -d (_ "Remove packages")
|
||||||
complete -x -c apt-build -a clean-build -d "erase built pkgs"
|
complete -x -c apt-build -a clean-build -d (_ "Erase built packages")
|
||||||
complete -x -c apt-build -a build-source -d "build src without install"
|
complete -x -c apt-build -a build-source -d (_ "Build source without install")
|
||||||
complete -x -c apt-build -a clean-sources -d "clean src dirs"
|
complete -x -c apt-build -a clean-sources -d (_ "Clean source directories")
|
||||||
complete -x -c apt-build -a update-source -d "update src and rebuild them"
|
complete -x -c apt-build -a update-source -d (_ "Update source and rebuild")
|
||||||
complete -x -c apt-build -a update-repository -d "update the repository"
|
complete -x -c apt-build -a update-repository -d (_ "Update the repository")
|
||||||
complete -f -c apt-build -l nowrapper -d "do not use gcc wrapper"
|
complete -f -c apt-build -l nowrapper -d (_ "Do not use gcc wrapper")
|
||||||
complete -f -c apt-build -l remove-builddep -d "remove build-dep"
|
complete -f -c apt-build -l remove-builddep -d (_ "Remove build-dep")
|
||||||
complete -f -c apt-build -l no-source -d "do not download source"
|
complete -f -c apt-build -l no-source -d (_ "Do not download source")
|
||||||
complete -f -c apt-build -l build-dir -d "specify build-dir"
|
complete -f -c apt-build -l build-dir -d (_ "Specify build-dir")
|
||||||
complete -f -c apt-build -l rebuild -d "rebuild a package"
|
complete -f -c apt-build -l rebuild -d (_ "Rebuild a package")
|
||||||
complete -f -c apt-build -l reinstall -d "rebuild and install an installed pkg"
|
complete -f -c apt-build -l reinstall -d (_ "Rebuild and install an installed package")
|
||||||
complete -r -f -c apt-build -l build-command -d "use <command> to build"
|
complete -r -f -c apt-build -l build-command -d (_ "Use <command> to build")
|
||||||
complete -r -c apt-build -l patch -d "apply <file> patch"
|
complete -r -c apt-build -l patch -d (_ "Apply <file> patch")
|
||||||
complete -c apt-build -s p -l patch-strip -d "prefix to strip on patch"
|
complete -c apt-build -s p -l patch-strip -d (_ "Prefix to strip on patch")
|
||||||
complete -c apt-build -s y -l yes -d "assume yes"
|
complete -c apt-build -s y -l yes -d (_ "Assume yes to all questions")
|
||||||
complete -c apt-build -l purge -d "use purge instead of remove"
|
complete -c apt-build -l purge -d (_ "Use purge instead of remove")
|
||||||
complete -c apt-build -l noupdate -d "do not run update"
|
complete -c apt-build -l noupdate -d (_ "Do not run update")
|
||||||
complete -r -c apt-build -l source-list -d "specify sources.list file"
|
complete -r -c apt-build -l source-list -d (_ "Specify sources.list file")
|
||||||
complete -f -c apt-build -s v -l version -d "show version"
|
complete -f -c apt-build -s v -l version -d (_ "Display version and exit")
|
||||||
|
|||||||
@@ -1,33 +1,31 @@
|
|||||||
#apt-cache
|
#apt-cache
|
||||||
complete -c apt-cache -s h -l help -d "apt-cache command help"
|
complete -c apt-cache -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c apt-cache -a add -d "add index files Debug only"
|
complete -f -c apt-cache -a gencaches -d (_ "Build apt cache")
|
||||||
complete -f -c apt-cache -a gencaches -d "build apt cache"
|
complete -x -c apt-cache -a showpkg -d (_ "Show package info")
|
||||||
complete -x -c apt-cache -a showpkg -d "show package info"
|
complete -f -c apt-cache -a stats -d (_ "Show cache statistics")
|
||||||
complete -f -c apt-cache -a stats -d "show cache statistics"
|
complete -x -c apt-cache -a showsrc -d (_ "Show source package")
|
||||||
complete -x -c apt-cache -a showsrc -d "show source package"
|
complete -f -c apt-cache -a dump -d (_ "Show packages in cache")
|
||||||
complete -f -c apt-cache -a dump -d "show packages in cache"
|
complete -f -c apt-cache -a dumpavail -d (_ "Print available list")
|
||||||
complete -f -c apt-cache -a dumpavail -d "print available list"
|
complete -f -c apt-cache -a unmet -d (_ "List unmet dependencies in cache")
|
||||||
complete -f -c apt-cache -a unmet -d "list unmet dep in cache"
|
complete -x -c apt-cache -a show -d (_ "Display package record")
|
||||||
complete -x -c apt-cache -a show -d "display package record"
|
complete -x -c apt-cache -a search -d (_ "Search packagename by REGEX")
|
||||||
complete -x -c apt-cache -a search -d "search pkgname by REGEX"
|
complete -c apt-cache -l full -a search -d (_ "Search full package name")
|
||||||
complete -c apt-cache -l full -a search -d "search full package name"
|
complete -x -c apt-cache -l names-only -a search -d (_ "Search packagename only")
|
||||||
complete -x -c apt-cache -l names-only -a search -d "search pkgname only"
|
complete -x -c apt-cache -a depends -d (_ "List dependencies for the package")
|
||||||
complete -x -c apt-cache -a depends -d "list dep for the package"
|
complete -x -c apt-cache -a rdepends -d (_ "List reverse dependencies for the package")
|
||||||
complete -x -c apt-cache -a rdepends -d "list reverse dep for the package"
|
complete -x -c apt-cache -a pkgnames -d (_ "Print package name by prefix")
|
||||||
complete -x -c apt-cache -a pkgnames -d "print package name by prefix"
|
complete -x -c apt-cache -a dotty -d (_ "Generate dotty output for packages")
|
||||||
complete -x -c apt-cache -a dotty -d "generate dotty output for packages"
|
complete -x -c apt-cache -a policy -d (_ "Debug preferences file")
|
||||||
complete -x -c apt-cache -a policy -d "debug preferences file"
|
complete -r -c apt-cache -s p -l pkg-cache -d (_ "Select file to store package cache")
|
||||||
complete -x -c apt-cache -a madison -d "mimic madison"
|
complete -r -c apt-cache -s s -l src-cache -d (_ "Select file to store source cache")
|
||||||
complete -r -c apt-cache -s p -l pkg-cache -d "select file to store pkg cache"
|
complete -f -c apt-cache -s q -l quiet -d (_ "Quiet mode")
|
||||||
complete -r -c apt-cache -s s -l src-cache -d "select file to store src cache"
|
complete -f -c apt-cache -s i -l important -d (_ "Print important dependencies")
|
||||||
complete -f -c apt-cache -s q -l quiet -d "quiet output"
|
complete -f -c apt-cache -s a -l all-versions -d (_ "Print full records")
|
||||||
complete -f -c apt-cache -s i -l important -d "print important deps"
|
complete -f -c apt-cache -s g -l generate -d (_ "Auto-gen package cache")
|
||||||
complete -f -c apt-cache -s a -l all-versions -d "print full records"
|
complete -f -c apt-cache -l all-names -d (_ "Print all names")
|
||||||
complete -f -c apt-cache -s g -l generate -d "auto-gen package cache"
|
complete -f -c apt-cache -l recurse -d (_ "Dep and rdep recursive")
|
||||||
complete -f -c apt-cache -l all-names -d "print all names"
|
complete -f -c apt-cache -l installed -d (_ "Limit to installed")
|
||||||
complete -f -c apt-cache -l recurse -d "dep and rdep recursive"
|
complete -f -c apt-cache -s v -l version -d (_ "Display version and exit")
|
||||||
complete -f -c apt-cache -l installed -d "limit to installed"
|
complete -r -c apt-cache -s c -l config-file -d (_ "Specify config file")
|
||||||
complete -f -c apt-cache -s v -l version -d "show version"
|
complete -x -c apt-cache -s o -l option -d (_ "Specify options")
|
||||||
complete -r -c apt-cache -s c -l config-file -d "specify config file"
|
|
||||||
complete -x -c apt-cache -s o -l option -d "specify options"
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#apt-cdrom
|
#apt-cdrom
|
||||||
complete -c apt-cdrom -s h -l help -d "apt-cdrom command help"
|
complete -c apt-cdrom -s h -l help -d (_ "Display help and exit")
|
||||||
complete -r -c apt-cdrom -a add -d "add new disc to source list"
|
complete -r -c apt-cdrom -a add -d (_ "Add new disc to source list")
|
||||||
complete -x -c apt-cdrom -a ident -d "report identity of disc"
|
complete -x -c apt-cdrom -a ident -d (_ "Report identity of disc")
|
||||||
complete -r -c apt-cdrom -s d -l cdrom -d "mount point"
|
complete -r -c apt-cdrom -s d -l cdrom -d (_ "Mount point")
|
||||||
complete -f -c apt-cdrom -s r -l rename -d "rename a disc"
|
complete -f -c apt-cdrom -s r -l rename -d (_ "Rename a disc")
|
||||||
complete -f -c apt-cdrom -s m -l no-mount -d "no mounting"
|
complete -f -c apt-cdrom -s m -l no-mount -d (_ "No mounting")
|
||||||
complete -f -c apt-cdrom -s f -l fast -d "fast copy"
|
complete -f -c apt-cdrom -s f -l fast -d (_ "Fast copy")
|
||||||
complete -f -c apt-cdrom -s a -l thorough -d "thorough pkg scan"
|
complete -f -c apt-cdrom -s a -l thorough -d (_ "Thorough package scan")
|
||||||
complete -f -c apt-cdrom -s n -l no-act -d "no changes"
|
complete -f -c apt-cdrom -s n -l no-act -d (_ "No changes")
|
||||||
complete -f -c apt-cdrom -s v -l version -d "show version"
|
complete -f -c apt-cdrom -s v -l version -d (_ "Display version and exit")
|
||||||
complete -r -c apt-cdrom -s c -l config-file -d "specify config file"
|
complete -r -c apt-cdrom -s c -l config-file -d (_ "Specify config file")
|
||||||
complete -x -c apt-cdrom -s o -l option -d "specify options"
|
complete -x -c apt-cdrom -s o -l option -d (_ "Specify options")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#apt-config
|
#apt-config
|
||||||
complete -c apt-config -s h -l help -d "apt-config command help"
|
complete -c apt-config -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c apt-config -a shell -d "access config file from shell"
|
complete -c apt-config -a shell -d (_ "Access config file from shell")
|
||||||
complete -f -c apt-config -a dump -d "dump contents of config file"
|
complete -f -c apt-config -a dump -d (_ "Dump contents of config file")
|
||||||
complete -f -c apt-config -s v -l version -d "show version"
|
complete -f -c apt-config -s v -l version -d (_ "Display version and exit")
|
||||||
complete -r -c apt-config -s c -l config-file -d "specify config file"
|
complete -r -c apt-config -s c -l config-file -d (_ "Specify config file")
|
||||||
complete -x -c apt-config -s o -l option -d "specify options"
|
complete -x -c apt-config -s o -l option -d (_ "Specify options")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#apt-extracttemplates
|
#apt-extracttemplates
|
||||||
complete -c apt-extracttemplates -s h -l help -d "apt-extracttemplates command help"
|
complete -c apt-extracttemplates -s h -l help -d (_ "Display help and exit")
|
||||||
complete -r -c apt-extracttemplates -s t -d "set temp dir"
|
complete -r -c apt-extracttemplates -s t -d (_ "Set temp dir")
|
||||||
complete -r -c apt-extracttemplates -s c -d "specifiy config file"
|
complete -r -c apt-extracttemplates -s c -d (_ "Specifiy config file")
|
||||||
complete -r -c apt-extracttemplates -s o -d "specify options"
|
complete -r -c apt-extracttemplates -s o -d (_ "Specify options")
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
#apt-file
|
#apt-file
|
||||||
complete -c apt-file -s h -l help -d "apt-file command help"
|
complete -c apt-file -s h -l help -d (_ "Display help and exit")
|
||||||
complete -x -c apt-file -a update -d "resync pkg contents from source"
|
complete -x -c apt-file -a update -d (_ "Resync package contents from source")
|
||||||
complete -r -c apt-file -a search -d "search pkg containing pattern"
|
complete -r -c apt-file -a search -d (_ "Search package containing pattern")
|
||||||
complete -r -c apt-file -a list -d "list contents of a pkg matching pattern"
|
complete -r -c apt-file -a list -d (_ "List contents of a package matching pattern")
|
||||||
complete -x -c apt-file -a purge -d "remove all gz files from cache"
|
complete -x -c apt-file -a purge -d (_ "Remove all gz files from cache")
|
||||||
complete -r -c apt-file -s c -l cache -d "set cache dir"
|
complete -r -c apt-file -s c -l cache -d (_ "Set cache dir")
|
||||||
complete -f -c apt-file -s v -l verbose -d "run in verbose"
|
complete -f -c apt-file -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete -c apt-file -s d -l cdrom-mount -d "use cdrom-mount-point"
|
complete -c apt-file -s d -l cdrom-mount -d (_ "Use cdrom-mount-point")
|
||||||
complete -f -c apt-file -s i -l ignore-case -d "do not expand pattern"
|
complete -f -c apt-file -s i -l ignore-case -d (_ "Do not expand pattern")
|
||||||
complete -f -c apt-file -s x -l regexp -d "pattern is regexp"
|
complete -f -c apt-file -s x -l regexp -d (_ "Pattern is regexp")
|
||||||
complete -f -c apt-file -s V -l version -d "show version"
|
complete -f -c apt-file -s V -l version -d (_ "Display version and exit")
|
||||||
complete -f -c apt-file -s a -l architecture -d "set arch"
|
complete -f -c apt-file -s a -l architecture -d (_ "Set arch")
|
||||||
complete -r -c apt-file -s s -l sources-list -a "(ls /etc/apt)" -d "set sources.list file"
|
complete -r -c apt-file -s s -l sources-list -a "(ls /etc/apt)" -d (_ "Set sources.list file")
|
||||||
complete -f -c apt-file -s l -l package-only -d "only display pkg name"
|
complete -f -c apt-file -s l -l package-only -d (_ "Only display package name")
|
||||||
complete -f -c apt-file -s F -l fixed-string -d "do not expand pattern"
|
complete -f -c apt-file -s F -l fixed-string -d (_ "Do not expand pattern")
|
||||||
complete -f -c apt-file -s y -l dummy -d "run in dummy mode"
|
complete -f -c apt-file -s y -l dummy -d (_ "Run in dummy mode")
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
#apt-ftparchive
|
#apt-ftparchive
|
||||||
complete -c apt-ftparchive -s h -l help -d "apt-ftparchive command help"
|
complete -c apt-ftparchive -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-ftparchive -a packages -d "generate pkg from source"
|
complete -f -c apt-ftparchive -a packages -d (_ "Generate package from source")
|
||||||
complete -f -c apt-ftparchive -a sources -d "generate source index file"
|
complete -f -c apt-ftparchive -a sources -d (_ "Generate source index file")
|
||||||
complete -f -c apt-ftparchive -a contents -d "generate contents file"
|
complete -f -c apt-ftparchive -a contents -d (_ "Generate contents file")
|
||||||
complete -f -c apt-ftparchive -a release -d "generate release file"
|
complete -f -c apt-ftparchive -a release -d (_ "Generate release file")
|
||||||
complete -f -c apt-ftparchive -a clean -d "remove records"
|
complete -f -c apt-ftparchive -a clean -d (_ "Remove records")
|
||||||
complete -f -c apt-ftparchive -l md5 -d "generate MD5 sums"
|
complete -f -c apt-ftparchive -l md5 -d (_ "Generate MD5 sums")
|
||||||
complete -f -c apt-ftparchive -s d -l db -d "use a binary db"
|
complete -f -c apt-ftparchive -s d -l db -d (_ "Use a binary db")
|
||||||
complete -f -c apt-ftparchive -s q -l quiet -d "quiet mode"
|
complete -f -c apt-ftparchive -s q -l quiet -d (_ "Quiet mode")
|
||||||
complete -f -c apt-ftparchive -l delink -d "perform delinking"
|
complete -f -c apt-ftparchive -l delink -d (_ "Perform delinking")
|
||||||
complete -f -c apt-ftparchive -l contents -d "perform contents generation"
|
complete -f -c apt-ftparchive -l contents -d (_ "Perform contents generation")
|
||||||
complete -c apt-ftparchive -s s -l source-override -d "use source override"
|
complete -c apt-ftparchive -s s -l source-override -d (_ "Use source override")
|
||||||
complete -f -c apt-ftparchive -l readonly -d "make caching db readonly"
|
complete -f -c apt-ftparchive -l readonly -d (_ "Make caching db readonly")
|
||||||
complete -f -c apt-ftparchive -s v -l version -d "show version"
|
complete -f -c apt-ftparchive -s v -l version -d (_ "Display version and exit")
|
||||||
complete -r -c apt-ftparchive -s c -l config-file -d "use config file"
|
complete -r -c apt-ftparchive -s c -l config-file -d (_ "Use config file")
|
||||||
complete -r -c apt-ftparchive -s o -l option -d "set config options"
|
complete -r -c apt-ftparchive -s o -l option -d (_ "Set config options")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#completion for apt-get
|
#completion for apt-get
|
||||||
|
|
||||||
function __fish_apt_no_subcommand -d "test if apt has yet to be given the subcommand"
|
function __fish_apt_no_subcommand -d (_ 'Test if apt has yet to be given the subcommand')
|
||||||
for i in (commandline -opc)
|
for i in (commandline -opc)
|
||||||
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove source build-dep check clean autoclean
|
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove source build-dep check clean autoclean
|
||||||
return 1
|
return 1
|
||||||
@@ -9,7 +9,7 @@ function __fish_apt_no_subcommand -d "test if apt has yet to be given the subcom
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_apt_use_package -d "Test if apt command should have packages as potential completion"
|
function __fish_apt_use_package -d (_ 'Test if apt command should have packages as potential completion')
|
||||||
for i in (commandline -opc)
|
for i in (commandline -opc)
|
||||||
if contains -- $i contains install remove build-dep
|
if contains -- $i contains install remove build-dep
|
||||||
return 0
|
return 0
|
||||||
@@ -18,47 +18,47 @@ function __fish_apt_use_package -d "Test if apt command should have packages as
|
|||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -c apt-get -n "__fish_apt_use_package" -a "(__fish_print_packages)" -d "Package"
|
complete -c apt-get -n '__fish_apt_use_package' -a '(__fish_print_packages)' -d (_ 'Package')
|
||||||
|
|
||||||
complete -c apt-get -s h -l help -d "apt-get command help"
|
complete -c apt-get -s h -l help -d (_ 'Display help and exit')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "update" -d "update sources"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'update' -d (_ 'Update sources')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "upgrade" -d "upgrade or install newest packages"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'upgrade' -d (_ 'Upgrade or install newest packages')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "dselect-upgrade" -d "use with dselect front-end"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dselect-upgrade' -d (_ 'Use with dselect front-end')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "dist-upgrade" -d "distro upgrade"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dist-upgrade' -d (_ 'Distro upgrade')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "install" -d "install one or more packages"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'install' -d (_ 'Install one or more packages')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "remove" -d "remove one or more packages"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'remove' -d (_ 'Remove one or more packages')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "source" -d "fetch source packages"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'source' -d (_ 'Fetch source packages')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "build-dep" -d "install/remove packages for dependencies"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'build-dep' -d (_ 'Install/remove packages for dependencies')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "check" -d "update cache and check dep"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'check' -d (_ 'Update cache and check dependencies')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "clean" -d "clean local caches and packages"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'clean' -d (_ 'Clean local caches and packages')
|
||||||
complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "autoclean" -d "clean packages no longer be downloaded"
|
complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'autoclean' -d (_ 'Clean packages no longer be downloaded')
|
||||||
complete -c apt-get -s d -l download-only -d "Download Only"
|
complete -c apt-get -s d -l download-only -d (_ 'Download Only')
|
||||||
complete -c apt-get -s f -l fix-broken -d "correct broken deps"
|
complete -c apt-get -s f -l fix-broken -d (_ 'Correct broken dependencies')
|
||||||
complete -c apt-get -s m -l fix-missing -d "ignore missing packages"
|
complete -c apt-get -s m -l fix-missing -d (_ 'Ignore missing packages')
|
||||||
complete -c apt-get -l no-download -d "Disable downloading packages"
|
complete -c apt-get -l no-download -d (_ 'Disable downloading packages')
|
||||||
complete -c apt-get -s q -l quiet -d "quiet output"
|
complete -c apt-get -s q -l quiet -d (_ 'Quiet mode')
|
||||||
complete -c apt-get -s s -l simulate -d "perform a siulation"
|
complete -c apt-get -s s -l simulate -d (_ 'Perform a simulation')
|
||||||
complete -c apt-get -s y -l assume-yes -d "automatic yes to prompts"
|
complete -c apt-get -s y -l assume-yes -d (_ 'Automatic yes to prompts')
|
||||||
complete -c apt-get -s u -l show-upgraded -d "show upgraded packages"
|
complete -c apt-get -s u -l show-upgraded -d (_ 'Show upgraded packages')
|
||||||
complete -c apt-get -s V -l verbose-versions -d "show full versions for packages"
|
complete -c apt-get -s V -l verbose-versions -d (_ 'Show full versions for packages')
|
||||||
complete -c apt-get -s b -l compile -d "compile source packages"
|
complete -c apt-get -s b -l compile -d (_ 'Compile source packages')
|
||||||
complete -c apt-get -s b -l build -d "compile source packages"
|
complete -c apt-get -s b -l build -d (_ 'Compile source packages')
|
||||||
complete -c apt-get -l ignore-hold -d "ignore package Holds"
|
complete -c apt-get -l ignore-hold -d (_ 'Ignore package Holds')
|
||||||
complete -c apt-get -l no-upgrade -d "Do not upgrade packages"
|
complete -c apt-get -l no-upgrade -d (_ "Do not upgrade packages")
|
||||||
complete -c apt-get -l force-yes -d "Force yes"
|
complete -c apt-get -l force-yes -d (_ 'Force yes')
|
||||||
complete -c apt-get -l print-uris -d "print the URIs"
|
complete -c apt-get -l print-uris -d (_ 'Print the URIs')
|
||||||
complete -c apt-get -l purge -d "use purge instead of remove"
|
complete -c apt-get -l purge -d (_ 'Use purge instead of remove')
|
||||||
complete -c apt-get -l reinstall -d "reinstall packages"
|
complete -c apt-get -l reinstall -d (_ 'Reinstall packages')
|
||||||
complete -c apt-get -l list-cleanup -d "erase obsolete files"
|
complete -c apt-get -l list-cleanup -d (_ 'Erase obsolete files')
|
||||||
complete -c apt-get -s t -l target-release -d "control default input to the policy engine"
|
complete -c apt-get -s t -l target-release -d (_ 'Control default input to the policy engine')
|
||||||
complete -c apt-get -l trivial-only -d "only perform operations that are trivial"
|
complete -c apt-get -l trivial-only -d (_ 'Only perform operations that are trivial')
|
||||||
complete -c apt-get -l no-remove -d "abort if any packages are to be removed"
|
complete -c apt-get -l no-remove -d (_ 'Abort if any packages are to be removed')
|
||||||
complete -c apt-get -l only-source -d "only accept source packages"
|
complete -c apt-get -l only-source -d (_ 'Only accept source packages')
|
||||||
complete -c apt-get -l diff-only -d "download only diff file"
|
complete -c apt-get -l diff-only -d (_ 'Download only diff file')
|
||||||
complete -c apt-get -l tar-only -d "download only tar file"
|
complete -c apt-get -l tar-only -d (_ 'Download only tar file')
|
||||||
complete -c apt-get -l arch-only -d "only process arch-dep build-deps"
|
complete -c apt-get -l arch-only -d (_ 'Only process arch-dependant build-dependencies')
|
||||||
complete -c apt-get -l allow-unauthenticated -d "ignore non-authenticated packages"
|
complete -c apt-get -l allow-unauthenticated -d (_ 'Ignore non-authenticated packages')
|
||||||
complete -c apt-get -s v -l version -d "show program version"
|
complete -c apt-get -s v -l version -d (_ 'Display version and exit')
|
||||||
complete -r -c apt-get -s c -l config-file -d "specify a config file"
|
complete -r -c apt-get -s c -l config-file -d (_ 'Specify a config file')
|
||||||
complete -r -c apt-get -s o -l option -d "set a config option"
|
complete -r -c apt-get -s o -l option -d (_ 'Set a config option')
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#apt-key
|
#apt-key
|
||||||
complete -r -c apt-key -a add -d "add a new key"
|
complete -r -c apt-key -a add -d (_ "Add a new key")
|
||||||
complete -f -c apt-key -a del -d "remove a key"
|
complete -f -c apt-key -a del -d (_ "Remove a key")
|
||||||
complete -f -c apt-key -a list -d "list trusted keys"
|
complete -f -c apt-key -a list -d (_ "List trusted keys")
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
#apt-listbugs
|
#apt-listbugs
|
||||||
complete -c apt-listbugs -s h -l help -d "apt-listbugs command help"
|
complete -c apt-listbugs -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-listbugs -s s -l severity -a "critical grave" -d "set severity"
|
complete -f -c apt-listbugs -s s -l severity -a "critical grave" -d (_ "Set severity")
|
||||||
complete -f -c apt-listbugs -s T -l tag -d "Targs you want to see"
|
complete -f -c apt-listbugs -s T -l tag -d (_ "Tags you want to see")
|
||||||
complete -f -c apt-listbugs -s S -l stats -d "outstanding 'pending upload' resolved done open" -d "status you want to see"
|
complete -f -c apt-listbugs -s S -l stats -a "outstanding 'pending upload' resolved done open" -d (_ "Bug-status you want to see")
|
||||||
complete -f -c apt-listbugs -s l -l showless -d "ignore bugs in your system"
|
complete -f -c apt-listbugs -s l -l showless -d (_ "Ignore bugs in your system")
|
||||||
complete -f -c apt-listbugs -s g -l showgreater -d "ignore newer bugs than upgrade pkgs"
|
complete -f -c apt-listbugs -s g -l showgreater -d (_ "Ignore newer bugs than upgrade packages")
|
||||||
complete -f -c apt-listbugs -s D -l show-downgrade -d "bugs for downgrade pkgs"
|
complete -f -c apt-listbugs -s D -l show-downgrade -d (_ "Bugs for downgrade packages")
|
||||||
complete -f -c apt-listbugs -s H -l hostname -a "osdn.debian.or.jp" -d "Bug Tracking system"
|
complete -f -c apt-listbugs -s H -l hostname -a "osdn.debian.or.jp" -d (_ "Bug Tracking system")
|
||||||
complete -f -c apt-listbugs -s p -l port -d "specify port for web interface"
|
complete -f -c apt-listbugs -s p -l port -d (_ "Specify port for web interface")
|
||||||
complete -f -c apt-listbugs -s R -l release-critical -d "use daily bug report"
|
complete -f -c apt-listbugs -s R -l release-critical -d (_ "Use daily bug report")
|
||||||
complete -f -c apt-listbugs -s I -l index -d "use the raw index.db"
|
complete -f -c apt-listbugs -s I -l index -d (_ "Use the raw index.db")
|
||||||
complete -f -c apt-listbugs -s X -l indexdir -d "specify index dir"
|
complete -f -c apt-listbugs -s X -l indexdir -d (_ "Specify index dir")
|
||||||
complete -f -c apt-listbugs -s P -l pin-priority -d "specify Pin-Priority value"
|
complete -f -c apt-listbugs -s P -l pin-priority -d (_ "Specify Pin-Priority value")
|
||||||
complete -f -c apt-listbugs -l title -d "specify the title of rss"
|
complete -f -c apt-listbugs -l title -d (_ "Specify the title of rss")
|
||||||
complete -f -c apt-listbugs -s f -l force-download -d "retrieve fresh bugs"
|
complete -f -c apt-listbugs -s f -l force-download -d (_ "Retrieve fresh bugs")
|
||||||
complete -f -c apt-listbugs -s q -l quiet -d "do not display progress bar"
|
complete -f -c apt-listbugs -s q -l quiet -d (_ "Do not display progress bar")
|
||||||
complete -f -c apt-listbugs -s c -l cache-dir -a "/var/cache/apt-listbugs/" -d "specify local cache dir"
|
complete -f -c apt-listbugs -s c -l cache-dir -a "/var/cache/apt-listbugs/" -d (_ "Specify local cache dir")
|
||||||
complete -f -c apt-listbugs -s t -l timer -d "specify the expire cache timer"
|
complete -f -c apt-listbugs -s t -l timer -d (_ "Specify the expire cache timer")
|
||||||
complete -c apt-listbugs -s C -l aptconf -d "specify apt config file"
|
complete -c apt-listbugs -s C -l aptconf -d (_ "Specify apt config file")
|
||||||
complete -f -c apt-listbugs -s y -l force-yes -d "assume all yes"
|
complete -f -c apt-listbugs -s y -l force-yes -d (_ "Assume yes to all questions")
|
||||||
complete -f -c apt-listbugs -s n -l force-no -d "assume all no"
|
complete -f -c apt-listbugs -s n -l force-no -d (_ "Assume no to all questions")
|
||||||
complete -c apt-listbugs -a list -d "list bugs from pkgs"
|
complete -c apt-listbugs -a list -d (_ "List bugs from packages")
|
||||||
complete -c apt-listbugs -a rss -d "list bugs in rss format"
|
complete -c apt-listbugs -a rss -d (_ "List bugs in rss format")
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#apt-listchanges
|
#apt-listchanges
|
||||||
complete -c apt-listchanges -l help -d "apt-listchanges command help"
|
complete -c apt-listchanges -l help -d (_ "Display help and exit")
|
||||||
complete -c apt-listchanges -l apt -d "read filenames from pipe"
|
complete -c apt-listchanges -l apt -d (_ "Read filenames from pipe")
|
||||||
complete -f -c apt-listchanges -s v -l verbose -d "verbose info"
|
complete -f -c apt-listchanges -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete -f -c apt-listchanges -s f -l frontend -a "pager browser xterm-pager xterm-browser text mail none" -d "select fronend interface"
|
complete -f -c apt-listchanges -s f -l frontend -a "pager browser xterm-pager xterm-browser text mail none" -d (_ "Select fronend interface")
|
||||||
complete -r -f -c apt-listchanges -l email-address -d "specify email address"
|
complete -r -f -c apt-listchanges -l email-address -d (_ "Specify email address")
|
||||||
complete -f -c apt-listchanges -s c -l confirm -d "ask confirmation"
|
complete -f -c apt-listchanges -s c -l confirm -d (_ "Ask confirmation")
|
||||||
complete -f -c apt-listchanges -s a -l all -d "display all changelogs"
|
complete -f -c apt-listchanges -s a -l all -d (_ "Display all changelogs")
|
||||||
complete -r -c apt-listchanges -l save_seen -d "avoid changelogs from db in named file"
|
complete -r -c apt-listchanges -l save_seen -d (_ "Avoid changelogs from db in named file")
|
||||||
complete -r -f -c apt-listchanges -l which -a "news changelogs both" -d "select display"
|
complete -r -f -c apt-listchanges -l which -a "news changelogs both" -d (_ "Select display")
|
||||||
complete -f -c apt-listchanges -s h -l headers -d "insert header"
|
complete -f -c apt-listchanges -s h -l headers -d (_ "Insert header")
|
||||||
complete -f -c apt-listchanges -l debug -d "display debug info"
|
complete -f -c apt-listchanges -l debug -d (_ "Display debug info")
|
||||||
complete -r -c apt-listchanges -l profile -d "select an option profile"
|
complete -r -c apt-listchanges -l profile -d (_ "Select an option profile")
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
#apt-move
|
#apt-move
|
||||||
complete -c apt-move -a get -d "generate master file"
|
complete -c apt-move -a get -d (_ "Generate master file")
|
||||||
complete -c apt-move -a getlocal -d "alias of get"
|
complete -c apt-move -a getlocal -d (_ "Alias for 'get'")
|
||||||
complete -f -c apt-move -a move -d "move pkgs to local tree"
|
complete -f -c apt-move -a move -d (_ "Move packages to local tree")
|
||||||
complete -f -c apt-move -a delete -d "delete obsolete pkg files"
|
complete -f -c apt-move -a delete -d (_ "Delete obsolete package files")
|
||||||
complete -f -c apt-move -a packages -d "build new local files"
|
complete -f -c apt-move -a packages -d (_ "Build new local files")
|
||||||
complete -f -c apt-move -a fsck -d "rebuild index files"
|
complete -f -c apt-move -a fsck -d (_ "Rebuild index files")
|
||||||
complete -f -c apt-move -a update -d "move pkgs from cache to local mirror"
|
complete -f -c apt-move -a update -d (_ "Move packages from cache to local mirror")
|
||||||
complete -f -c apt-move -a local -d "alias to move delete packages"
|
complete -f -c apt-move -a local -d (_ "Alias for 'move delete packages'")
|
||||||
complete -f -c apt-move -a localupdate -d "alias for update"
|
complete -f -c apt-move -a localupdate -d (_ "Alias for 'update'")
|
||||||
complete -f -c apt-move -a mirror -d "download pkg missing from mirror"
|
complete -f -c apt-move -a mirror -d (_ "Download package missing from mirror")
|
||||||
complete -f -c apt-move -a sync -d "sync pkgs installed"
|
complete -f -c apt-move -a sync -d (_ "Sync packages installed")
|
||||||
complete -f -c apt-move -a exclude -d 'test $LOCALDIR/.exclude file'
|
complete -f -c apt-move -a exclude -d 'test $LOCALDIR/.exclude file'
|
||||||
complete -c apt-move -a movefile -d "move file from CLI"
|
complete -c apt-move -a movefile -d (_ "Move file specified on commandline")
|
||||||
complete -f -c apt-move -a listbin -d "mirror|sync|repo"
|
complete -f -c apt-move -a listbin -d (_ "List packags that may serve as input to mirrorbin or mirrorsource" )
|
||||||
complete -f -c apt-move -a mirrorbin -d "fetch pkg from STDIN"
|
complete -f -c apt-move -a mirrorbin -d (_ "Fetch package from STDIN")
|
||||||
complete -f -c apt-move -a mirrorsrc -d "fetch src pkg from STDIN"
|
complete -f -c apt-move -a mirrorsrc -d (_ "Fetch source package from STDIN")
|
||||||
complete -f -c apt-move -s a -d "process all pkgs"
|
complete -f -c apt-move -s a -d (_ "Process all packages")
|
||||||
complete -c apt-move -s c -d "use specific conffile"
|
complete -c apt-move -s c -d (_ "Use specific conffile")
|
||||||
complete -f -c apt-move -s d -d "use specific dist"
|
complete -f -c apt-move -s f -d (_ "Force deletion")
|
||||||
complete -f -c apt-move -s f -d "force deletion"
|
complete -f -c apt-move -s q -d (_ "Suppresses normal output")
|
||||||
complete -f -c apt-move -s q -d "suppresses normal output"
|
complete -f -c apt-move -s t -d (_ "Test run")
|
||||||
complete -f -c apt-move -s t -d "test run"
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#apt-proxy-import
|
#apt-proxy-import
|
||||||
complete -c apt-proxy-import -s h -l help -d "apt-proxy-import command help"
|
complete -c apt-proxy-import -s h -l help -d (_ 'Display help and exit')
|
||||||
complete -f -c apt-proxy-import -s V -l version -d "print version"
|
complete -f -c apt-proxy-import -s V -l version -d (_ 'Display version and exit')
|
||||||
complete -f -c apt-proxy-import -s v -l verbose -d "verbose info"
|
complete -f -c apt-proxy-import -s v -l verbose -d (_ 'Verbose mode')
|
||||||
complete -f -c apt-proxy-import -s q -l quiet -d "no message to STDOUT"
|
complete -f -c apt-proxy-import -s q -l quiet -d (_ 'No message to STDOUT')
|
||||||
complete -f -c apt-proxy-import -s r -l recursive -d "recurse into subdir"
|
complete -f -c apt-proxy-import -s r -l recursive -d (_ 'Recurse into subdir')
|
||||||
complete -r -c apt-proxy-import -s i -l import-dir -a "(ls -Fp|grep /$)" -d "dir to import"
|
complete -r -c apt-proxy-import -s i -l import-dir -a '(ls -Fp|grep /$)' -d (_ 'Dir to import')
|
||||||
complete -r -c apt-proxy-import -s u -l user -a "(__fish_complete_users)" -d "change to user"
|
complete -r -c apt-proxy-import -s u -l user -a '(__fish_complete_users)' -d (_ 'Change to user')
|
||||||
complete -r -c apt-proxy-import -s d -l debug -d "debug level[default 0]"
|
complete -r -c apt-proxy-import -s d -l debug -d (_ 'Debug level[default 0]')
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#apt-rdepends
|
#apt-rdepends
|
||||||
complete -c apt-rdepends -l help -d "apt-rdepends command help"
|
complete -c apt-rdepends -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-rdepends -s b -l build-depends -d "show bulid deps"
|
complete -f -c apt-rdepends -s b -l build-depends -d (_ "Show bulid dependencies")
|
||||||
complete -f -c apt-rdepends -s d -l dotty -d "generate a dotty graph"
|
complete -f -c apt-rdepends -s d -l dotty -d (_ "Generate a dotty graph")
|
||||||
complete -f -c apt-rdepends -s p -l print-state -d "show state of deps"
|
complete -f -c apt-rdepends -s p -l print-state -d (_ "Show state of dependencies")
|
||||||
complete -f -c apt-rdepends -s r -l reverse -d "list pkgs depending on"
|
complete -f -c apt-rdepends -s r -l reverse -d (_ "List packages depending on")
|
||||||
complete -r -f -c apt-rdepends -s f -l follow -d "only follow DEPENDS recursively"
|
complete -r -f -c apt-rdepends -s f -l follow -d (_ "Comma-separated list of dependancy types to follow recursively")
|
||||||
complete -r -f -c apt-rdepends -s s -l show -d "only show DEPENDS"
|
complete -r -f -c apt-rdepends -s s -l show -d (_ "Comma-separated list of dependancy types to show")
|
||||||
complete -r -f -c apt-rdepends -l state-follow -d "only follow STATES recursively"
|
complete -r -f -c apt-rdepends -l state-follow -d (_ "Comma-separated list of package installation states to follow recursively")
|
||||||
complete -r -f -c apt-rdepends -l state-show -d "only show STATES"
|
complete -r -f -c apt-rdepends -l state-show -d (_ "Comma-separated list of package installation states to show")
|
||||||
complete -f -c apt-rdepends -l man -d "display man page"
|
complete -f -c apt-rdepends -l man -d (_ "Display man page")
|
||||||
complete -f -c apt-rdepends -l version -d "print version"
|
complete -f -c apt-rdepends -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#apt-setup
|
#apt-setup
|
||||||
complete -c apt-setup -a probe -d "probe a CD"
|
complete -c apt-setup -a probe -d (_ "Probe a CD")
|
||||||
complete -c apt-setup -s N -d "run in noninteractive mode"
|
complete -c apt-setup -s N -d (_ "Run in noninteractive mode")
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#apt-show-source
|
#apt-show-source
|
||||||
complete -c apt-show-source -s h -l help -d "apt-show-source command help"
|
complete -c apt-show-source -s h -l help -d (_ 'Display help and exit')
|
||||||
complete -r -c apt-show-source -l status-file -d "read pkg from FILE" -f
|
complete -r -c apt-show-source -l status-file -d (_ 'Read package from file') -f
|
||||||
complete -r -c apt-show-source -o stf -d "read pkg from FILE" -f
|
complete -r -c apt-show-source -o stf -d (_ 'Read package from file') -f
|
||||||
complete -r -c apt-show-source -l list-dir -a "(ls -Fp .|grep /$) /var/lib/apt/lists" -d "specify APT list dir"
|
complete -r -c apt-show-source -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d (_ 'Specify APT list dir')
|
||||||
complete -r -c apt-show-source -o ld -a "(ls -Fp .|grep /$) /var/lib/apt/lists" -d "specify APT list dir"
|
complete -r -c apt-show-source -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d (_ 'Specify APT list dir')
|
||||||
complete -r -c apt-show-source -s p -l package -a "(apt-cache pkgnames)" -d "list PKG info"
|
complete -r -c apt-show-source -s p -l package -a '(apt-cache pkgnames)' -d (_ 'List PKG info')
|
||||||
complete -f -c apt-show-source -l version-only -d "print version only"
|
complete -f -c apt-show-source -l version-only -d (_ 'Display version and exit')
|
||||||
complete -f -c apt-show-source -s a -l all -d "print all src pkgs with version"
|
complete -f -c apt-show-source -s a -l all -d (_ 'Print all source packages with version')
|
||||||
complete -f -c apt-show-source -s v -l verbose -d "verbose message"
|
complete -f -c apt-show-source -s v -l verbose -d (_ 'Verbose mode')
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#apt-show-versions
|
#apt-show-versions
|
||||||
complete -c apt-show-source -s h -l help -d "apt-show-versions command help"
|
complete -c apt-show-source -s h -l help -d (_ 'Display help and exit')
|
||||||
complete -r -c apt-show-versions -s p -l packages -a "(apt-cache pkgnames)" -d "print PKG versions"
|
complete -r -c apt-show-versions -s p -l packages -a '(apt-cache pkgnames)' -d (_ 'Print PKG versions')
|
||||||
complete -f -c apt-show-versions -s r -l regex -d "using regex"
|
complete -f -c apt-show-versions -s r -l regex -d (_ 'Using regex')
|
||||||
complete -f -c apt-show-versions -s u -l upgradeable -d "print only upgradeable pkgs"
|
complete -f -c apt-show-versions -s u -l upgradeable -d (_ 'Print only upgradeable packages')
|
||||||
complete -f -c apt-show-versions -s a -l allversions -d "print all versions"
|
complete -f -c apt-show-versions -s a -l allversions -d (_ 'Print all versions')
|
||||||
complete -f -c apt-show-versions -s b -l brief -d "print pkg name/distro"
|
complete -f -c apt-show-versions -s b -l brief -d (_ 'Print package name/distro')
|
||||||
complete -f -c apt-show-versions -s v -l verbose -d "print verbose info"
|
complete -f -c apt-show-versions -s v -l verbose -d (_ 'Print verbose info')
|
||||||
complete -f -c apt-show-versions -s i -l initialize -d "init or update cache only"
|
complete -f -c apt-show-versions -s i -l initialize -d (_ 'Init or update cache only')
|
||||||
complete -r -c apt-show-versions -l status-file -d "read pkg from FILE"
|
complete -r -c apt-show-versions -l status-file -d (_ 'Read package from file')
|
||||||
complete -r -c apt-show-versions -o stf -d "read pkg from FILE"
|
complete -r -c apt-show-versions -o stf -d (_ 'Read package from file')
|
||||||
complete -r -c apt-show-versions -l list-dir -a "(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists" -d "specify APT list dir"
|
complete -r -c apt-show-versions -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d (_ 'Specify APT list dir')
|
||||||
complete -r -c apt-show-versions -o ld -a "(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists" -d "specify APT list dir"
|
complete -r -c apt-show-versions -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d (_ 'Specify APT list dir')
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#apt-sortpkgs
|
#apt-sortpkgs
|
||||||
complete -c apt-sortpkgs -s h -l help -d "apt-sortpkgs command help"
|
complete -c apt-sortpkgs -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-sortpkgs -s s -l source -d "use source index field"
|
complete -f -c apt-sortpkgs -s s -l source -d (_ "Use source index field")
|
||||||
complete -f -c apt-sortpkgs -s v -l version -d "show version"
|
complete -f -c apt-sortpkgs -s v -l version -d (_ "Display version and exit")
|
||||||
complete -r -c apt-sortpkgs -s c -l conf-file -d "specify conffile"
|
complete -r -c apt-sortpkgs -s c -l conf-file -d (_ "Specify conffile")
|
||||||
complete -r -f -c apt-sortpkgs -s o -l option -d "set config options"
|
complete -r -f -c apt-sortpkgs -s o -l option -d (_ "Set config options")
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
#apt-spy
|
#apt-spy
|
||||||
complete -c apt-spy -s h -d "apt-spy command help"
|
complete -c apt-spy -s h -d (_ "Display help and exit")
|
||||||
complete -f -c apt-spy -s d -a "stable testing unstable" -d "Debian distribtion"
|
complete -f -c apt-spy -s d -a "stable testing unstable" -d (_ "Debian distribtion")
|
||||||
complete -f -c apt-spy -s a -a "Africa Asia Europe North-America Oceania South-America" -d "servers in the areas"
|
complete -f -c apt-spy -s a -a "Africa Asia Europe North-America Oceania South-America" -d (_ "Servers in the areas")
|
||||||
complete -c apt-spy -s c -d "conf file"
|
complete -c apt-spy -s c -d (_ "Conf file")
|
||||||
complete -f -c apt-spy -s e -d "finish after number of servers"
|
complete -f -c apt-spy -s e -d (_ "Finish after number of servers")
|
||||||
complete -c apt-spy -s f -d "file to grab servers"
|
complete -c apt-spy -s f -d (_ "File to grab servers")
|
||||||
complete -c apt-spy -s i -d "file as input"
|
complete -c apt-spy -s i -d (_ "File as input")
|
||||||
complete -c apt-spy -s m -d "mirror-list file"
|
complete -c apt-spy -s m -d (_ "Mirror-list file")
|
||||||
complete -c apt-spy -s o -d "output sources.list file"
|
complete -c apt-spy -s o -d (_ "Output sources.list file")
|
||||||
complete -f -c apt-spy -s p -d "use proxy server"
|
complete -f -c apt-spy -s p -d (_ "Use proxy server")
|
||||||
complete -f -c apt-spy -s s -d "comma separated country list"
|
complete -f -c apt-spy -s s -d (_ "Comma separated country list")
|
||||||
complete -f -c apt-spy -s t -d "how long in sec to download"
|
complete -f -c apt-spy -s t -d (_ "How long in sec to download")
|
||||||
complete -f -c apt-spy -s u -d "custom URL to get mirror list"
|
complete -f -c apt-spy -s u -d (_ "Custom URL to get mirror list")
|
||||||
complete -c apt-spy -s w -d "write top servers to file"
|
complete -c apt-spy -s w -d (_ "Write top servers to file")
|
||||||
complete -f -c apt-spy -s n -d "number of top servers"
|
complete -f -c apt-spy -s n -d (_ "Number of top servers")
|
||||||
complete -f -c apt-spy -a "update" -d "update mirror list"
|
complete -f -c apt-spy -a "update" -d (_ "Update mirror list")
|
||||||
complete -f -c apt-spy -s v -d "version number"
|
complete -f -c apt-spy -s v -d (_ "Version number")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
#apt-src
|
#apt-src
|
||||||
complete -c apt-src -s h -l help -d "apt-src command help"
|
complete -c apt-src -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-src -a "update" -d "update list of src pkgs"
|
complete -f -c apt-src -a "update" -d (_ "Update list of source packages")
|
||||||
complete -f -c apt-src -a "install" -d "install src pkgs"
|
complete -f -c apt-src -a "install" -d (_ "Install source packages")
|
||||||
complete -f -c apt-src -a "upgrade" -d "upgrade src pkgs"
|
complete -f -c apt-src -a "upgrade" -d (_ "Upgrade source packages")
|
||||||
complete -f -c apt-src -a "remove" -d "remove src pkgs"
|
complete -f -c apt-src -a "remove" -d (_ "Remove source packages")
|
||||||
complete -f -c apt-src -a "build" -d "build src pkgs"
|
complete -f -c apt-src -a "build" -d (_ "Build source packages")
|
||||||
complete -f -c apt-src -a "clean" -d "clean src pkgs"
|
complete -f -c apt-src -a "clean" -d (_ "Clean source packages")
|
||||||
complete -f -c apt-src -a "import" -d "detect known src tree"
|
complete -f -c apt-src -a "import" -d (_ "Detect known source tree")
|
||||||
complete -f -c apt-src -a "list" -d "list installed src pkg\(s\)"
|
complete -f -c apt-src -a "list" -d (_ "List installed source package\(s\)")
|
||||||
complete -f -c apt-src -a "location" -d "root src tree"
|
complete -f -c apt-src -a "location" -d (_ "Root source tree")
|
||||||
complete -f -c apt-src -a "version" -d "version of src pkg"
|
complete -f -c apt-src -a "version" -d (_ "Version of source package")
|
||||||
complete -f -c apt-src -a "name" -d "name of the src pkg"
|
complete -f -c apt-src -a "name" -d (_ "Name of the source package")
|
||||||
complete -f -c apt-src -s b -l build -d "build src pkgs"
|
complete -f -c apt-src -s b -l build -d (_ "Build source packages")
|
||||||
complete -f -c apt-src -s i -l installdebs -d "install after build"
|
complete -f -c apt-src -s i -l installdebs -d (_ "Install after build")
|
||||||
complete -f -c apt-src -s p -l patch -d "patch local changes"
|
complete -f -c apt-src -s p -l patch -d (_ "Patch local changes")
|
||||||
complete -r -c apt-src -s l -l location -d "specify a dir"
|
complete -r -c apt-src -s l -l location -d (_ "Specify a dir")
|
||||||
complete -c apt-src -s c -l here -d "run on current dir"
|
complete -c apt-src -s c -l here -d (_ "Run on current dir")
|
||||||
complete -f -c apt-src -l upstream-version -d "omit debian version"
|
complete -f -c apt-src -l upstream-version -d (_ "Omit debian version")
|
||||||
complete -f -c apt-src -s k -l keep-built -d "do not del built files"
|
complete -f -c apt-src -s k -l keep-built -d (_ "Do not del built files")
|
||||||
complete -f -c apt-src -s n -l no-delete-source -d "do not del source files"
|
complete -f -c apt-src -s n -l no-delete-source -d (_ "Do not del source files")
|
||||||
complete -f -c apt-src -l version -d "source tree version"
|
complete -f -c apt-src -l version -d (_ "Source tree version")
|
||||||
complete -f -c apt-src -s q -l quiet -d "output to /dev/null"
|
complete -f -c apt-src -s q -l quiet -d (_ "Output to /dev/null")
|
||||||
complete -f -c apt-src -s t -l trace -d "output trace"
|
complete -f -c apt-src -s t -l trace -d (_ "Output trace")
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#apt-zip-inst
|
#apt-zip-inst
|
||||||
complete -c apt-zip-inst -s h -l help -d "apt-zip-inst command help"
|
complete -c apt-zip-inst -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-zip-inst -s V -l version -d "show version"
|
complete -f -c apt-zip-inst -s V -l version -d (_ "Display version and exit")
|
||||||
complete -c apt-zip-inst -s m -l medium -d "removable medium"
|
complete -c apt-zip-inst -s m -l medium -d (_ "Removable medium")
|
||||||
complete -f -c apt-zip-inst -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d "select an action"
|
complete -f -c apt-zip-inst -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d (_ "Select an action")
|
||||||
complete -c apt-zip-inst -s p -l packages -d "list of pkgs to install"
|
complete -c apt-zip-inst -s p -l packages -d (_ "List of packages to install")
|
||||||
complete -f -c apt-zip-inst -s f -l fix-broken -d "fix broken option"
|
complete -f -c apt-zip-inst -s f -l fix-broken -d (_ "Fix broken option")
|
||||||
complete -c apt-zip-inst -l skip-mount -d "specify a non-mountpoint dir"
|
complete -c apt-zip-inst -l skip-mount -d (_ "Specify a non-mountpoint dir")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#apt-zip-list
|
#apt-zip-list
|
||||||
complete -c apt-zip-list -s h -l help -d "apt-zip-list command help"
|
complete -c apt-zip-list -s h -l help -d (_ "Display help and exit")
|
||||||
complete -f -c apt-zip-list -s V -l version -d "show version"
|
complete -f -c apt-zip-list -s V -l version -d (_ "Display version and exit")
|
||||||
complete -c apt-zip-list -s m -l medium -d "removable medium"
|
complete -c apt-zip-list -s m -l medium -d (_ "Removable medium")
|
||||||
complete -f -c apt-zip-list -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d "select an action"
|
complete -f -c apt-zip-list -s a -l aptgetaction -a "dselect-upgrade upgrade dist-upgrade" -d (_ "Select an action")
|
||||||
complete -c apt-zip-list -s p -l packages -d "list of pkgs to install"
|
complete -c apt-zip-list -s p -l packages -d (_ "List of packages to install")
|
||||||
complete -f -c apt-zip-list -s f -l fix-broken -d "fix broken option"
|
complete -f -c apt-zip-list -s f -l fix-broken -d (_ "Fix broken option")
|
||||||
complete -c apt-zip-list -l skip-mount -d "specify a non-mountpoint dir"
|
complete -c apt-zip-list -l skip-mount -d (_ "Specify a non-mountpoint dir")
|
||||||
complete -c apt-zip-list -s M -l method -d "select a method"
|
complete -c apt-zip-list -s M -l method -d (_ "Select a method")
|
||||||
complete -c apt-zip-list -s o -l options -a "tar restart" -d "specify options"
|
complete -c apt-zip-list -s o -l options -a "tar restart" -d (_ "Specify options")
|
||||||
complete -c apt-zip-list -s A -l accept -a "http ftp" -d "accept protocols"
|
complete -c apt-zip-list -s A -l accept -a "http ftp" -d (_ "Accept protocols")
|
||||||
complete -c apt-zip-list -s R -l reject -a "http ftp" -d "reject protocols"
|
complete -c apt-zip-list -s R -l reject -a "http ftp" -d (_ "Reject protocols")
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#completion for arp
|
#completion for arp
|
||||||
complete -c arp -s v -l verbose -d "verbose mode"
|
complete -c arp -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete -c arp -s n -l numeric -d "numerical address"
|
complete -c arp -s n -l numeric -d (_ "Numerical address")
|
||||||
complete -x -c arp -s H -l tw-type -a "ether arcnet pronet ax25 netrom" -d "class of hw type"
|
complete -x -c arp -s H -l tw-type -a "ether arcnet pronet ax25 netrom" -d (_ "Class of hw type")
|
||||||
complete -c arp -s a -l display -x -a "(__fish_print_hostnames)" -d "show arp entries"
|
complete -c arp -s a -l display -x -a "(__fish_print_hostnames)" -d (_ "Show arp entries")
|
||||||
complete -x -c arp -s d -l delete -a "(__fish_print_hostnames)" -d "remove an entry for hostname"
|
complete -x -c arp -s d -l delete -a "(__fish_print_hostnames)" -d (_ "Remove an entry for hostname")
|
||||||
complete -c arp -s D -l use-device -d "use hardware address"
|
complete -c arp -s D -l use-device -d (_ "Use hardware address")
|
||||||
complete -x -c arp -s i -l device -a "(__fish_print_interfaces)" -d "select interface"
|
complete -x -c arp -s i -l device -a "(__fish_print_interfaces)" -d (_ "Select interface")
|
||||||
complete -x -c arp -s s -l set -d "Manually create ARP address" -a "(__fish_print_hostnames)"
|
complete -x -c arp -s s -l set -d (_ "Manually create ARP address") -a "(__fish_print_hostnames)"
|
||||||
complete -f -c arp -s f -l file -d "taken addr from filename, default /etc/ethers"
|
complete -f -c arp -s f -l file -d (_ "Take addr from filename, default /etc/ethers")
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#at
|
#at
|
||||||
complete -f -c at -s V -d "print version"
|
complete -f -c at -s V -d (_ "Display version and exit")
|
||||||
complete -f -c at -s q -d "use specified queue"
|
complete -f -c at -s q -d (_ "Use specified queue")
|
||||||
complete -f -c at -s m -d "send mail to user"
|
complete -f -c at -s m -d (_ "Send mail to user")
|
||||||
complete -c at -s f -x -a "(__fish_complete_suffix (commandline -ct) '' 'At job')" -d "Read job from file"
|
complete -c at -s f -x -a "(__fish_complete_suffix (commandline -ct) '' 'At job')" -d (_ "Read job from file")
|
||||||
complete -f -c at -s l -d "alias for atq"
|
complete -f -c at -s l -d (_ "Alias for atq")
|
||||||
complete -f -c at -s d -d "alias for atrm"
|
complete -f -c at -s d -d (_ "Alias for atrm")
|
||||||
complete -f -c at -s v -d "show the time"
|
complete -f -c at -s v -d (_ "Show the time")
|
||||||
complete -f -c at -s c -d "cat the jobs listed"
|
complete -f -c at -s c -d (_ "Print the jobs listed")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#atd
|
#atd
|
||||||
complete -f -c atd -s l -d "limiting load factor"
|
complete -f -c atd -s l -d (_ "Limiting load factor")
|
||||||
complete -f -c atd -s b -d "minimum interval in seconds"
|
complete -f -c atd -s b -d (_ "Minimum interval in seconds")
|
||||||
complete -f -c atd -s d -d "Debug mode"
|
complete -f -c atd -s d -d (_ "Debug mode")
|
||||||
complete -f -c atd -s s -d "process at queue only once"
|
complete -f -c atd -s s -d (_ "Process at queue only once")
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#atq
|
#atq
|
||||||
complete -f -c atq -s V -d "print version"
|
complete -f -c atq -s V -d (_ "Display version and exit")
|
||||||
complete -f -c atq -s q -d "use specified queue"
|
complete -f -c atq -s q -d (_ "Use specified queue")
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
#atrm
|
#atrm
|
||||||
complete -f -c atrm -s V -d "print version"
|
complete -f -c atrm -s V -d (_ "Display version and exit")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# Completions for the binary calculator
|
# Completions for the binary calculator
|
||||||
|
|
||||||
complete -c bc -s i -l interactive -d "Force interactive mode"
|
complete -c bc -s i -l interactive -d (_ "Force interactive mode")
|
||||||
complete -c bc -s l -l math-lib -d "Define math library"
|
complete -c bc -s l -l math-lib -d (_ "Define math library")
|
||||||
complete -c bc -s w -l warn -d "Give warnings for extensions to POSIX bc"
|
complete -c bc -s w -l warn -d (_ "Give warnings for extensions to POSIX bc")
|
||||||
complete -c bc -s s -l standard -d "Process exactly POSIX bc"
|
complete -c bc -s s -l standard -d (_ "Process exactly POSIX bc")
|
||||||
complete -c bc -s q -l quiet -d "Do not print the GNU welcome"
|
complete -c bc -s q -l quiet -d (_ "Do not print the GNU welcome")
|
||||||
complete -c bc -s v -l version -d "Display version and exit"
|
complete -c bc -s v -l version -d (_ "Display version and exit")
|
||||||
complete -c bc -s h -l help -d "Display help and exit"
|
complete -c bc -s h -l help -d (_ "Display help and exit")
|
||||||
|
|||||||
@@ -1,34 +1,33 @@
|
|||||||
# Bittorrent commands
|
# Bittorrent commands
|
||||||
|
|
||||||
for i in btdownloadcurses.py btdownloadheadless.py;
|
for i in btdownloadcurses.py btdownloadheadless.py;
|
||||||
complete -c $i -l max_uploads -x -d "Maximum uploads at once"
|
complete -c $i -l max_uploads -x -d (_ "Maximum uploads at once")
|
||||||
complete -c $i -l keepalive_interval -x -d "Number of seconds between keepalives"
|
complete -c $i -l keepalive_interval -x -d (_ "Number of seconds between keepalives")
|
||||||
complete -c $i -l download_slice_size -x -d "Bytes per request"
|
complete -c $i -l download_slice_size -x -d (_ "Bytes per request")
|
||||||
complete -c $i -l request_backlog -x -d "Requests per pipe"
|
complete -c $i -l request_backlog -x -d (_ "Requests per pipe")
|
||||||
complete -c $i -l max_message_length -x -d "Maximum length prefix encoding"
|
complete -c $i -l max_message_length -x -d (_ "Maximum length prefix encoding")
|
||||||
complete -c $i -l ip -d "IP to report to the tracker" -x -a "(__fish_print_addresses)"
|
complete -c $i -l ip -d (_ "IP to report to the tracker") -x -a "(__fish_print_addresses)"
|
||||||
complete -c $i -l minport -d "Minimum port to listen to"
|
complete -c $i -l minport -d (_ "Minimum port to listen to")
|
||||||
complete -c $i -l maxport -d "Maximum port to listen to"
|
complete -c $i -l maxport -d (_ "Maximum port to listen to")
|
||||||
complete -c $i -l responsefile -r -d "File for server response"
|
complete -c $i -l responsefile -r -d (_ "File for server response")
|
||||||
complete -c $i -l url -x -d "URL to get file from"
|
complete -c $i -l url -x -d (_ "URL to get file from")
|
||||||
complete -c $i -l saveas -r -d "Local file target"
|
complete -c $i -l saveas -r -d (_ "Local file target")
|
||||||
complete -c $i -l timeout -x -d "Time to close inactive socket"
|
complete -c $i -l timeout -x -d (_ "Time to close inactive socket")
|
||||||
complete -c $i -l timeout_check_interval -x -d "Time between checking timeouts"
|
complete -c $i -l timeout_check_interval -x -d (_ "Time between checking timeouts")
|
||||||
complete -c $i -l max_slice_length -x -d "Maximum outgoing slice length"
|
complete -c $i -l max_slice_length -x -d (_ "Maximum outgoing slice length")
|
||||||
complete -c $i -l max_rate_period -x -d "Maximum time to guess rate"
|
complete -c $i -l max_rate_period -x -d (_ "Maximum time to guess rate")
|
||||||
complete -c $i -l bind -x -d "IP to bind to locally" -a "(__fish_print_addresses)"
|
complete -c $i -l bind -x -d (_ "IP to bind to locally") -a "(__fish_print_addresses)"
|
||||||
complete -c $i -l upload_rate_fudge -x -d "time equivalent of writing to kernel-level TCP buffer"
|
complete -c $i -l display_interval -x -d (_ "Time between screen updates")
|
||||||
complete -c $i -l display_interval -x -d "Time between screen updates"
|
complete -c $i -l rerequest_interval -x -d (_ "Time to wait between requesting more peers")
|
||||||
complete -c $i -l rerequest_interval -x -d "Time to wait between requesting more peers"
|
complete -c $i -l min_peers -x -d (_ "Minimum number of peers to not do requesting")
|
||||||
complete -c $i -l min_peers -x -d "Minimum number of peers to not do requesting"
|
complete -c $i -l http_timeout -x -d (_ "Number of seconds before assuming http timeout")
|
||||||
complete -c $i -l http_timeout -x -d "Number of seconds before assuming http timeout"
|
complete -c $i -l max_initiate -x -d (_ "Number of peers at which to stop initiating new connections")
|
||||||
complete -c $i -l max_initiate -x -d "Number of peers at which to stop initiating new connections"
|
complete -c $i -l max_allow_in -x -d (_ "Maximum number of connections to allow")
|
||||||
complete -c $i -l max_allow_in -x -d "Maximum number of connections to allow"
|
complete -c $i -l check_hashes -x -d (_ "Whether to check hashes on disk")
|
||||||
complete -c $i -l check_hashes -x -d "Whether to check hashes on disk"
|
complete -c $i -l max_upload_rate -x -d (_ "Maximum kB/s to upload at")
|
||||||
complete -c $i -l max_upload_rate -x -d "Maximum kB/s to upload at"
|
complete -c $i -l snub_time -x -d (_ "Seconds to wait for data to come in before assuming choking")
|
||||||
complete -c $i -l snub_time -x -d "Seconds to wait for data to come in before assuming choking"
|
complete -c $i -l spew -x -d (_ "Whether to display diagnostic info")
|
||||||
complete -c $i -l spew -x -d "Whether to display diagnostic info"
|
complete -c $i -l rarest_first_cutoff -x -d (_ "Number of downloads at which to switch from random to rarest first")
|
||||||
complete -c $i -l rarest_first_cutoff -x -d "Number of downloads at which to switch from random to rarest first"
|
complete -c $i -l min_uploads -x -d (_ "Number of uploads to fill out to with optimistic unchokes")
|
||||||
complete -c $i -l min_uploads -x -d "Number of uploads to fill out to with optimistic unchokes"
|
complete -c $i -l report_hash_failiures -x -d (_ "Whether to inform the user that hash failures occur")
|
||||||
complete -c $i -l report_hash_failiures -x -d "Whether to inform the user that hash failures occur"
|
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ complete -c bunzip2 -x -a "(
|
|||||||
)
|
)
|
||||||
"
|
"
|
||||||
|
|
||||||
complete -c bunzip2 -s c -l stdout -d "Decompress to stdout"
|
complete -c bunzip2 -s c -l stdout -d (_ "Decompress to stdout")
|
||||||
complete -c bunzip2 -s f -l force -d "Overwrite"
|
complete -c bunzip2 -s f -l force -d (_ "Overwrite")
|
||||||
complete -c bunzip2 -s k -l keep -d "Do not overwrite"
|
complete -c bunzip2 -s k -l keep -d (_ "Do not overwrite")
|
||||||
complete -c bunzip2 -s s -l small -d "Reduce memory usage"
|
complete -c bunzip2 -s s -l small -d (_ "Reduce memory usage")
|
||||||
complete -c bunzip2 -s v -l verbose -d "Print compression ratios"
|
complete -c bunzip2 -s v -l verbose -d (_ "Print compression ratios")
|
||||||
complete -c bunzip2 -s L -l license -d "Print license"
|
complete -c bunzip2 -s L -l license -d (_ "Print license")
|
||||||
complete -c bunzip2 -s V -l version -d "Print version"
|
complete -c bunzip2 -s V -l version -d (_ "Display version and exit")
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ complete -c bzcat -x -a "(
|
|||||||
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
|
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
complete -c bzcat -s s -l small -d "Reduce memory usage"
|
complete -c bzcat -s s -l small -d (_ "Reduce memory usage")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
complete -c bzip2 -s c -l stdout -d "Compress to stdout"
|
complete -c bzip2 -s c -l stdout -d (_ "Compress to stdout")
|
||||||
complete -c bzip2 -s d -l decompress -x -a "(
|
complete -c bzip2 -s d -l decompress -x -a "(
|
||||||
__fish_complete_suffix (commandline -ct) .bz 'Compressed file'
|
__fish_complete_suffix (commandline -ct) .bz 'Compressed file'
|
||||||
__fish_complete_suffix (commandline -ct) .bz2 'Compressed file'
|
__fish_complete_suffix (commandline -ct) .bz2 'Compressed file'
|
||||||
@@ -6,14 +6,14 @@ complete -c bzip2 -s d -l decompress -x -a "(
|
|||||||
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
|
__fish_complete_suffix (commandline -ct) .tbz2 'Compressed archive'
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
complete -c bzip2 -s z -l compress -d "Compress file"
|
complete -c bzip2 -s z -l compress -d (_ "Compress file")
|
||||||
complete -c bzip2 -s t -l test -d "Check integrity"
|
complete -c bzip2 -s t -l test -d (_ "Check integrity")
|
||||||
complete -c bzip2 -s f -l force -d "Overwrite"
|
complete -c bzip2 -s f -l force -d (_ "Overwrite")
|
||||||
complete -c bzip2 -s k -l keep -d "Do not overwrite"
|
complete -c bzip2 -s k -l keep -d (_ "Do not overwrite")
|
||||||
complete -c bzip2 -s s -l small -d "Reduce memory usage"
|
complete -c bzip2 -s s -l small -d (_ "Reduce memory usage")
|
||||||
complete -c bzip2 -s q -l quiet -d "Supress errors"
|
complete -c bzip2 -s q -l quiet -d (_ "Supress errors")
|
||||||
complete -c bzip2 -s v -l verbose -d "Print compression ratios"
|
complete -c bzip2 -s v -l verbose -d (_ "Print compression ratios")
|
||||||
complete -c bzip2 -s L -l license -d "Print license"
|
complete -c bzip2 -s L -l license -d (_ "Print license")
|
||||||
complete -c bzip2 -s V -l version -d "Print version"
|
complete -c bzip2 -s V -l version -d (_ "Display version and exit")
|
||||||
complete -c bzip2 -s 1 -l fast -d "Small block size"
|
complete -c bzip2 -s 1 -l fast -d (_ "Small block size")
|
||||||
complete -c bzip2 -s 9 -l best -d "Large block size"
|
complete -c bzip2 -s 9 -l best -d (_ "Large block size")
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
complete -c cat -s A -l show-all -d "Escape all non-printing characters"
|
complete -c cat -s A -l show-all -d (_ "Escape all non-printing characters")
|
||||||
complete -c cat -s b -l number-nonblank -d "Number nonblank lines"
|
complete -c cat -s b -l number-nonblank -d (_ "Number nonblank lines")
|
||||||
complete -c cat -s e -d "Escape non-printing characters except tab"
|
complete -c cat -s e -d (_ "Escape non-printing characters except tab")
|
||||||
complete -c cat -s E -l show-ends -d "Display $ at end of line"
|
complete -c cat -s E -l show-ends -d (_ "Display \$ at end of line")
|
||||||
complete -c cat -s n -l number -d "Number all lines"
|
complete -c cat -s n -l number -d (_ "Number all lines")
|
||||||
complete -c cat -s s -l squeeze-blank -d "Never more than single blank line"
|
complete -c cat -s s -l squeeze-blank -d (_ "Never more than single blank line")
|
||||||
complete -c cat -s t -d "Escape non-printing characters except newline"
|
complete -c cat -s t -d (_ "Escape non-printing characters except newline")
|
||||||
complete -c cat -s T -l show-tabs -d "Escape tab"
|
complete -c cat -s T -l show-tabs -d (_ "Escape tab")
|
||||||
complete -c cat -s v -d "Escape non-printing except newline and tab"
|
complete -c cat -s v -d (_ "Escape non-printing except newline and tab")
|
||||||
complete -c cat -l help -d "Display help and exit"
|
complete -c cat -l help -d (_ "Display help and exit")
|
||||||
complete -c cat -l version -d "Display version and exit"
|
complete -c cat -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
complete -c chgrp -s c -l changes -d "Output diagnostic for changed files"
|
complete -c chgrp -s c -l changes -d (_ "Output diagnostic for changed files")
|
||||||
complete -c chgrp -l dereference -d "Dereferense symbolic links"
|
complete -c chgrp -l dereference -d (_ "Dereferense symbolic links")
|
||||||
complete -c chgrp -s h -l no-dereference -d "Do not dereference symbolic links"
|
complete -c chgrp -s h -l no-dereference -d (_ "Do not dereference symbolic links")
|
||||||
complete -c chgrp -l from -d "Change from owner/group"
|
complete -c chgrp -l from -d (_ "Change from owner/group")
|
||||||
complete -c chgrp -s f -l silent -d "Supress errors"
|
complete -c chgrp -s f -l silent -d (_ "Supress errors")
|
||||||
complete -c chgrp -l reference -d "Use same owner/group as file" -r
|
complete -c chgrp -l reference -d (_ "Use same owner/group as file") -r
|
||||||
complete -c chgrp -s R -l recursive -d "Operate recursively"
|
complete -c chgrp -s R -l recursive -d (_ "Operate recursively")
|
||||||
complete -c chgrp -s v -l verbose -d "Output diagnostic for every file"
|
complete -c chgrp -s v -l verbose -d (_ "Output diagnostic for every file")
|
||||||
complete -c chgrp -s h -l help -d "Display help and exit"
|
complete -c chgrp -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c chgrp -l version -d "Display version and exit"
|
complete -c chgrp -l version -d (_ "Display version and exit")
|
||||||
complete -c chgrp -d Group -a "(__fish_complete_groups)"
|
complete -c chgrp -d Group -a "(__fish_complete_groups)"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
complete -c chown -s c -l changes -d "Output diagnostic for changed files"
|
complete -c chown -s c -l changes -d (_ "Output diagnostic for changed files")
|
||||||
complete -c chown -l dereference -d "Dereferense symbolic links"
|
complete -c chown -l dereference -d (_ "Dereferense symbolic links")
|
||||||
complete -c chown -s h -l no-dereference -d "Do not dereference symbolic links"
|
complete -c chown -s h -l no-dereference -d (_ "Do not dereference symbolic links")
|
||||||
complete -c chown -l from -d "Change from owner/group"
|
complete -c chown -l from -d (_ "Change from owner/group")
|
||||||
complete -c chown -s f -l silent -d "Supress errors"
|
complete -c chown -s f -l silent -d (_ "Supress errors")
|
||||||
complete -c chown -l reference -d "Use same owner/group as file" -r
|
complete -c chown -l reference -d (_ "Use same owner/group as file") -r
|
||||||
complete -c chown -s R -l recursive -d "Operate recursively"
|
complete -c chown -s R -l recursive -d (_ "Operate recursively")
|
||||||
complete -c chown -s v -l verbose -d "Output diagnostic for every file"
|
complete -c chown -s v -l verbose -d (_ "Output diagnostic for every file")
|
||||||
complete -c chown -s h -l help -d "Display help and exit"
|
complete -c chown -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c chown -l version -d "Display version and exit"
|
complete -c chown -l version -d (_ "Display version and exit")
|
||||||
complete -c chown -d "Username" -a "(__fish_print_users):"
|
complete -c chown -d (_ "Username") -a "(__fish_print_users):"
|
||||||
complete -c chown -d "Username" -a "(echo (commandline -ct)|grep -o '.*:')(cat /etc/group |cut -d : -f 1)"
|
complete -c chown -d (_ "Username") -a "(echo (commandline -ct)|grep -o '.*:')(cat /etc/group |cut -d : -f 1)"
|
||||||
|
|||||||
10
init/completions/chsh.fish
Normal file
10
init/completions/chsh.fish
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Completions for the chsh command
|
||||||
|
#
|
||||||
|
|
||||||
|
complete -c chsh -s s -l shell -x -a "(chsh -l)" -d "Specify your login shell"
|
||||||
|
complete -c chsh -s l -l list-shells -d "Display the list of shells listed in /etc/shells and exit"
|
||||||
|
complete -c chsh -s u -l help -d "Display help and exit"
|
||||||
|
complete -c chsh -s v -l version -d "Display version and exit"
|
||||||
|
complete -x -c chsh -a "(__fish_complete_users)"
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
complete -c commandline -s a -l append -d "Add text to the end of commandline"
|
complete -c commandline -s a -l append -d (_ "Add text to the end of the selected area")
|
||||||
complete -c commandline -s i -l insert -d "Add text at cursor"
|
complete -c commandline -s i -l insert -d (_ "Add text at cursor")
|
||||||
complete -c commandline -s r -l replace -d "Replace selected part of buffer (replace)"
|
complete -c commandline -s r -l replace -d (_ "Replace selected part")
|
||||||
|
|
||||||
complete -c commandline -s j -l current-job -d "Operate only on job under cursor"
|
complete -c commandline -s j -l current-job -d (_ "Select job under cursor")
|
||||||
complete -c commandline -s p -l current-process -d "Operate only on process under cursor"
|
complete -c commandline -s p -l current-process -d (_ "Select process under cursor")
|
||||||
complete -c commandline -s t -l current-token -d "Operate only on tokenizer token under cursor"
|
complete -c commandline -s t -l current-token -d (_ "Select token under cursor")
|
||||||
complete -c commandline -s b -l current-buffer -d "Operate on entire buffer (default)"
|
complete -c commandline -s b -l current-buffer -d (_ "Select entire command line (default)")
|
||||||
|
|
||||||
complete -c commandline -s c -l cut-at-cursor -d "Only return part of commandline before the cursor"
|
complete -c commandline -s c -l cut-at-cursor -d (_ "Only return that part of the command line before the cursor")
|
||||||
complete -c commandline -s f -l function -d "Inject readline functions to reader"
|
complete -c commandline -s f -l function -d (_ "Inject readline functions to reader")
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
complete -c complete -s c -l command -d "Command to add completion to" -r
|
complete -c complete -s c -l command -d (_ "Command to add completion to") -r
|
||||||
complete -c complete -s p -l path -d "Path to add completion to"
|
complete -c complete -s p -l path -d (_ "Path to add completion to")
|
||||||
complete -c complete -s s -l short-option -d "Posix-style option to complete"
|
complete -c complete -s s -l short-option -d (_ "Posix-style option to complete")
|
||||||
complete -c complete -s l -l long-option -d "GNU-style option to complete"
|
complete -c complete -s l -l long-option -d (_ "GNU-style option to complete")
|
||||||
complete -c complete -s o -l old-option -d "Old style long option to complete"
|
complete -c complete -s o -l old-option -d (_ "Old style long option to complete")
|
||||||
complete -c complete -s f -l no-files -d "Do not use file completion"
|
complete -c complete -s f -l no-files -d (_ "Do not use file completion")
|
||||||
complete -c complete -s r -l require-parameter -d "Require parameter"
|
complete -c complete -s r -l require-parameter -d (_ "Require parameter")
|
||||||
complete -c complete -s x -l exclusive -d "Require parameter and do not use file completion"
|
complete -c complete -s x -l exclusive -d (_ "Require parameter and do not use file completion")
|
||||||
complete -c complete -s a -l arguments -d "A list of possible arguments"
|
complete -c complete -s a -l arguments -d (_ "A list of possible arguments")
|
||||||
complete -c complete -s d -l description -d "Description of this completions"
|
complete -c complete -s d -l description -d (_ "Description of this completions")
|
||||||
complete -c complete -s u -l unauthorative -d "Option list is not complete"
|
complete -c complete -s u -l unauthorative -d (_ "Option list is not complete")
|
||||||
complete -c complete -s e -l erase -d "Remove completion"
|
complete -c complete -s e -l erase -d (_ "Remove completion")
|
||||||
complete -c complete -s h -l help -d "Display help and exit"
|
complete -c complete -s h -l help -d (_ "Display help and exit")
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
complete -c configure -s h -l help -x -a "short recursive" -d "Display help and exit"
|
complete -c configure -s h -l help -x -a "short recursive" -d (_ "Display help and exit")
|
||||||
complete -c configure -s V -l version -d "Display version and exit"
|
complete -c configure -s V -l version -d (_ "Display version and exit")
|
||||||
complete -c configure -s q -l quiet -d "Be less verbose"
|
complete -c configure -s q -l quiet -d (_ "Quiet mode")
|
||||||
complete -c configure -l cache-file -f -d "Cache test results in specified file"
|
complete -c configure -l cache-file -f -d (_ "Cache test results in specified file")
|
||||||
complete -c configure -s C -l config-cache -d "Cache test results in file config.cache"
|
complete -c configure -s C -l config-cache -d (_ "Cache test results in file config.cache")
|
||||||
complete -c configure -s n -l no-create -d "Do not create output files"
|
complete -c configure -s n -l no-create -d (_ "Do not create output files")
|
||||||
complete -c configure -l srcdir -d "Set source directory" -a "__fish_complete_directory (commandline -ct)" -x
|
complete -c configure -l srcdir -d (_ "Set source directory") -a "__fish_complete_directory (commandline -ct)" -x
|
||||||
complete -c configure -l prefix -d "Architecture-independent install directory" -a "__fish_complete_directory (commandline -ct)" -x
|
complete -c configure -l prefix -d (_ "Architecture-independent install directory") -a "__fish_complete_directory (commandline -ct)" -x
|
||||||
complete -c configure -l exec-prefix -d "Architecture-dependent install directory" -a "__fish_complete_directory (commandline -ct)" -x
|
complete -c configure -l exec-prefix -d (_ "Architecture-dependent install directory") -a "__fish_complete_directory (commandline -ct)" -x
|
||||||
complete -c configure -l build -d "configure for building on BUILD" -x
|
complete -c configure -l build -d (_ "Configure for building on BUILD") -x
|
||||||
complete -c configure -l host -d "cross-compile to build programs to run on HOST" -x
|
complete -c configure -l host -d (_ "Cross-compile to build programs to run on HOST") -x
|
||||||
complete -c configure -l target -d "configure for building compilers for TARGET" -x -u
|
complete -c configure -l target -d (_ "Configure for building compilers for TARGET") -x -u
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
complete -c cut -s b -l bytes -x -d "Ouput byte range"
|
complete -c cut -s b -l bytes -x -d (_ "Ouput byte range")
|
||||||
complete -c cut -s c -l characters -x -d "Output character range"
|
complete -c cut -s c -l characters -x -d (_ "Output character range")
|
||||||
complete -c cut -s d -l delimiter -x -d "Select field delimiter"
|
complete -c cut -s d -l delimiter -x -d (_ "Select field delimiter")
|
||||||
complete -c cut -s d -l fields -x -d "Select fields"
|
complete -c cut -s d -l fields -x -d (_ "Select fields")
|
||||||
complete -c cut -s n -d "Dont split mutibyte characters"
|
complete -c cut -s n -d (_ "Dont split mutibyte characters")
|
||||||
complete -c cut -s s -l only-delimited -d "Do not print lines without delimiter"
|
complete -c cut -s s -l only-delimited -d (_ "Do not print lines without delimiter")
|
||||||
complete -c cut -l output-delimiter -d "Select output delimiter"
|
complete -c cut -l output-delimiter -d (_ "Select output delimiter")
|
||||||
complete -c cut -l help -d "Display help and exit"
|
complete -c cut -l help -d (_ "Display help and exit")
|
||||||
complete -c cut -l version -d "Display version and exit"
|
complete -c cut -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
|||||||
@@ -2,52 +2,52 @@
|
|||||||
# I don't use CVS, so these completions are probably not all that good.
|
# I don't use CVS, so these completions are probably not all that good.
|
||||||
#
|
#
|
||||||
|
|
||||||
complete -c cvs -x -a "add" -d "Add a new file/directory to the repository"
|
complete -c cvs -x -a 'add' -d (_ "Add a new file/directory to the repository")
|
||||||
complete -c cvs -x -a "admin" -d "Administration front end for rcs"
|
complete -c cvs -x -a 'admin' -d (_ "Administration front end for rcs")
|
||||||
complete -c cvs -x -a "annotate" -d "Show last revision where each line was modified"
|
complete -c cvs -x -a 'annotate' -d (_ "Show last revision where each line was modified")
|
||||||
complete -c cvs -x -a "checkout" -d "Checkout sources for editing"
|
complete -c cvs -x -a 'checkout' -d (_ "Checkout sources for editing")
|
||||||
complete -c cvs -x -a "commit" -d "Check files into the repository"
|
complete -c cvs -x -a 'commit' -d (_ "Check files into the repository")
|
||||||
complete -c cvs -x -a "diff" -d "Show differences between revisions"
|
complete -c cvs -x -a 'diff' -d (_ "Show differences between revisions")
|
||||||
complete -c cvs -x -a "edit" -d "Get ready to edit a watched file"
|
complete -c cvs -x -a 'edit' -d (_ "Get ready to edit a watched file")
|
||||||
complete -c cvs -x -a "editors" -d "See who is editing a watched file"
|
complete -c cvs -x -a 'editors' -d (_ "See who is editing a watched file")
|
||||||
complete -c cvs -x -a "export" -d "Export sources from CVS, similar to checkout"
|
complete -c cvs -x -a 'export' -d (_ "Export sources from CVS, similar to checkout")
|
||||||
complete -c cvs -x -a "history" -d "Show repository access history"
|
complete -c cvs -x -a 'history' -d (_ "Show repository access history")
|
||||||
complete -c cvs -x -a "import" -d "Import sources into CVS, using vendor branches"
|
complete -c cvs -x -a 'import' -d (_ "Import sources into CVS, using vendor branches")
|
||||||
complete -c cvs -x -a "init" -d "Create a CVS repository if it doesnt exist"
|
complete -c cvs -x -a 'init' -d (_ "Create a CVS repository if it doesnt exist")
|
||||||
complete -c cvs -x -a "kserver" -d "Kerberos server mode"
|
complete -c cvs -x -a 'kserver' -d (_ "Kerberos server mode")
|
||||||
complete -c cvs -x -a "log" -d "Print out history information for files"
|
complete -c cvs -x -a 'log' -d (_ "Print out history information for files")
|
||||||
complete -c cvs -x -a "login" -d "Prompt for password for authenticating server"
|
complete -c cvs -x -a 'login' -d (_ "Prompt for password for authenticating server")
|
||||||
complete -c cvs -x -a "logout" -d "Removes entry in .cvspass for remote repository"
|
complete -c cvs -x -a 'logout' -d (_ "Removes entry in .cvspass for remote repository")
|
||||||
complete -c cvs -x -a "pserver" -d "Password server mode"
|
complete -c cvs -x -a 'pserver' -d (_ "Password server mode")
|
||||||
complete -c cvs -x -a "rannotate" -d "Show last revision where each line of module was modified"
|
complete -c cvs -x -a 'rannotate' -d (_ "Show last revision where each line of module was modified")
|
||||||
complete -c cvs -x -a "rdiff" -d "Create 'patch' format diffs between releases"
|
complete -c cvs -x -a 'rdiff' -d (_ "Create "patch" format diffs between releases")
|
||||||
complete -c cvs -x -a "release" -d "Indicate that a Module is no longer in use"
|
complete -c cvs -x -a 'release' -d (_ "Indicate that a Module is no longer in use")
|
||||||
complete -c cvs -x -a "remove" -d "Remove an entry from the repository"
|
complete -c cvs -x -a 'remove' -d (_ "Remove an entry from the repository")
|
||||||
complete -c cvs -x -a "rlog" -d "Print out history information for a module"
|
complete -c cvs -x -a 'rlog' -d (_ "Print out history information for a module")
|
||||||
complete -c cvs -x -a "rtag" -d "Add a symbolic tag to a module"
|
complete -c cvs -x -a 'rtag' -d (_ "Add a symbolic tag to a module")
|
||||||
complete -c cvs -x -a "server" -d "Server mode"
|
complete -c cvs -x -a 'server' -d (_ "Server mode")
|
||||||
complete -c cvs -x -a "status" -d "Display status information on checked out files"
|
complete -c cvs -x -a 'status' -d (_ "Display status information on checked out files")
|
||||||
complete -c cvs -x -a "tag" -d "Add a symbolic tag to checked out version of files"
|
complete -c cvs -x -a 'tag' -d (_ "Add a symbolic tag to checked out version of files")
|
||||||
complete -c cvs -x -a "unedit" -d "Undo an edit command"
|
complete -c cvs -x -a 'unedit' -d (_ "Undo an edit command")
|
||||||
complete -c cvs -x -a "update" -d "Bring work tree in sync with repository"
|
complete -c cvs -x -a 'update' -d (_ "Bring work tree in sync with repository")
|
||||||
complete -c cvs -x -a "version" -d "Show current CVS version(s)"
|
complete -c cvs -x -a 'version' -d (_ "Display version and exit")
|
||||||
complete -c cvs -x -a "watch" -d "Set watches"
|
complete -c cvs -x -a 'watch' -d (_ "Set watches")
|
||||||
complete -c cvs -x -a "watchers" -d "See who is watching a file"
|
complete -c cvs -x -a 'watchers' -d (_ "See who is watching a file")
|
||||||
|
|
||||||
complete -c cvs -x -s H -d "Displays usage information for command"
|
complete -c cvs -x -s H -d (_ "Displays usage information for command")
|
||||||
complete -c cvs -x -s Q -d "Cause CVS to be really quiet"
|
complete -c cvs -x -s Q -d (_ "Cause CVS to be really quiet")
|
||||||
complete -c cvs -x -s q -d "Cause CVS to be somewhat quiet"
|
complete -c cvs -x -s q -d (_ "Cause CVS to be somewhat quiet")
|
||||||
complete -c cvs -x -s r -d "Make checked-out files read-only"
|
complete -c cvs -x -s r -d (_ "Make checked-out files read-only")
|
||||||
complete -c cvs -x -s w -d "Make checked-out files read-write (default)"
|
complete -c cvs -x -s w -d (_ "Make checked-out files read-write (default)")
|
||||||
complete -c cvs -x -s n -d "Do not execute anything that will change the disk"
|
complete -c cvs -x -s n -d (_ "Do not execute anything that will change the disk")
|
||||||
complete -c cvs -x -s t -d "Show trace of program execution -- try with -n"
|
complete -c cvs -x -s t -d (_ "Show trace of program execution -- try with -n")
|
||||||
complete -c cvs -x -s v -d "CVS version and copyright"
|
complete -c cvs -x -s v -d (_ "Display version and exit")
|
||||||
complete -c cvs -x -s T -r -d "Use 'tmpdir' for temporary files"
|
complete -c cvs -x -s T -r -d (_ "Use "tmpdir" for temporary files")
|
||||||
complete -c cvs -x -s e -r -d "Use 'editor' for editing log information"
|
complete -c cvs -x -s e -r -d (_ "Use "editor" for editing log information")
|
||||||
complete -c cvs -x -s d -r -d "Overrides $CVSROOT as the root of the CVS tree"
|
complete -c cvs -x -s d -r -d (_ "Overrides $CVSROOT as the root of the CVS tree")
|
||||||
complete -c cvs -x -s f -d "Do not use the ~/.cvsrc file"
|
complete -c cvs -x -s f -d (_ "Do not use the ~/.cvsrc file")
|
||||||
complete -c cvs -x -s z -d "Compression level for net traffic" -x -a "1 2 3 4 5 6 7 8 9"
|
complete -c cvs -x -s z -d (_ "Compression level for net traffic") -x -a '1 2 3 4 5 6 7 8 9'
|
||||||
complete -c cvs -x -s x -d "Encrypt all net traffic"
|
complete -c cvs -x -s x -d (_ "Encrypt all net traffic")
|
||||||
complete -c cvs -x -s a -d "Authenticate all net traffic"
|
complete -c cvs -x -s a -d (_ "Authenticate all net traffic")
|
||||||
complete -c cvs -x -s s -d "Set CVS user variable" -x
|
complete -c cvs -x -s s -d (_ "Set CVS user variable") -x
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
function __fish_use_subcommand
|
function __fish_use_subcommand
|
||||||
set -l cmd -- (commandline -poc)
|
set -l -- cmd (commandline -poc)
|
||||||
set -e cmd[1]
|
set -e cmd[1]
|
||||||
for i in $cmd
|
for i in $cmd
|
||||||
switch $i
|
switch $i
|
||||||
@@ -25,177 +25,174 @@ end
|
|||||||
# If no subcommand has been specified, complete using all available subcommands
|
# If no subcommand has been specified, complete using all available subcommands
|
||||||
#
|
#
|
||||||
|
|
||||||
complete -c darcs -n '__fish_use_subcommand' -xa "
|
complete -c darcs -n '__fish_use_subcommand' -xa 'initialize\t"'(_ "Create new project")'"'
|
||||||
initialize\t'Create new project'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'get\t"'(_ "Create a local copy of another repository")'"'
|
||||||
get\t'Create a local copy of another repository'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'add\t"'(_ "Add one or more new files or directories")'"'
|
||||||
add\t'Add one or more new files or directories'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'remove\t"'(_ "Remove one or more files or directories from the repository")'"'
|
||||||
remove\t'Remove one or more files or directories from the repository'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'mv\t"'(_ "Move/rename one or more files or directories")'"'
|
||||||
mv\t'Move/rename one or more files or directories'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'replace\t"'(_ "Replace a token with a new value for that token")'"'
|
||||||
replace\t'Replace a token with a new value for that token'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'record\t"'(_ "Save changes in the working copy to the repository as a patch")'"'
|
||||||
record\t'Save changes in the working copy to the repository as a patch'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'pull\t"'(_ "Copy and apply patches from another repository to this one")'"'
|
||||||
pull\t'Copy and apply patches from another repository to this one'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'send\t"'(_ "Send by email a bundle of one or more patches")'"'
|
||||||
send\t'Send by email a bundle of one or more patches'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'apply\t"'(_ "Apply patches (from an email bundle) to the repository")'"'
|
||||||
apply\t'Apply patches (from an email bundle) to the repository'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'push\t"'(_ "Copy and apply patches from this repository to another one")'"'
|
||||||
push\t'Copy and apply patches from this repository to another one'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'whatsnew\t"'(_ "Display unrecorded changes in the working copy")'"'
|
||||||
whatsnew\t'Display unrecorded changes in the working copy'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'changes\t"'(_ "Gives a changelog style summary of the repo history")'"'
|
||||||
changes\t'Gives a changelog style summary of the repo history'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'unrecord\t"'(_ "Remove recorded patches without changing the working copy")'"'
|
||||||
unrecord\t'Remove recorded patches without changing the working copy'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'amend-record\t"'(_ "Replace a recorded patch with a better version")'"'
|
||||||
amend-record\t'Replace a recorded patch with a better version'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'revert\t"'(_ "Revert to the recorded version (safe the first time only)" )'"'
|
||||||
revert\t'Revert to the recorded version (safe the first time only)'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'unrevert\t"'(_ "Undo the last revert (may fail if changes after the revert)")'"'
|
||||||
unrevert\t'Undo the last revert (may fail if changes after the revert)'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'unpull\t"'(_ "Opposite of pull; unsafe if the patch is not in remote repo")'"'
|
||||||
unpull\t'Opposite of pull; unsafe if the patch is not in remote repo'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'rollback\t"'(_ "Record an inverse patch without changing the working copy" )'"'
|
||||||
rollback\t'Record an inverse patch without changing the working directory'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'tag\t"'(_ "Tag the contents of the repository with a version name")'"'
|
||||||
tag\t'Tag the contents of the repository with a version name'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'setpref\t"'(_ "Set a value for a preference (test, predist, ...)")'"'
|
||||||
setpref\t'Set a value for a preference (test, predist, ...)'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'diff\t"'(_ "Create a diff between two versions of the repository")'"'
|
||||||
diff\t'Create a diff between two versions of the repository'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'annotate\t"'(_ "Display which patch last modified something")'"'
|
||||||
annotate\t'Display which patch last modified something'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'optimize\t"'(_ "Optimize the repository")'"'
|
||||||
optimize\t'Optimize the repository'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'check\t"'(_ "Check the repository for consistency")'"'
|
||||||
check\t'Check the repository for consistency'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'resolve\t"'(_ "Mark any conflicts to the working copy for manual resolution")'"'
|
||||||
resolve\t'Mark any conflicts to the working copy for manual resolution'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'dist\t"'(_ "Create a distribution tarball")'"'
|
||||||
dist\t'Create a distribution tarball'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'trackdown\t"'(_ "Locate the most recent version lacking an error")'"'
|
||||||
trackdown\t'Locate the most recent version lacking an error'
|
complete -c darcs -n '__fish_use_subcommand' -xa 'repair\t"'(_ "Repair the corrupted repository")'"'
|
||||||
repair\t'Repair the corrupted repository'
|
|
||||||
"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# These switches are universal
|
# These switches are universal
|
||||||
#
|
#
|
||||||
complete -c darcs -s h -l help -d "shows brief description of command and its arguments"
|
complete -c darcs -s h -l help -d (_ "Shows brief description of command and its arguments")
|
||||||
complete -c darcs -l disable -d "Disable this command"
|
complete -c darcs -l disable -d (_ "Disable this command")
|
||||||
complete -c darcs -l repodir -d "Specify the repository directory in which to run" -x -a '(__fish_complete_directory (commandline -ct))'
|
complete -c darcs -l repodir -d (_ "Specify the repository directory in which to run") -x -a '(__fish_complete_directory (commandline -ct))'
|
||||||
complete -c darcs -s v -l verbose -d "give verbose output"
|
complete -c darcs -s v -l verbose -d (_ "Verbose mode")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Here follows a huge list of subcommand-specific completions
|
# Here follows a huge list of subcommand-specific completions
|
||||||
#
|
#
|
||||||
|
|
||||||
set record_opt -- -c darcs -n 'contains record (commandline -poc)'
|
set -- record_opt -c darcs -n 'contains record (commandline -poc)'
|
||||||
complete $record_opt -s m -l patch-name -d "Name of patch" -x
|
complete $record_opt -s m -l patch-name -d (_ "Name of patch") -x
|
||||||
complete $record_opt -s A -l author -d "Specify author id" -x
|
complete $record_opt -s A -l author -d (_ "Specify author id") -x
|
||||||
complete $record_opt -l logfile -d "Give patch name and comment in file" -r
|
complete $record_opt -l logfile -d (_ "Give patch name and comment in file") -r
|
||||||
complete $record_opt -s a -l all -d "answer yes to all patches"
|
complete $record_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||||
complete $record_opt -s l -l look-for-adds -d "In addition to modifications, look for files that are not boring, and thus are potentially pending addition"
|
complete $record_opt -s l -l look-for-adds -d (_ "In addition to modifications, look for files that are not boring, and thus are potentially pending addition")
|
||||||
complete $record_opt -l delete-logfile -d "Delete the logfile when done"
|
complete $record_opt -l delete-logfile -d (_ "Delete the logfile when done")
|
||||||
complete $record_opt -l standard-verbosity -d "Don"\'"t give verbose output"
|
complete $record_opt -l standard-verbosity -d (_ "Don't give verbose output")
|
||||||
complete $record_opt -l no-test -d "Don"\'"t run the test script"
|
complete $record_opt -l no-test -d (_ "Don't run the test script")
|
||||||
complete $record_opt -l test -d "Run the test script"
|
complete $record_opt -l test -d (_ "Run the test script")
|
||||||
complete $record_opt -l leave-test-directory -d "Don"\'"t remove the test directory"
|
complete $record_opt -l leave-test-directory -d (_ "Don't remove the test directory")
|
||||||
complete $record_opt -l remove-test-directory -d "Remove the test directory"
|
complete $record_opt -l remove-test-directory -d (_ "Remove the test directory")
|
||||||
complete $record_opt -l compress -d "Create compressed patches"
|
complete $record_opt -l compress -d (_ "Create compressed patches")
|
||||||
complete $record_opt -l dont-compress -d "Don"\'"t create compressed patches"
|
complete $record_opt -l dont-compress -d (_ "Don't create compressed patches")
|
||||||
complete $record_opt -l pipe -d "Expect to receive input from a pipe"
|
complete $record_opt -l pipe -d (_ "Expect to receive input from a pipe")
|
||||||
complete $record_opt -l interactive -d "Prompt user interactively"
|
complete $record_opt -l interactive -d (_ "Prompt user interactively")
|
||||||
complete $record_opt -l ask-deps -d "Ask for extra dependencies"
|
complete $record_opt -l ask-deps -d (_ "Ask for extra dependencies")
|
||||||
complete $record_opt -l no-ask-deps -d "Don"\'"t ask for extra dependencies"
|
complete $record_opt -l no-ask-deps -d (_ "Don't ask for extra dependencies")
|
||||||
complete $record_opt -l edit-long-comment -d "Edit the long comment by default"
|
complete $record_opt -l edit-long-comment -d (_ "Edit the long comment by default")
|
||||||
complete $record_opt -l skip-long-comment -d "Don"\'"t give a long comment"
|
complete $record_opt -l skip-long-comment -d (_ "Don't give a long comment")
|
||||||
complete $record_opt -l prompt-long-comment -d "Prompt for whether to edit the long comment"
|
complete $record_opt -l prompt-long-comment -d (_ "Prompt for whether to edit the long comment")
|
||||||
complete $record_opt -l ignore-times -d "Don"\'"t trust the file modification times"
|
complete $record_opt -l ignore-times -d (_ "Don't trust the file modification times")
|
||||||
complete $record_opt -l dont-look-for-adds -d "Don"\'"t look for any files or directories that could be added, and don"\'"t add them automatically"
|
complete $record_opt -l dont-look-for-adds -d (_ "Don't look for any files or directories that could be added, and don't add them automatically")
|
||||||
set -e record_opt
|
set -e record_opt
|
||||||
|
|
||||||
|
|
||||||
set pull_opt -- -c darcs -n 'contains pull (commandline -poc)'
|
set -- pull_opt -c darcs -n 'contains pull (commandline -poc)'
|
||||||
complete $pull_opt -s p -l patches -d "select patches matching REGEXP" -x
|
complete $pull_opt -s p -l patches -d (_ "Select patches matching REGEXP") -x
|
||||||
complete $pull_opt -s t -l tags -d "select tags matching REGEXP" -x
|
complete $pull_opt -s t -l tags -d (_ "Select tags matching REGEXP") -x
|
||||||
complete $pull_opt -s a -l all -d "answer yes to all patches"
|
complete $pull_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||||
complete $pull_opt -s s -l summary -d "summarize changes"
|
complete $pull_opt -s s -l summary -d (_ "Summarize changes")
|
||||||
complete $pull_opt -s q -l quiet -d "suppress informational output"
|
complete $pull_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||||
complete $pull_opt -l matches -d "select patches matching PATTERN" -x
|
complete $pull_opt -l matches -d (_ "Select patches matching PATTERN") -x
|
||||||
complete $pull_opt -l external-merge -d "Use external tool to merge conflicts" -x
|
complete $pull_opt -l external-merge -d (_ "Use external tool to merge conflicts") -x
|
||||||
complete $pull_opt -l interactive -d "prompt user interactively"
|
complete $pull_opt -l interactive -d (_ "Prompt user interactively")
|
||||||
complete $pull_opt -l compress -d "create compressed patches"
|
complete $pull_opt -l compress -d (_ "Create compressed patches")
|
||||||
complete $pull_opt -l dont-compress -d "don"\'"t create compressed patches"
|
complete $pull_opt -l dont-compress -d (_ "Don't create compressed patches")
|
||||||
complete $pull_opt -l test -d "run the test script"
|
complete $pull_opt -l test -d (_ "Run the test script")
|
||||||
complete $pull_opt -l no-test -d "don"\'"t run the test script"
|
complete $pull_opt -l no-test -d (_ "Don't run the test script")
|
||||||
complete $pull_opt -l dry-run -d "don"\'"t actually take the action"
|
complete $pull_opt -l dry-run -d (_ "Don't actually take the action")
|
||||||
complete $pull_opt -l no-summary -d "don"\'"t summarize changes"
|
complete $pull_opt -l no-summary -d (_ "Don't summarize changes")
|
||||||
complete $pull_opt -l standard-verbosity -d "neither verbose nor quiet output"
|
complete $pull_opt -l standard-verbosity -d (_ "Neither verbose nor quiet output")
|
||||||
complete $pull_opt -l ignore-times -d "don"\'"t trust the file modification times"
|
complete $pull_opt -l ignore-times -d (_ "Don't trust the file modification times")
|
||||||
complete $pull_opt -l no-deps -d "don"\'"t automatically fulfill dependencies"
|
complete $pull_opt -l no-deps -d (_ "Don't automatically fulfill dependencies")
|
||||||
complete $pull_opt -l set-default -d "set default repository [DEFAULT]"
|
complete $pull_opt -l set-default -d (_ "Set default repository [DEFAULT]")
|
||||||
complete $pull_opt -l no-set-default -d "don"\'"t set default repository"
|
complete $pull_opt -l no-set-default -d (_ "Don't set default repository")
|
||||||
complete $pull_opt -l set-scripts-executable -d "make scripts executable"
|
complete $pull_opt -l set-scripts-executable -d (_ "Make scripts executable")
|
||||||
complete $pull_opt -l dont-set-scripts-executable -d "don"\'"t make scripts executable"
|
complete $pull_opt -l dont-set-scripts-executable -d (_ "Don't make scripts executable")
|
||||||
set -e pull_opt
|
set -e pull_opt
|
||||||
|
|
||||||
|
|
||||||
set apply_opt -- -c darcs -n 'contains apply (commandline -poc)'
|
set -- apply_opt -c darcs -n 'contains apply (commandline -poc)'
|
||||||
complete $apply_opt -s a -l all -d "answer yes to all patches"
|
complete $apply_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||||
complete $apply_opt -l verify -d "verify that the patch was signed by a key in PUBRING" -r
|
complete $apply_opt -l verify -d (_ "Verify that the patch was signed by a key in PUBRING") -r
|
||||||
complete $apply_opt -l verify-ssl -d "verify using openSSL with authorized keys from file "\'"KEYS"\'"" -r
|
complete $apply_opt -l verify-ssl -d (_ "Verify using openSSL with authorized keys from file 'KEYS'") -r
|
||||||
complete $apply_opt -l sendmail-command -d "specify sendmail command" -r
|
complete $apply_opt -l sendmail-command -d (_ "Specify sendmail command") -r
|
||||||
complete $apply_opt -l reply -d "reply to email-based patch using FROM address" -x
|
complete $apply_opt -l reply -d (_ "Reply to email-based patch using FROM address") -x
|
||||||
complete $apply_opt -l cc -d "mail results to additional EMAIL(s). Requires --reply" -x
|
complete $apply_opt -l cc -d (_ "Mail results to additional EMAIL(s). Requires --reply") -x
|
||||||
complete $apply_opt -l external-merge -d "Use external tool to merge conflicts" -r
|
complete $apply_opt -l external-merge -d (_ "Use external tool to merge conflicts") -r
|
||||||
complete $apply_opt -l no-verify -d "don"\'"t verify patch signature"
|
complete $apply_opt -l no-verify -d (_ "Don't verify patch signature")
|
||||||
complete $apply_opt -l standard-verbosity -d "don"\'"t give verbose output"
|
complete $apply_opt -l standard-verbosity -d (_ "Don't give verbose output")
|
||||||
complete $apply_opt -l ignore-times -d "don"\'"t trust the file modification times"
|
complete $apply_opt -l ignore-times -d (_ "Don't trust the file modification times")
|
||||||
complete $apply_opt -l compress -d "create compressed patches"
|
complete $apply_opt -l compress -d (_ "Create compressed patches")
|
||||||
complete $apply_opt -l dont-compress -d "don"\'"t create compressed patches"
|
complete $apply_opt -l dont-compress -d (_ "Don't create compressed patches")
|
||||||
complete $apply_opt -l interactive -d "prompt user interactively"
|
complete $apply_opt -l interactive -d (_ "Prompt user interactively")
|
||||||
complete $apply_opt -l mark-conflicts -d "mark conflicts"
|
complete $apply_opt -l mark-conflicts -d (_ "Mark conflicts")
|
||||||
complete $apply_opt -l allow-conflicts -d "allow conflicts, but don"\'"t mark them"
|
complete $apply_opt -l allow-conflicts -d (_ "Allow conflicts, but don't mark them")
|
||||||
complete $apply_opt -l no-resolve-conflicts -d "equivalent to --dont-allow-conflicts, for backwards compatibility"
|
complete $apply_opt -l dont-allow-conflicts -d (_ "Fail on patches that create conflicts [DEFAULT]")
|
||||||
complete $apply_opt -l dont-allow-conflicts -d "fail on patches that create conflicts [DEFAULT]"
|
complete $apply_opt -l no-test -d (_ "Don't run the test script")
|
||||||
complete $apply_opt -l no-test -d "don"\'"t run the test script"
|
complete $apply_opt -l test -d (_ "Run the test script")
|
||||||
complete $apply_opt -l test -d "run the test script"
|
complete $apply_opt -l happy-forwarding -d (_ "Forward unsigned messages without extra header")
|
||||||
complete $apply_opt -l happy-forwarding -d "forward unsigned messages without extra header"
|
complete $apply_opt -l leave-test-directory -d (_ "Don't remove the test directory")
|
||||||
complete $apply_opt -l leave-test-directory -d "don"\'"t remove the test directory"
|
complete $apply_opt -l remove-test-directory -d (_ "Remove the test directory")
|
||||||
complete $apply_opt -l remove-test-directory -d "remove the test directory"
|
complete $apply_opt -l set-scripts-executable -d (_ "Make scripts executable")
|
||||||
complete $apply_opt -l set-scripts-executable -d "make scripts executable"
|
complete $apply_opt -l dont-set-scripts-executable -d (_ "Don't make scripts executable")
|
||||||
complete $apply_opt -l dont-set-scripts-executable -d "don"\'"t make scripts executable"
|
|
||||||
set -e apply_opt
|
set -e apply_opt
|
||||||
|
|
||||||
set check_opt -- -c darcs -n 'contains check (commandline -poc)'
|
set -- check_opt -c darcs -n 'contains check (commandline -poc)'
|
||||||
complete $check_opt -s v -l verbose -d "give verbose output"
|
complete $check_opt -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete $check_opt -s q -l quiet -d "suppress informational output"
|
complete $check_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||||
complete $check_opt -l complete -d "check the entire repository"
|
complete $check_opt -l complete -d (_ "Check the entire repository")
|
||||||
complete $check_opt -l partial -d "check patches since latest checkpoint"
|
complete $check_opt -l partial -d (_ "Check patches since latest checkpoint")
|
||||||
complete $check_opt -l standard-verbosity -d "neither verbose nor quiet output"
|
complete $check_opt -l standard-verbosity -d (_ "Neither verbose nor quiet output")
|
||||||
complete $check_opt -l no-test -d "don"\'"t run the test script"
|
complete $check_opt -l no-test -d (_ "Don't run the test script")
|
||||||
complete $check_opt -l test -d "run the test script"
|
complete $check_opt -l test -d (_ "Run the test script")
|
||||||
complete $check_opt -l leave-test-directory -d "don"\'"t remove the test directory"
|
complete $check_opt -l leave-test-directory -d (_ "Don't remove the test directory")
|
||||||
complete $check_opt -l remove-test-directory -d "remove the test directory"
|
complete $check_opt -l remove-test-directory -d (_ "Remove the test directory")
|
||||||
set -e check_opt
|
set -e check_opt
|
||||||
|
|
||||||
set mv_opt -- -c darcs -n 'contains mv (commandline -poc)'
|
set -- mv_opt -c darcs -n 'contains mv (commandline -poc)'
|
||||||
complete $mv_opt -s v -l verbose -d "give verbose output"
|
complete $mv_opt -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete $mv_opt -l case-ok -d "don"\'"t refuse to add files differing only in case"
|
complete $mv_opt -l case-ok -d (_ "Don't refuse to add files differing only in case")
|
||||||
complete $mv_opt -l standard-verbosity -d "don"\'"t give verbose output"
|
complete $mv_opt -l standard-verbosity -d (_ "Don't give verbose output")
|
||||||
set -e mv_opt
|
set -e mv_opt
|
||||||
|
|
||||||
set send_opt -- -c darcs -n 'contains send (commandline -poc)'
|
set -- send_opt -c darcs -n 'contains send (commandline -poc)'
|
||||||
complete $send_opt -s v -l verbose -d "give verbose output"
|
complete $send_opt -s v -l verbose -d (_ "Verbose mode")
|
||||||
complete $send_opt -s q -l quiet -d "suppress informational output"
|
complete $send_opt -s q -l quiet -d (_ "Suppress informational output")
|
||||||
complete $send_opt -xs p -l patches -d "select patches matching REGEXP"
|
complete $send_opt -xs p -l patches -d (_ "Select patches matching REGEXP")
|
||||||
complete $send_opt -xs t -l tags -d "select tags matching REGEXP"
|
complete $send_opt -xs t -l tags -d (_ "Select tags matching REGEXP")
|
||||||
complete $send_opt -s a -l all -d "answer yes to all patches"
|
complete $send_opt -s a -l all -d (_ "Answer yes to all patches")
|
||||||
complete $send_opt -xs A -l author -d "specify author id"
|
complete $send_opt -xs A -l author -d (_ "Specify author id")
|
||||||
complete $send_opt -rs o -l output -d "specify output filename"
|
complete $send_opt -rs o -l output -d (_ "Specify output filename")
|
||||||
complete $send_opt -s u -l unified -d "output patch in a darcs-specific format similar to diff -u"
|
complete $send_opt -s u -l unified -d (_ "Output patch in a darcs-specific format similar to diff -u")
|
||||||
complete $send_opt -s s -l summary -d "summarize changes"
|
complete $send_opt -s s -l summary -d (_ "Summarize changes")
|
||||||
complete $send_opt -l standard-verbosity -d "neither verbose nor quiet output"
|
complete $send_opt -l standard-verbosity -d (_ "Neither verbose nor quiet output")
|
||||||
complete $send_opt -xl matches -d "select patches matching PATTERN"
|
complete $send_opt -xl matches -d (_ "Select patches matching PATTERN")
|
||||||
complete $send_opt -l interactive -d "prompt user interactively"
|
complete $send_opt -l interactive -d (_ "Prompt user interactively")
|
||||||
complete $send_opt -xl from -d "specify email address"
|
complete $send_opt -xl from -d (_ "Specify email address")
|
||||||
complete $send_opt -xl to -d "specify destination email"
|
complete $send_opt -xl to -d (_ "Specify destination email")
|
||||||
complete $send_opt -xl cc -d "mail results to additional EMAIL(s). Requires --reply"
|
complete $send_opt -xl cc -d (_ "Mail results to additional EMAIL(s). Requires --reply")
|
||||||
complete $send_opt -l sign -d "sign the patch with your gpg key"
|
complete $send_opt -l sign -d (_ "Sign the patch with your gpg key")
|
||||||
complete $send_opt -xl sign-as -d "sign the patch with a given keyid"
|
complete $send_opt -xl sign-as -d (_ "Sign the patch with a given keyid")
|
||||||
complete $send_opt -rl sign-ssl -d "sign the patch using openssl with a given private key"
|
complete $send_opt -rl sign-ssl -d (_ "Sign the patch using openssl with a given private key")
|
||||||
complete $send_opt -l dont-sign -d "do not sign the patch"
|
complete $send_opt -l dont-sign -d (_ "Do not sign the patch")
|
||||||
complete $send_opt -l dry-run -d "don"\'"t actually take the action"
|
complete $send_opt -l dry-run -d (_ "Don't actually take the action")
|
||||||
complete $send_opt -l no-summary -d "don"\'"t summarize changes"
|
complete $send_opt -l no-summary -d (_ "Don't summarize changes")
|
||||||
complete $send_opt -rl context -d "send to context stored in FILENAME"
|
complete $send_opt -rl context -d (_ "Send to context stored in FILENAME")
|
||||||
complete $send_opt -l edit-description -d "edit the patch bundle description"
|
complete $send_opt -l edit-description -d (_ "Edit the patch bundle description")
|
||||||
complete $send_opt -l set-default -d "set default repository [DEFAULT]"
|
complete $send_opt -l set-default -d (_ "Set default repository [DEFAULT]")
|
||||||
complete $send_opt -l no-set-default -d "don"\'"t set default repository"
|
complete $send_opt -l no-set-default -d (_ "Don't set default repository")
|
||||||
complete $send_opt -rl sendmail-command -d "specify sendmail command"
|
complete $send_opt -rl sendmail-command -d (_ "Specify sendmail command")
|
||||||
set -e send_opt
|
set -e send_opt
|
||||||
|
|
||||||
set init_opt -- -c darcs -n 'contains initialize (commandline -poc)'
|
set -- init_opt -c darcs -n 'contains initialize (commandline -poc)'
|
||||||
complete $init_opt -l plain-pristine-tree -d "Use a plain pristine tree [DEFAULT]"
|
complete $init_opt -l plain-pristine-tree -d (_ "Use a plain pristine tree [DEFAULT]")
|
||||||
complete $init_opt -l no-pristine-tree -d "Use no pristine tree"
|
complete $init_opt -l no-pristine-tree -d (_ "Use no pristine tree")
|
||||||
set -e init_opt
|
set -e init_opt
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
complete -c date -s d -l date -d "Display date described by string" -x
|
complete -c date -s d -l date -d (_ "Display date described by string") -x
|
||||||
complete -c date -s f -l file -d "Display date for each line in file" -r
|
complete -c date -s f -l file -d (_ "Display date for each line in file") -r
|
||||||
complete -c date -s I -l iso-8601 -d "Output in ISO 8601 format" -x -a "date hours minutes seconds"
|
complete -c date -s I -l iso-8601 -d (_ "Output in ISO 8601 format") -x -a "date hours minutes seconds"
|
||||||
complete -c date -s s -l set -d "Set time" -x
|
complete -c date -s s -l set -d (_ "Set time") -x
|
||||||
complete -c date -s R -l rfc-2822 -d "Output RFC-2822 compliant date string"
|
complete -c date -s R -l rfc-2822 -d (_ "Output RFC-2822 compliant date string")
|
||||||
complete -c date -s r -l reference -d "display the last modification time of file" -r
|
complete -c date -s r -l reference -d (_ "Display the last modification time of file") -r
|
||||||
complete -c date -s u -l utc -d "print or set Coordinated Universal Time"
|
complete -c date -s u -l utc -d (_ "Print or set Coordinated Universal Time")
|
||||||
complete -c date -l universal -d "print or set Coordinated Universal Time"
|
complete -c date -l universal -d (_ "Print or set Coordinated Universal Time")
|
||||||
complete -c date -s h -l help -d "Display help and exit"
|
complete -c date -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c date -s v -l version -d "Display version and exit"
|
complete -c date -s v -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,43 @@
|
|||||||
|
#
|
||||||
|
# Completions for df
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Completions for mount define the $__fish_filesystems variable
|
||||||
|
#
|
||||||
complete -y mount
|
complete -y mount
|
||||||
|
|
||||||
complete -c df -s a -l all -d "Include empty filesystems"
|
#
|
||||||
complete -c df -s B -l block-size -r -d "Block size"
|
# Test if we are using GNU sed
|
||||||
complete -c df -s h -l human-readable -d "Human readable sizes"
|
#
|
||||||
complete -c df -s H -l si -d "Human readable sizes, powers of 1000"
|
|
||||||
complete -c df -s i -l inodes -d "List inode information"
|
|
||||||
complete -c df -s k -d "Use 1KB block size"
|
|
||||||
complete -c df -s l -l local -d "List only local filesystems"
|
|
||||||
complete -c df -l no-sync -d "Do not sync before getting usage info"
|
|
||||||
complete -c df -s P -l portability -d "Use Posix format"
|
|
||||||
complete -c df -l sync -d "Sync before getting usage info"
|
|
||||||
complete -c df -s t -l type -r -d "Filesystem type" -x -a $__fish_filesystems
|
|
||||||
complete -c df -s T -l print-type -d "Print filesystem type"
|
|
||||||
complete -c df -s x -l exclude-type -d "Excluded filesystem type" -r -x -a $__fish_filesystems
|
|
||||||
complete -c df -l help -d "Display help and exit"
|
|
||||||
complete -c df -l version -d "Display version and exit"
|
|
||||||
|
|
||||||
|
set -l is_gnu
|
||||||
|
df --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
|
||||||
|
|
||||||
|
__fish_gnu_complete -c df -s h -l human-readable -d (_ "Human readable sizes") $is_gnu
|
||||||
|
__fish_gnu_complete -c df -s i -l inodes -d (_ "List inode information") $is_gnu
|
||||||
|
__fish_gnu_complete -c df -s k -d (_ "Use 1kB block size") $is_gnu
|
||||||
|
__fish_gnu_complete -c df -s l -l local -d (_ "List only local filesystems") $is_gnu
|
||||||
|
__fish_gnu_complete -c df -s P -l portability -d (_ "Use Posix format") $is_gnu
|
||||||
|
__fish_gnu_complete -c df -s t -l type -r -d (_ "Show filesystems of specified type") $is_gnu -x -a $__fish_filesystems
|
||||||
|
|
||||||
|
if test -n "$is_gnu"
|
||||||
|
|
||||||
|
complete -c df -s a -l all -d (_ "Include empty filesystems")
|
||||||
|
complete -c df -s B -l block-size -r -d (_ "Block size")
|
||||||
|
complete -c df -s H -l si -d (_ "Human readable sizes, powers of 1000")
|
||||||
|
complete -c df -l no-sync -d (_ "Do not sync before getting usage info")
|
||||||
|
complete -c df -l sync -d (_ "Sync before getting usage info")
|
||||||
|
complete -c df -s T -l print-type -d (_ "Print filesystem type")
|
||||||
|
complete -c df -s x -l exclude-type -d (_ "Excluded filesystem type") -r -x -a $__fish_filesystems
|
||||||
|
complete -c df -l help -d (_ "Display help and exit")
|
||||||
|
complete -c df -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
complete -c df -s a -d (_ "Show all filesystems")
|
||||||
|
complete -c df -s g -d (_ "Show sizes in gigabytes")
|
||||||
|
complete -c df -s m -d (_ "Show sizes in megabytes")
|
||||||
|
complete -c df -s n -d (_ "Print out the previously obtained statistics from the file systems")
|
||||||
|
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
# Completions for diff
|
# Completions for diff
|
||||||
complete -c diff -s i -l ignore-case -d "Ignore case differences"
|
complete -c diff -s i -l ignore-case -d (_ "Ignore case differences")
|
||||||
complete -c diff -l ignore-file-name-case -d "Ignore case when comparing file names"
|
complete -c diff -l ignore-file-name-case -d (_ "Ignore case when comparing file names")
|
||||||
complete -c diff -l no-ignore-file-name-case -d "Consider case when comparing file names"
|
complete -c diff -l no-ignore-file-name-case -d (_ "Consider case when comparing file names")
|
||||||
complete -c diff -s E -l ignore-tab-expansion -d "Ignore changes due to tab expansion"
|
complete -c diff -s E -l ignore-tab-expansion -d (_ "Ignore changes due to tab expansion")
|
||||||
complete -c diff -s b -l ignore-space-change -d "Ignore changes in the amount of white space"
|
complete -c diff -s b -l ignore-space-change -d (_ "Ignore changes in the amount of white space")
|
||||||
complete -c diff -s w -l ignore-all-space -d "Ignore all white space"
|
complete -c diff -s w -l ignore-all-space -d (_ "Ignore all white space")
|
||||||
complete -c diff -s B -l ignore-blank-lines -d "Ignore changes whose lines are all blank"
|
complete -c diff -s B -l ignore-blank-lines -d (_ "Ignore changes whose lines are all blank")
|
||||||
complete -c diff -s I -l ignore-matching-lines -x -d "Ignore changes whose lines match the RE"
|
complete -c diff -s I -l ignore-matching-lines -x -d (_ "Ignore changes whose lines match the REGEX")
|
||||||
complete -c diff -s a -l text -d "Treat all files as text"
|
complete -c diff -s a -l text -d (_ "Treat all files as text")
|
||||||
complete -c diff -s r -l recursive -d "Recursively compare subdirectories"
|
complete -c diff -s r -l recursive -d (_ "Recursively compare subdirectories")
|
||||||
complete -c diff -s N -l new-file -d "Treat absent files as empty"
|
complete -c diff -s N -l new-file -d (_ "Treat absent files as empty")
|
||||||
complete -c diff -s C -l context -x -d "Output NUM lines of copied context"
|
complete -c diff -s C -l context -x -d (_ "Output NUM lines of copied context")
|
||||||
complete -c diff -s c -d "Output 3 lines of copied context"
|
complete -c diff -s c -d (_ "Output 3 lines of copied context")
|
||||||
complete -c diff -s U -l unified -x -d "Output NUM lines of unified context"
|
complete -c diff -s U -l unified -x -d (_ "Output NUM lines of unified context")
|
||||||
complete -c diff -s u -d "Output 3 lines of unified context"
|
complete -c diff -s u -d (_ "Output 3 lines of unified context")
|
||||||
complete -c diff -s q -l brief -d "Output only whether the files differ"
|
complete -c diff -s q -l brief -d (_ "Output only whether the files differ")
|
||||||
complete -c diff -l normal -d "Output a normal diff"
|
complete -c diff -l normal -d (_ "Output a normal diff")
|
||||||
complete -c diff -s y -l side-by-side -d "Output in two columns"
|
complete -c diff -s y -l side-by-side -d (_ "Output in two columns")
|
||||||
complete -c diff -s W -l width -x -d "Output at most NUM print columns"
|
complete -c diff -s W -l width -x -d (_ "Output at most NUM print columns")
|
||||||
complete -c diff -s d -l minimal -d "Try to find a smaller set of changes"
|
complete -c diff -s d -l minimal -d (_ "Try to find a smaller set of changes")
|
||||||
complete -c diff -l from-file -r -d "Compare FILE1 to all operands"
|
complete -c diff -l from-file -r -d (_ "Compare FILE1 to all operands")
|
||||||
complete -c diff -l to-file -r -d "Compare FILE2 to all operands"
|
complete -c diff -l to-file -r -d (_ "Compare FILE2 to all operands")
|
||||||
complete -c diff -s l -l paginate -d "Pass the output through 'pr'"
|
complete -c diff -s l -l paginate -d (_ "Pass the output through 'pr'")
|
||||||
complete -c diff -s v -l version -d "Output version info"
|
complete -c diff -s v -l version -d (_ "Display version and exit")
|
||||||
complete -c diff -l help -d "Output usage information"
|
complete -c diff -l help -d (_ "Display help and exit")
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
complete -c du -s a -l all -d "Write size for all files"
|
complete -c du -s a -l all -d (_ "Write size for all files")
|
||||||
complete -c du -l apparent-size -d "Print file size, not disk usage"
|
complete -c du -l apparent-size -d (_ "Print file size, not disk usage")
|
||||||
complete -c du -s B -l block-size -d "Block size"
|
complete -c du -s B -l block-size -d (_ "Block size")
|
||||||
complete -c du -s b -l bytes -d "Use 1B block size"
|
complete -c du -s b -l bytes -d (_ "Use 1B block size")
|
||||||
complete -c du -s c -l total -d "Produce grand total"
|
complete -c du -s c -l total -d (_ "Produce grand total")
|
||||||
complete -c du -s D -l dereference-args -d "Dereference file symlinks"
|
complete -c du -s D -l dereference-args -d (_ "Dereference file symlinks")
|
||||||
complete -c du -s h -l human-readable -d "Human readable sizes"
|
complete -c du -s h -l human-readable -d (_ "Human readable sizes")
|
||||||
complete -c du -s H -l si -d "Human readable sizes, powers of 1000"
|
complete -c du -s H -l si -d (_ "Human readable sizes, powers of 1000")
|
||||||
complete -c du -s k -d "Use iKB block size"
|
complete -c du -s k -d (_ "Use 1kB block size")
|
||||||
complete -c du -s l -l count-links -d "Count hard links multiple times"
|
complete -c du -s l -l count-links -d (_ "Count hard links multiple times")
|
||||||
complete -c du -s L -l dereference -d "Dereference all symlinks"
|
complete -c du -s L -l dereference -d (_ "Dereference all symlinks")
|
||||||
complete -c du -s S -l separate-dirs -d "Do not include subdirectory size"
|
complete -c du -s S -l separate-dirs -d (_ "Do not include subdirectory size")
|
||||||
complete -c du -s s -l summarize -d "Display only a total for each argument"
|
complete -c du -s s -l summarize -d (_ "Display only a total for each argument")
|
||||||
complete -c du -s x -l one-file-system -d "Skip other filesystems"
|
complete -c du -s x -l one-file-system -d (_ "Skip other filesystems")
|
||||||
complete -c du -s X -l exclude-from -r -d "Exclude files thet match pattern in file"
|
complete -c du -s X -l exclude-from -r -d (_ "Exclude files thet match pattern in file")
|
||||||
complete -c du -l exclude -r -d "Exclude files that match pattern"
|
complete -c du -l exclude -r -d (_ "Exclude files that match pattern")
|
||||||
complete -c du -l max-depth -r -d "Recursion limit"
|
complete -c du -l max-depth -r -d (_ "Recursion limit")
|
||||||
complete -c du -l help -d "Display help and exit"
|
complete -c du -l help -d (_ "Display help and exit")
|
||||||
complete -c du -l version -d "Display version and exit"
|
complete -c du -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
complete -c echo -s n -d "No newline"
|
complete -c echo -s n -d (_ "No newline")
|
||||||
complete -c echo -s e -d "Use backslashe-escaped characters"
|
complete -c echo -s e -d (_ "Use backslash escaped characters")
|
||||||
complete -c echo -s E -d "Do not use backslash escaped characters"
|
complete -c echo -s E -d (_ "Do not use backslash escaped characters")
|
||||||
complete -c echo -l help -d "Display help and exit"
|
complete -c echo -l help -d (_ "Display help and exit")
|
||||||
complete -c echo -l version -d "Display version and exit"
|
complete -c echo -l version -d (_ "Display version and exit")
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#
|
#
|
||||||
# These completions are uncomplete
|
# These completions are uncomplete
|
||||||
#
|
#
|
||||||
complete -c emacs -s q -d "Do not load init files"
|
complete -c emacs -s q -d (_ "Do not load init files")
|
||||||
complete -c emacs -s u -d "Load users init file" -xa "(__fish_complete_users)"
|
complete -c emacs -s u -d (_ "Load users init file") -xa "(__fish_complete_users)"
|
||||||
complete -c emacs -s t -d "Use file as terminal" -r
|
complete -c emacs -s t -d (_ "Use file as terminal") -r
|
||||||
complete -c emacs -s f -d "Execute Lisp function" -x
|
complete -c emacs -s f -d (_ "Execute Lisp function") -x
|
||||||
complete -c emacs -s l -d "Load Lisp code from file" -r
|
complete -c emacs -s l -d (_ "Load Lisp code from file") -r
|
||||||
complete -c emacs -o nw -d "Do not use X interface"
|
complete -c emacs -o nw -d (_ "Do not use X interface")
|
||||||
complete -uc emacs -s d -o display -d "Create window on the specified display" -x
|
complete -uc emacs -s d -o display -d (_ "Create window on the specified display") -x
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
complete -c fish -s c -l "command" -d "Run fish with this command"
|
complete -c fish -s c -l "command" -d (_ "Run fish with this command")
|
||||||
complete -c fish -s h -l help -d "Display help and exit"
|
complete -c fish -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c fish -l version -d "Display version and exit"
|
complete -c fish -s v -l version -d (_ "Display version and exit")
|
||||||
complete -c fish -s i -l interactive -d "Run in interactive mode"
|
complete -c fish -s i -l interactive -d (_ "Run in interactive mode")
|
||||||
complete -c fish -s p -l profile -d "Output profiling information to specified file" -f
|
complete -c fish -s p -l profile -d (_ "Output profiling information to specified file") -f
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
complete -c function -s d -l description -d "Set function description" -x
|
complete -c function -s d -l description -d (_ "Set function description") -x
|
||||||
complete -c function -xa "(functions -n)" -d "Function"
|
complete -c function -xa "(functions -n)" -d (_ "Function")
|
||||||
complete -c function -xa "(builtin -n)" -d "Builtin"
|
complete -c function -xa "(builtin -n)" -d (_ "Builtin")
|
||||||
complete -c function -s j -l on-job-exit -d "Make the function a job exit event handler" -x
|
complete -c function -s j -l on-job-exit -d (_ "Make the function a job exit event handler") -x
|
||||||
complete -c function -s p -l on-process-exit -d "Make the function a process exit event handler" -x
|
complete -c function -s p -l on-process-exit -d (_ "Make the function a process exit event handler") -x
|
||||||
complete -c function -s s -l on-signal -d "Make the function a signal event handler" -x
|
complete -c function -s s -l on-signal -d (_ "Make the function a signal event handler") -x
|
||||||
complete -c function -s v -l on-variable -d "Make the function a variable update event handler" -x
|
complete -c function -s v -l on-variable -d (_ "Make the function a variable update event handler") -x
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
complete -c functions -s e -l erase -d "Erase function" -x -a "(functions -n)"
|
complete -c functions -s e -l erase -d (_ "Erase function") -x -a "(functions -n)"
|
||||||
complete -c functions -xa "(functions -n)" -d "Function"
|
complete -c functions -xa "(functions -na)" -d (_ "Function")
|
||||||
complete -c functions -s a -l all -d "Show hidden functions"
|
complete -c functions -s a -l all -d (_ "Show hidden functions")
|
||||||
complete -c functions -s h -l help -d "Display help and exit"
|
complete -c functions -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c functions -s d -l description -d "Set function description" -x
|
complete -c functions -s d -l description -d (_ "Set function description") -x
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# The gcc completion list is incomplete. There are just so many of them...
|
# The gcc completion list is incomplete. There are just so many of them...
|
||||||
#
|
#
|
||||||
|
|
||||||
complete -c gcc -s x -d "Language" -x -a "
|
complete -c gcc -s x -d (_ "Language") -x -a '
|
||||||
c
|
c
|
||||||
c-header
|
c-header
|
||||||
cpp-output
|
cpp-output
|
||||||
@@ -19,17 +19,17 @@ complete -c gcc -s x -d "Language" -x -a "
|
|||||||
java
|
java
|
||||||
treelang
|
treelang
|
||||||
none
|
none
|
||||||
"
|
'
|
||||||
complete -c gcc -o pass-exit-codes -d "Pass program exit codes"
|
complete -c gcc -o pass-exit-codes -d (_ "Pass program exit codes")
|
||||||
complete -c gcc -s c -d "Stop after assembler"
|
complete -c gcc -s c -d (_ "Stop after assembler")
|
||||||
complete -c gcc -s S -d "Stop after compile"
|
complete -c gcc -s S -d (_ "Stop after compile")
|
||||||
complete -c gcc -s E -d "Stop after preprocesswor"
|
complete -c gcc -s E -d (_ "Stop after preprocesswor")
|
||||||
complete -c gcc -s o -r -d "Output file"
|
complete -c gcc -s o -r -d (_ "Output file")
|
||||||
complete -c gcc -s v -d "Print commands to stderr"
|
complete -c gcc -s v -d (_ "Print commands to stderr")
|
||||||
complete -c gcc -o \#\#\# -d "Print quoted commands to stderr, do not run"
|
complete -c gcc -o \#\#\# -d (_ "Print quoted commands to stderr, do not run")
|
||||||
complete -c gcc -o pipe -d "Use pipes"
|
complete -c gcc -o pipe -d (_ "Use pipes")
|
||||||
complete -c gcc -o ansi -d "Use ansi mode"
|
complete -c gcc -o ansi -d (_ "Use ansi mode")
|
||||||
complete -c gcc -o std -d "Standard mode" -x -a '
|
complete -c gcc -o std -d (_ "Standard mode") -x -a '
|
||||||
c89\t"ISO C90"
|
c89\t"ISO C90"
|
||||||
iso9899:1990\t"ISO C90"
|
iso9899:1990\t"ISO C90"
|
||||||
iso9899:199409\t"ISO C90 as modified in amendment 1"
|
iso9899:199409\t"ISO C90 as modified in amendment 1"
|
||||||
@@ -43,54 +43,54 @@ complete -c gcc -o std -d "Standard mode" -x -a '
|
|||||||
c++98\t"ISO C++98"
|
c++98\t"ISO C++98"
|
||||||
gnu++98\t"ISO C++98 plus GNU extentions"
|
gnu++98\t"ISO C++98 plus GNU extentions"
|
||||||
'
|
'
|
||||||
complete -c gcc -o aux-info -r -d "Write prototypes to file"
|
complete -c gcc -o aux-info -r -d (_ "Write prototypes to file")
|
||||||
complete -c gcc -o fno-asm -d "Do not recognize asm, inline or typeof keywords"
|
complete -c gcc -o fno-asm -d (_ "Do not recognize asm, inline or typeof keywords")
|
||||||
complete -c gcc -o fno-builtin -d "Do not use builtin functions"
|
complete -c gcc -o fno-builtin -d (_ "Do not use builtin functions")
|
||||||
complete -c gcc -o fhosted -d "Assert hosted environment"
|
complete -c gcc -o fhosted -d (_ "Assert hosted environment")
|
||||||
complete -c gcc -o ffreestanding -d "Assert freestanding environment"
|
complete -c gcc -o ffreestanding -d (_ "Assert freestanding environment")
|
||||||
complete -c gcc -o fms-extensions -d "Use Microsoft extensions"
|
complete -c gcc -o fms-extensions -d (_ "Use Microsoft extensions")
|
||||||
complete -c gcc -o trigraphs -d "Use ANSI trigraphs"
|
complete -c gcc -o trigraphs -d (_ "Use ANSI trigraphs")
|
||||||
complete -c gcc -o no-integrated-cpp -d "Do not use integrated preprocessor"
|
complete -c gcc -o no-integrated-cpp -d (_ "Do not use integrated preprocessor")
|
||||||
complete -c gcc -o funsigned-char -d "char is unsigned"
|
complete -c gcc -o funsigned-char -d (_ "char is unsigned")
|
||||||
complete -c gcc -o fsigned-char -d "char is signed"
|
complete -c gcc -o fsigned-char -d (_ "char is signed")
|
||||||
complete -c gcc -o funsigned-bitfields -d "bifield is unsigned"
|
complete -c gcc -o funsigned-bitfields -d (_ "bitfield is unsigned")
|
||||||
complete -c gcc -o fsigned-bitfields -d "bifield is signed"
|
complete -c gcc -o fsigned-bitfields -d (_ "bitfield is signed")
|
||||||
complete -c gcc -o fno-unsigned-bitfields -d "All bifields are signed"
|
complete -c gcc -o fno-unsigned-bitfields -d (_ "All bitfields are signed")
|
||||||
complete -c gcc -o fno-signed-bitfields -d "All bifield are signed"
|
complete -c gcc -o fno-signed-bitfields -d (_ "All bitfields are unsigned")
|
||||||
complete -c gcc -o fwritable-strings -d "String constants are not const"
|
complete -c gcc -o fwritable-strings -d (_ "String constants are not const")
|
||||||
complete -c gcc -o fabi-version -d "C++ ABI version" -r -x -a "1 0"
|
complete -c gcc -o fabi-version -d (_ "C++ ABI version") -r -x -a '1 0'
|
||||||
complete -c gcc -o fno-access-control -d "Turn off access checking"
|
complete -c gcc -o fno-access-control -d (_ "Turn off access checking")
|
||||||
complete -c gcc -o fcheck-new -d "Check pointer returned by new"
|
complete -c gcc -o fcheck-new -d (_ "Check pointer returned by new")
|
||||||
complete -c gcc -o fconserve-space -d "Put globals in the common segment"
|
complete -c gcc -o fconserve-space -d (_ "Put globals in the common segment")
|
||||||
complete -c gcc -o fno-const-strings -d "String constants are not const"
|
complete -c gcc -o fno-const-strings -d (_ "String constants are not const")
|
||||||
complete -c gcc -o fdollars-in-identifiers -d "Accept $ in identifiers"
|
complete -c gcc -o fdollars-in-identifiers -d (_ "Accept \$ in identifiers")
|
||||||
complete -c gcc -o fno-dollars-in-identifiers -d "Reject $ in identifiers"
|
complete -c gcc -o fno-dollars-in-identifiers -d (_ "Reject \$ in identifiers")
|
||||||
complete -c gcc -o fno-elide-constructors -d "Do not omit unneeded temporarys"
|
complete -c gcc -o fno-elide-constructors -d (_ "Do not omit unneeded temporarys")
|
||||||
complete -c gcc -o fno-enforce-eh-specs -d "Allow exception violations"
|
complete -c gcc -o fno-enforce-eh-specs -d (_ "Allow exception violations")
|
||||||
complete -c gcc -o ffor-scope -d "Do not extend for-loop scope"
|
complete -c gcc -o ffor-scope -d (_ "Do not extend for-loop scope")
|
||||||
complete -c gcc -o fno-for-scope -d "Extend for-loop scope"
|
complete -c gcc -o fno-for-scope -d (_ "Extend for-loop scope")
|
||||||
complete -c gcc -o fno-gnu-keywords -d "Do not recognize typeof as keyword"
|
complete -c gcc -o fno-gnu-keywords -d (_ "Do not recognize typeof as keyword")
|
||||||
complete -c gcc -o fno-implicit-templates -d "Do not emit code for implicit templates"
|
complete -c gcc -o fno-implicit-templates -d (_ "Do not emit code for implicit templates")
|
||||||
complete -c gcc -o fno-implicit-inline-templates -d "Do not emit code for implicit inline templates"
|
complete -c gcc -o fno-implicit-inline-templates -d (_ "Do not emit code for implicit inline templates")
|
||||||
complete -c gcc -o fno-implement-inlines -d "Do not emit out-of-line code for inline functions"
|
complete -c gcc -o fno-implement-inlines -d (_ "Do not emit out-of-line code for inline functions")
|
||||||
complete -c gcc -o fms-extensions -d "Disable warnings about MFC"
|
complete -c gcc -o fms-extensions -d (_ "Disable warnings about MFC")
|
||||||
complete -c gcc -o fno-nonansi-builtins -d "Disable some built-in functions"
|
complete -c gcc -o fno-nonansi-builtins -d (_ "Disable some built-in functions")
|
||||||
complete -c gcc -o fno-operator-names -d "Disable operator keywords"
|
complete -c gcc -o fno-operator-names -d (_ "Disable operator keywords")
|
||||||
complete -c gcc -o fno-optional-diags -d "Disable optional diagnostics"
|
complete -c gcc -o fno-optional-diags -d (_ "Disable optional diagnostics")
|
||||||
complete -c gcc -o fpermissive -d "Downgrade some errors to warnings"
|
complete -c gcc -o fpermissive -d (_ "Downgrade some errors to warnings")
|
||||||
complete -c gcc -o frepo -d "Enable automatic template instantiation at link time"
|
complete -c gcc -o frepo -d (_ "Enable automatic template instantiation at link time")
|
||||||
complete -c gcc -o fno-rtti -d "Disable generation of C++ runtime type information"
|
complete -c gcc -o fno-rtti -d (_ "Disable generation of C++ runtime type information")
|
||||||
#complete -c gcc -o fstats -d "Emit front-end usage statistics"
|
#complete -c gcc -o fstats -d (_ "Emit front-end usage statistics")
|
||||||
|
|
||||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17;
|
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17;
|
||||||
complete -c gcc -o ftemplate-depth-1 -d Set\ maximum\ template\ depth\ to\ $i;
|
complete -c gcc -o ftemplate-depth-1 -d (printf (_ "Set maximum template depth to %s") $i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
complete -c gcc -o fno-threadsafe-statistics -d "Do not emit code for thread-safe initialization of local statics"
|
complete -c gcc -o fno-threadsafe-statistics -d (_ "Do not emit code for thread-safe initialization of local statics")
|
||||||
complete -c gcc -o fuse-cxa-atexit -d "Use __cxa_atexit for destructors"
|
complete -c gcc -o fuse-cxa-atexit -d (_ "Use __cxa_atexit for destructors")
|
||||||
complete -c gcc -o fvisibility-inlines-hidden -d "Hides inline methods from export table"
|
complete -c gcc -o fvisibility-inlines-hidden -d (_ "Hides inline methods from export table")
|
||||||
complete -c gcc -o fno-weak -d "Do not use weak symbol support"
|
complete -c gcc -o fno-weak -d (_ "Do not use weak symbol support")
|
||||||
# gcc completion listing is incomplete.
|
# gcc completion listing is incomplete.
|
||||||
#complete -c gcc -o -d ""
|
#complete -c gcc -o -d (_ "")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
324
init/completions/gpg.fish
Normal file
324
init/completions/gpg.fish
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
#
|
||||||
|
# Completions for the gpg command.
|
||||||
|
#
|
||||||
|
# This program accepts an rather large number of switches. It allows
|
||||||
|
# you to do things like changing what file descriptor errors should be
|
||||||
|
# written to, to make gpg use a different locale than the one
|
||||||
|
# specified in the environment or to specify an alternative home
|
||||||
|
# directory.
|
||||||
|
|
||||||
|
# Switches related to debugging, switches whose use is not
|
||||||
|
# recommended, switches whose behaviour is as of yet undefined,
|
||||||
|
# switches for experimental features, switches to make gpg compliant
|
||||||
|
# to legacy pgp-versions, dos-specific switches, switches meant for
|
||||||
|
# the options file and deprecated or obsolete switches have all been
|
||||||
|
# removed. The remaining list of completions is still quite
|
||||||
|
# impressive.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Various functions used for dynamic completions
|
||||||
|
#
|
||||||
|
|
||||||
|
function __fish_complete_gpg_user_id -d "Complete using gpg user ids"
|
||||||
|
# gpg doesn't seem to like it when you use the whole key name as a
|
||||||
|
# completion, so we skip the <EMAIL> part and use it a s a
|
||||||
|
# description.
|
||||||
|
gpg --list-keys --with-colon|cut -d : -f 10|sed -ne 's/\(.*\) <\(.*\)>/\1\t\2/p'
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_complete_gpg_key_id -d 'Complete using gpg key ids'
|
||||||
|
# Use user_id as the description
|
||||||
|
gpg --list-keys --with-colons|cut -d : -f 5,10|sed -ne "s/\(.*\):\(.*\)/\1\t\2/p"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_print_gpg_algo -d "Complete using all algorithms of the type specified in argv[1] supported by gpg. argv[1] is a regexp"
|
||||||
|
# Set a known locale, so that the output format of 'gpg --version'
|
||||||
|
# is at least somewhat predictable. The locale will automatically
|
||||||
|
# expire when the function goes out of scope, and the original locale
|
||||||
|
# will take effect again.
|
||||||
|
set -lx LC_ALL C
|
||||||
|
gpg --version | grep "$argv:"| grep -v "Home:"|cut -d : -f 2 |tr , \n|tr -d " "
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# gpg subcommands
|
||||||
|
#
|
||||||
|
|
||||||
|
complete -c gpg -s s -l sign -d (_ "Make a signature")
|
||||||
|
complete -c gpg -l clearsign -d (_ "Make a clear text signature")
|
||||||
|
complete -c gpg -s b -l detach-sign -d (_ "Make a detached signature")
|
||||||
|
complete -c gpg -s e -l encrypt -d (_ "Encrypt data")
|
||||||
|
complete -c gpg -s c -l symmetric -d (_ "Encrypt with a symmetric cipher using a passphrase")
|
||||||
|
complete -c gpg -l store -d (_ "Store only (make a simple RFC1991 packet)")
|
||||||
|
complete -c gpg -l decrypt -d (_ "Decrypt specified file or stdin")
|
||||||
|
complete -c gpg -l verify -d (_ "Assume specified file or stdin is sigfile and verify it")
|
||||||
|
complete -c gpg -l multifile -d (_ "Modify certain other commands to accept multiple files for processing")
|
||||||
|
complete -c gpg -l verify-files -d (_ "Identical to '--multifile --verify'")
|
||||||
|
complete -c gpg -l encrypt-files -d (_ "Identical to '--multifile --encrypt'")
|
||||||
|
complete -c gpg -l decrypt-files -d (_ "Identical to --multifile --decrypt")
|
||||||
|
|
||||||
|
complete -c gpg -l list-keys -xa "(__fish_append , (__fish_complete_gpg_user_id) )" -d (_ "List all keys from the public keyrings, or just the ones given on the command line")
|
||||||
|
complete -c gpg -l list-public-keys -xa "(__fish_append , (__fish_complete_gpg_user_id) )" -d (_ "List all keys from the public keyrings, or just the ones given on the command line")
|
||||||
|
complete -c gpg -s K -l list-secret-keys -xa "(__fish_append , (__fish_complete_gpg_user_id) )" -d (_ "List all keys from the secret keyrings, or just the ones given on the command line")
|
||||||
|
complete -c gpg -l list-sigs -xa "(__fish_append , (__fish_complete_gpg_user_id))" -d (_ "Same as --list-keys, but the signatures are listed too")
|
||||||
|
|
||||||
|
complete -c gpg -l check-sigs -xa "(__fish_append , (__fish_complete_gpg_user_id))" -d (_ "Same as --list-keys, but the signatures are listed and verified")
|
||||||
|
complete -c gpg -l fingerprint -xa "(__fish_append , (__fish_complete_gpg_user_id))" -d (_ "List all keys with their fingerprints")
|
||||||
|
complete -c gpg -l gen-key -d (_ "Generate a new key pair")
|
||||||
|
|
||||||
|
complete -c gpg -l edit-key -d (_ "Present a menu which enables you to do all key related tasks") -xa "(__fish_complete_gpg_user_id)"
|
||||||
|
|
||||||
|
complete -c gpg -l sign-key -xa "(__fish_complete_gpg_user_id)" -d (_ "Sign a public key with your secret key")
|
||||||
|
complete -c gpg -l lsign-key -xa "(__fish_complete_gpg_user_id)" -d (_ "Sign a public key with your secret key but mark it as non exportable")
|
||||||
|
|
||||||
|
complete -c gpg -l delete-key -xa "(__fish_complete_gpg_user_id)" -d (_ "Remove key from the public keyring")
|
||||||
|
complete -c gpg -l delete-secret-key -xa "(__fish_complete_gpg_user_id)" -d (_ "Remove key from the secret and public keyring")
|
||||||
|
complete -c gpg -l delete-secret-and-public-key -xa "(__fish_complete_gpg_user_id)" -d (_ "Same as --delete-key, but if a secret key exists, it will be removed first")
|
||||||
|
|
||||||
|
complete -c gpg -l gen-revoke -xa "(__fish_complete_gpg_user_id)" -d (_ "Generate a revocation certificate for the complete key")
|
||||||
|
complete -c gpg -l desig-revoke -xa "(__fish_complete_gpg_user_id)" -d (_ "Generate a designated revocation certificate for a key")
|
||||||
|
|
||||||
|
complete -c gpg -l export -xa "(__fish_append , (__fish_complete_gpg_user_id))" -d (_ "Export all or the given keys from all keyrings" )
|
||||||
|
complete -c gpg -l send-keys -xa "(__fish_append , (__fish_complete_gpg_user_id))" -d (_ "Same as --export but sends the keys to a keyserver")
|
||||||
|
complete -c gpg -l export-secret-keys -xa "(__fish_complete_gpg_user_id)" -d (_ "Same as --export, but exports the secret keys instead")
|
||||||
|
complete -c gpg -l export-secret-subkeys -xa "(__fish_complete_gpg_user_id)" -d (_ "Same as --export, but exports the secret keys instead")
|
||||||
|
|
||||||
|
complete -c gpg -l import -xa "(__fish_complete_gpg_user_id)" -d (_ "Import/merge keys" )
|
||||||
|
complete -c gpg -l fast-import -xa "(__fish_complete_gpg_user_id)" -d (_ "Import/merge keys" )
|
||||||
|
|
||||||
|
complete -c gpg -l recv-keys -xa "(__fish_complete_gpg_key_id)" -d (_ "Import the keys with the given key IDs from a keyserver")
|
||||||
|
complete -c gpg -l refresh-keys -xa "(__fish_complete_gpg_key_id)" -d (_ "Request updates from a keyserver for keys that already exist on the local keyring")
|
||||||
|
complete -c gpg -l search-keys -xa "(__fish_append , (__fish_complete_gpg_user_id) )" -d (_ "Search the keyserver for the given names")
|
||||||
|
complete -c gpg -l update-trustdb -d (_ "Do trust database maintenance")
|
||||||
|
complete -c gpg -l check-trustdb -d (_ "Do trust database maintenance without user interaction")
|
||||||
|
|
||||||
|
complete -c gpg -l export-ownertrust -d (_ "Send the ownertrust values to stdout")
|
||||||
|
complete -c gpg -l import-ownertrust -d (_ "Update the trustdb with the ownertrust values stored in specified files or stdin")
|
||||||
|
|
||||||
|
complete -c gpg -l rebuild-keydb-caches -d (_ "Create signature caches in the keyring")
|
||||||
|
|
||||||
|
complete -c gpg -l print-md -xa "(__fish_print_gpg_algo Hash)" -d (_ "Print message digest of specified algorithm for all given files or stdin")
|
||||||
|
complete -c gpg -l print-mds -d (_ "Print message digest of all algorithms for all given files or stdin")
|
||||||
|
|
||||||
|
complete -c gpg -l gen-random -xa "0 1 2" -d (_ "Emit specified number of random bytes of the given quality level")
|
||||||
|
|
||||||
|
complete -c gpg -l version -d (_ "Display version and supported algorithms, and exit")
|
||||||
|
complete -c gpg -l warranty -d (_ "Display warranty and exit")
|
||||||
|
complete -c gpg -s h -l help -d (_ "Display help and exit")
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# gpg options
|
||||||
|
#
|
||||||
|
|
||||||
|
complete -c gpg -s a -l armor -d (_ "Create ASCII armored output")
|
||||||
|
complete -c gpg -s o -l output -r -d (_ "Write output to specified file")
|
||||||
|
|
||||||
|
complete -c gpg -l max-output -d (_ "Sets a limit on the number of bytes that will be generated when processing a file") -x
|
||||||
|
|
||||||
|
complete -c gpg -s u -l local-user -xa "(__fish_complete_gpg_user_id)" -d (_ "Use specified key as the key to sign with")
|
||||||
|
complete -c gpg -l default-key -xa "(__fish_complete_gpg_user_id)" -d (_ "Use specified key as the default key to sign with")
|
||||||
|
|
||||||
|
complete -c gpg -s r -l recipient -xa "(__fish_complete_gpg_user_id)" -d (_ "Encrypt for specified user id")
|
||||||
|
complete -c gpg -s R -l hidden-recipient -xa "(__fish_complete_gpg_user_id)" -d (_ "Encrypt for specified user id, but hide the keyid of the key")
|
||||||
|
complete -c gpg -l default-recipient -xa "(__fish_complete_gpg_user_id)" -d (_ "Use specified user id as default recipient")
|
||||||
|
complete -c gpg -l default-recipient-self -d (_ "Use the default key as default recipient")
|
||||||
|
complete -c gpg -l no-default-recipient -d (_ "Reset --default-recipient and --default-recipient-self")
|
||||||
|
|
||||||
|
complete -c gpg -s v -l verbose -d (_ "Give more information during processing")
|
||||||
|
complete -c gpg -s q -l quiet -d (_ "Quiet mode")
|
||||||
|
|
||||||
|
complete -c gpg -s z -d (_ "Compression level") -xa "(seq 1 9)"
|
||||||
|
complete -c gpg -l compress-level -d (_ "Compression level") -xa "(seq 1 9)"
|
||||||
|
complete -c gpg -l bzip2-compress-level -d (_ "Compression level") -xa "(seq 1 9)"
|
||||||
|
complete -c gpg -l bzip2-decompress-lowmem -d (_ "Use a different decompression method for BZIP2 compressed files")
|
||||||
|
|
||||||
|
complete -c gpg -s t -l textmode -d (_ "Treat input files as text and store them in the OpenPGP canonical text form with standard 'CRLF' line endings")
|
||||||
|
complete -c gpg -l no-textmode -d (_ "Don't treat input files as text and store them in the OpenPGP canonical text form with standard 'CRLF' line endings")
|
||||||
|
|
||||||
|
complete -c gpg -s n -l dry-run -d (_ "Don't make any changes (this is not completely implemented)")
|
||||||
|
|
||||||
|
complete -c gpg -s i -l interactive -d (_ "Prompt before overwrite")
|
||||||
|
|
||||||
|
complete -c gpg -l batch -d (_ "Batch mode")
|
||||||
|
complete -c gpg -l no-batch -d (_ "Don't use batch mode")
|
||||||
|
complete -c gpg -l no-tty -d (_ "Never write output to terminal")
|
||||||
|
|
||||||
|
complete -c gpg -l yes -d (_ "Assume yes on most questions")
|
||||||
|
complete -c gpg -l no -d (_ "Assume no on most questions")
|
||||||
|
|
||||||
|
complete -c gpg -l ask-cert-level -d (_ "Prompt for a certification level when making a key signature")
|
||||||
|
complete -c gpg -l no-ask-cert-level -d (_ "Don't prompt for a certification level when making a key signature")
|
||||||
|
complete -c gpg -l default-cert-level -xa "0\t'Not verified' 1\t'Not verified' 2\t'Caual verification' 3\t'Extensive verification'" -d (_ "The default certification level to use for the level check when signing a key")
|
||||||
|
complete -c gpg -l min-cert-level -xa "0 1 2 3" -d (_ "Disregard any signatures with a certification level below specified level when building the trust database")
|
||||||
|
|
||||||
|
complete -c gpg -l trusted-key -xa "(__fish_complete_gpg_key_id)" -d (_ "Assume that the specified key is as trustworthy as one of your own secret keys")
|
||||||
|
complete -c gpg -l trust-model -xa "pgp classic direct always" -d (_ "Specify trust model")
|
||||||
|
|
||||||
|
complete -c gpg -l keyid-format -xa "short 0xshort long 0xlong" -d (_ "Select how to display key IDs")
|
||||||
|
|
||||||
|
complete -c gpg -l keyserver -x -d (_ "Use specified keyserver")
|
||||||
|
complete -c gpg -l keyserver-options -xa "(__fish_append , include-revoked include-disabled honor-keyserver-url include-subkeys use-temp-files keep-temp-files verbose timeout http-proxy auto-key-retrieve)" -d (_ "Options for the keyserver")
|
||||||
|
|
||||||
|
complete -c gpg -l import-options -xa "(__fish_append , import-local-sigs repair-pks-subkey-bug merge-only)" -d (_ "Options for importing keys")
|
||||||
|
complete -c gpg -l export-options -xa "(__fish_append , export-local-sigs export-attributes export-sensitive-revkeys export-minimal)" -d (_ "Options for exporting keys")
|
||||||
|
complete -c gpg -l list-options -xa "(__fish_append , show-photos show-policy-urls show-notations show-std-notations show-user-notations show-keyserver-urls show-uid-validity show-unusable-uids show-unusable-subkeys show-keyring show-sig-expire show-sig-subpackets )" -d (_ "Options for listing keys and signatures")
|
||||||
|
complete -c gpg -l verify-options -xa "(__fish_append , show-photos show-policy-urls show-notations show-std-notations show-user-notations show-keyserver-urls show-uid-validity show-unusable-uids)" -d (_ "Options for verifying signatures")
|
||||||
|
|
||||||
|
complete -c gpg -l photo-viewer -r -d (_ "The command line that should be run to view a photo ID")
|
||||||
|
complete -c gpg -l exec-path -r -d (_ "Sets a list of directories to search for photo viewers and keyserver helpers")
|
||||||
|
|
||||||
|
complete -c gpg -l show-keyring -d (_ "Display the keyring name at the head of key listings to show which keyring a given key resides on")
|
||||||
|
complete -c gpg -l keyring -r -d (_ "Add specified file to the current list of keyrings")
|
||||||
|
|
||||||
|
complete -c gpg -l secret-keyring -r -d (_ "Add specified file to the current list of secret keyrings")
|
||||||
|
complete -c gpg -l primary-keyring -r -d (_ "Designate specified file as the primary public keyring")
|
||||||
|
|
||||||
|
complete -c gpg -l trustdb-name -r -d (_ "Use specified file instead of the default trustdb")
|
||||||
|
complete -c gpg -l homedir -xa "(__fish_complete_directory (commandline -ct))" -d (_ "Set the home directory")
|
||||||
|
complete -c gpg -l display-charset -xa " iso-8859-1 iso-8859-2 iso-8859-15 koi8-r utf-8 " -d (_ "Set the native character set")
|
||||||
|
|
||||||
|
complete -c gpg -l utf8-strings -d (_ "Assume that following command line arguments are given in UTF8")
|
||||||
|
complete -c gpg -l no-utf8-strings -d (_ "Assume that following arguments are encoded in the character set specified by --display-charset")
|
||||||
|
complete -c gpg -l options -r -d (_ "Read options from specified file, do not read the default options file")
|
||||||
|
complete -c gpg -l no-options -d (_ "Shortcut for '--options /dev/null'")
|
||||||
|
complete -c gpg -l load-extension -x -d (_ "Load an extension module")
|
||||||
|
|
||||||
|
complete -c gpg -l status-fd -x -d (_ "Write special status strings to the specified file descriptor")
|
||||||
|
complete -c gpg -l logger-fd -x -d (_ "Write log output to the specified file descriptor")
|
||||||
|
complete -c gpg -l attribute-fd -d (_ "Write attribute subpackets to the specified file descriptor")
|
||||||
|
|
||||||
|
complete -c gpg -l sk-comments -d (_ "Include secret key comment packets when exporting secret keys")
|
||||||
|
complete -c gpg -l no-sk-comments -d (_ "Don't include secret key comment packets when exporting secret keys")
|
||||||
|
|
||||||
|
complete -c gpg -l comment -x -d (_ "Use specified string as comment string")
|
||||||
|
complete -c gpg -l no-comments -d (_ "Don't use a comment string")
|
||||||
|
|
||||||
|
complete -c gpg -l emit-version -d (_ "Include the version string in ASCII armored output")
|
||||||
|
complete -c gpg -l no-emit-version -d (_ "Don't include the version string in ASCII armored output")
|
||||||
|
|
||||||
|
complete -c gpg -l sig-notation -x
|
||||||
|
complete -c gpg -l cert-notation -x
|
||||||
|
|
||||||
|
complete -c gpg -s N -l set-notation -x -d (_ "Put the specified name value pair into the signature as notation data")
|
||||||
|
complete -c gpg -l sig-policy-url -x -d (_ "Set signature policy")
|
||||||
|
complete -c gpg -l cert-policy-url -x -d (_ "Set certificate policy")
|
||||||
|
complete -c gpg -l set-policy-url -x -d (_ "Set signature and certificate policy")
|
||||||
|
complete -c gpg -l sig-keyserver-url -x -d (_ "Use specified URL as a preferred keyserver for data signatures")
|
||||||
|
|
||||||
|
complete -c gpg -l set-filename -x -d (_ "Use specified string as the filename which is stored inside messages")
|
||||||
|
|
||||||
|
complete -c gpg -l for-your-eyes-only -d (_ "Set the 'for your eyes only' flag in the message")
|
||||||
|
complete -c gpg -l no-for-your-eyes-only -d (_ "Clear the 'for your eyes only' flag in the message")
|
||||||
|
|
||||||
|
complete -c gpg -l use-embedded-filename -d (_ "Create file with name as given in data")
|
||||||
|
complete -c gpg -l no-use-embedded-filename -d (_ "Don't create file with name as given in data")
|
||||||
|
|
||||||
|
complete -c gpg -l completes-needed -x -d (_ "Number of completely trusted users to introduce a new key signer (defaults to 1)")
|
||||||
|
complete -c gpg -l marginals-needed -x -d (_ "Number of marginally trusted users to introduce a new key signer (defaults to 3)")
|
||||||
|
|
||||||
|
complete -c gpg -l max-cert-depth -x -d (_ "Maximum depth of a certification chain (default is 5)")
|
||||||
|
|
||||||
|
complete -c gpg -l cipher-algo -xa "(__fish_print_gpg_algo Cipher)" -d (_ "Use specified cipher algorithm")
|
||||||
|
complete -c gpg -l digest-algo -xa "(__fish_print_gpg_algo Hash)" -d (_ "Use specified message digest algorithm")
|
||||||
|
complete -c gpg -l compress-algo -xa "(__fish_print_gpg_algo Compression)" -d (_ "Use specified compression algorithm")
|
||||||
|
complete -c gpg -l cert-digest-algo -xa "(__fish_print_gpg_algo Hash)" -d (_ "Use specified message digest algorithm when signing a key")
|
||||||
|
complete -c gpg -l s2k-cipher-algo -xa "(__fish_print_gpg_algo Cipher)" -d (_ "Use specified cipher algorithm to protect secret keys")
|
||||||
|
complete -c gpg -l s2k-digest-algo -xa "(__fish_print_gpg_algo Hash)" -d (_ "Use specified digest algorithm to mangle the passphrases")
|
||||||
|
complete -c gpg -l s2k-mode -xa "0\t'Plain passphrase' 1\t'Salted passphrase' 3\t'Repeated salted mangling'" -d (_ "Selects how passphrases are mangled")
|
||||||
|
|
||||||
|
complete -c gpg -l simple-sk-checksum -d (_ "Integrity protect secret keys by using a SHA-1 checksum" )
|
||||||
|
|
||||||
|
complete -c gpg -l disable-cipher-algo -xa "(__fish_print_gpg_algo Cipher)" -d (_ "Never allow the use of specified cipher algorithm")
|
||||||
|
complete -c gpg -l disable-pubkey-algo -xa "(__fish_print_gpg_algo Pubkey)" -d (_ "Never allow the use of specified public key algorithm")
|
||||||
|
|
||||||
|
complete -c gpg -l no-sig-cache -d (_ "Do not cache the verification status of key signatures")
|
||||||
|
complete -c gpg -l no-sig-create-check -d (_ "Do not verify each signature right after creation")
|
||||||
|
|
||||||
|
complete -c gpg -l auto-check-trustdb -d (_ "Automatically run the --check-trustdb command internally when needed")
|
||||||
|
complete -c gpg -l no-auto-check-trustdb -d (_ "Never automatically run the --check-trustdb")
|
||||||
|
|
||||||
|
complete -c gpg -l throw-keyids -d (_ "Do not put the recipient keyid into encrypted packets")
|
||||||
|
complete -c gpg -l no-throw-keyids -d (_ "Put the recipient keyid into encrypted packets")
|
||||||
|
complete -c gpg -l not-dash-escaped -d (_ "Change the behavior of cleartext signatures so that they can be used for patch files")
|
||||||
|
|
||||||
|
complete -c gpg -l escape-from-lines -d (_ "Mangle From-field of email headers (default)")
|
||||||
|
complete -c gpg -l no-escape-from-lines -d (_ "Do not mangle From-field of email headers")
|
||||||
|
|
||||||
|
complete -c gpg -l passphrase-fd -x -d (_ "Read passphrase from specified file descriptor")
|
||||||
|
complete -c gpg -l command-fd -x -d (_ "Read user input from specified file descriptor")
|
||||||
|
|
||||||
|
complete -c gpg -l use-agent -d (_ "Try to use the GnuPG-Agent")
|
||||||
|
complete -c gpg -l no-use-agent -d (_ "Do not try to use the GnuPG-Agent")
|
||||||
|
complete -c gpg -l gpg-agent-info -x -d (_ "Override value of GPG_AGENT_INFO environment variable")
|
||||||
|
|
||||||
|
complete -c gpg -l force-v3-sigs -d (_ "Force v3 signatures for signatures on data")
|
||||||
|
complete -c gpg -l no-force-v3-sigs -d (_ "Do not force v3 signatures for signatures on data")
|
||||||
|
|
||||||
|
complete -c gpg -l force-v4-certs -d (_ "Always use v4 key signatures even on v3 keys")
|
||||||
|
complete -c gpg -l no-force-v4-certs -d (_ "Don't use v4 key signatures on v3 keys")
|
||||||
|
|
||||||
|
complete -c gpg -l force-mdc -d (_ "Force the use of encryption with a modification detection code")
|
||||||
|
complete -c gpg -l disable-mdc -d (_ "Disable the use of the modification detection code")
|
||||||
|
|
||||||
|
complete -c gpg -l allow-non-selfsigned-uid -d (_ "Allow the import and use of keys with user IDs which are not self-signed")
|
||||||
|
complete -c gpg -l no-allow-non-selfsigned-uid -d (_ "Do not allow the import and use of keys with user IDs which are not self-signed")
|
||||||
|
|
||||||
|
complete -c gpg -l allow-freeform-uid -d (_ "Disable all checks on the form of the user ID while generating a new one")
|
||||||
|
|
||||||
|
complete -c gpg -l ignore-time-conflict -d (_ "Do not fail if signature is older than key")
|
||||||
|
complete -c gpg -l ignore-valid-from -d (_ "Allow subkeys that have a timestamp from the future")
|
||||||
|
complete -c gpg -l ignore-crc-error -d (_ "Ignore CRC errors")
|
||||||
|
complete -c gpg -l ignore-mdc-error -d (_ "Do not fail on MDC integrity protection failiure")
|
||||||
|
|
||||||
|
complete -c gpg -l lock-once -d (_ "Lock the databases the first time a lock is requested and do not release the lock until the process terminates")
|
||||||
|
complete -c gpg -l lock-multiple -d (_ "Release the locks every time a lock is no longer needed")
|
||||||
|
|
||||||
|
complete -c gpg -l no-random-seed-file -d (_ "Do not create an internal pool file for quicker generation of random numbers")
|
||||||
|
complete -c gpg -l no-verbose -d (_ "Reset verbose level to 0")
|
||||||
|
complete -c gpg -l no-greeting -d (_ "Suppress the initial copyright message")
|
||||||
|
complete -c gpg -l no-secmem-warning -d (_ "Suppress the warning about 'using insecure memory'")
|
||||||
|
complete -c gpg -l no-permission-warning -d (_ "Suppress the warning about unsafe file and home directory (--homedir) permissions")
|
||||||
|
complete -c gpg -l no-mdc-warning -d (_ "Suppress the warning about missing MDC integrity protection")
|
||||||
|
|
||||||
|
complete -c gpg -l require-secmem -d (_ "Refuse to run if GnuPG cannot get secure memory")
|
||||||
|
|
||||||
|
complete -c gpg -l no-require-secmem -d (_ "Do not refuse to run if GnuPG cannot get secure memory (default)")
|
||||||
|
complete -c gpg -l no-armor -d (_ "Assume the input data is not in ASCII armored format")
|
||||||
|
|
||||||
|
complete -c gpg -l no-default-keyring -d (_ "Do not add the default keyrings to the list of keyrings")
|
||||||
|
|
||||||
|
complete -c gpg -l skip-verify -d (_ "Skip the signature verification step")
|
||||||
|
|
||||||
|
complete -c gpg -l with-colons -d (_ "Print key listings delimited by colons")
|
||||||
|
complete -c gpg -l with-key-data -d (_ "Print key listings delimited by colons (like --with-colons) and print the public key data")
|
||||||
|
complete -c gpg -l with-fingerprint -d (_ "Same as the command --fingerprint but changes only the format of the output and may be used together with another command")
|
||||||
|
|
||||||
|
complete -c gpg -l fast-list-mode -d (_ "Changes the output of the list commands to work faster")
|
||||||
|
complete -c gpg -l fixed-list-mode -d (_ "Do not merge primary user ID and primary key in --with-colon listing mode and print all timestamps as UNIX timestamps")
|
||||||
|
|
||||||
|
complete -c gpg -l list-only -d (_ "Changes the behaviour of some commands. This is like --dry-run but different")
|
||||||
|
|
||||||
|
complete -c gpg -l show-session-key -d (_ "Display the session key used for one message")
|
||||||
|
complete -c gpg -l override-session-key -x -d (_ "Don't use the public key but the specified session key")
|
||||||
|
|
||||||
|
complete -c gpg -l ask-sig-expire -d (_ "Prompt for an expiration time")
|
||||||
|
complete -c gpg -l no-ask-sig-expire -d (_ "Do not prompt for an expiration time")
|
||||||
|
|
||||||
|
complete -c gpg -l ask-cert-expire -d (_ "Prompt for an expiration time")
|
||||||
|
complete -c gpg -l no-ask-cert-expire -d (_ "Do not prompt for an expiration time")
|
||||||
|
|
||||||
|
complete -c gpg -l try-all-secrets -d (_ "Don't look at the key ID as stored in the message but try all secret keys in turn to find the right decryption key")
|
||||||
|
complete -c gpg -l enable-special-filenames -d (_ "Enable a mode in which filenames of the form -&n, where n is a non-negative decimal number, refer to the file descriptor n and not to a file with that name")
|
||||||
|
|
||||||
|
complete -c gpg -l group -x -d (_ "Sets up a named group, which is similar to aliases in email programs")
|
||||||
|
complete -c gpg -l ungroup -d (_ "Remove a given entry from the --group list")
|
||||||
|
complete -c gpg -l no-groups -d (_ "Remove all entries from the --group list")
|
||||||
|
|
||||||
|
complete -c gpg -l preserve-permissions -d (_ "Don't change the permissions of a secret keyring back to user read/write only")
|
||||||
|
|
||||||
|
complete -c gpg -l personal-cipher-preferences -x -d (_ "Set the list of personal cipher preferences to the specified string")
|
||||||
|
complete -c gpg -l personal-digest-preferences -x -d (_ "Set the list of personal digest preferences to the specified string")
|
||||||
|
complete -c gpg -l personal-compress-preferences -x -d (_ "Set the list of personal compression preferences to the specified string")
|
||||||
|
complete -c gpg -l default-preference-list -x -d (_ "Set the list of default preferences to the specified string")
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
complete -c gprof -s A -l annoted-source -d "Print annotated source"
|
complete -c gprof -s A -l annoted-source -d (_ "Print annotated source")
|
||||||
complete -c gprof -s b -l brief -d "Do not print explanations"
|
complete -c gprof -s b -l brief -d (_ "Do not print explanations")
|
||||||
complete -c gprof -s C -l exec-counts -d "Print tally"
|
complete -c gprof -s C -l exec-counts -d (_ "Print tally")
|
||||||
complete -c gprof -s i -l file-info -d "Display summary"
|
complete -c gprof -s i -l file-info -d (_ "Display summary")
|
||||||
complete -c gprof -s I -l directory-path -d "Search directories for source"
|
complete -c gprof -s I -l directory-path -d (_ "Search directories for source")
|
||||||
complete -c gprof -s J -l no-annotated-source -d "No annotated source"
|
complete -c gprof -s J -l no-annotated-source -d (_ "No annotated source")
|
||||||
complete -c gprof -s L -l print-path -d "Print full path of source"
|
complete -c gprof -s L -l print-path -d (_ "Print full path of source")
|
||||||
complete -c gprof -s p -l flat-profile -d "Print flat profile"
|
complete -c gprof -s p -l flat-profile -d (_ "Print flat profile")
|
||||||
complete -c gprof -s P -l no-flat-profile -d "No flat profile"
|
complete -c gprof -s P -l no-flat-profile -d (_ "No flat profile")
|
||||||
complete -c gprof -s q -l graph -d "Print call graph"
|
complete -c gprof -s q -l graph -d (_ "Print call graph")
|
||||||
complete -c gprof -s Q -l no-graph -d "No call graph"
|
complete -c gprof -s Q -l no-graph -d (_ "No call graph")
|
||||||
complete -c gprof -s y -l separate-files -d "Annotate to file"
|
complete -c gprof -s y -l separate-files -d (_ "Annotate to file")
|
||||||
complete -c gprof -s Z -l no-exec-counts -d "No tally"
|
complete -c gprof -s Z -l no-exec-counts -d (_ "No tally")
|
||||||
complete -c gprof -l function-ordering -d "Suggest function ordering"
|
complete -c gprof -l function-ordering -d (_ "Suggest function ordering")
|
||||||
complete -rc gprof -l file-ordering -d "Suggest file ordering"
|
complete -rc gprof -l file-ordering -d (_ "Suggest file ordering")
|
||||||
complete -c gprof -s T -l traditional -d "Traditional mode"
|
complete -c gprof -s T -l traditional -d (_ "Traditional mode")
|
||||||
complete -xc gprof -s w -l width -d "Set width of output"
|
complete -xc gprof -s w -l width -d (_ "Set width of output")
|
||||||
complete -c gprof -s x -l all-lines -d "Anotate every line"
|
complete -c gprof -s x -l all-lines -d (_ "Anotate every line")
|
||||||
complete -xc gprof -l demangle -d "Set demangling style"
|
complete -xc gprof -l demangle -d (_ "Set demangling style")
|
||||||
complete -c gprof -l no-demangle -d "Turn of demangling"
|
complete -c gprof -l no-demangle -d (_ "Turn of demangling")
|
||||||
complete -xc gprof -s a -l no-static -d "Supress static functions"
|
complete -xc gprof -s a -l no-static -d (_ "Supress static functions")
|
||||||
complete -xc gprof -s c -l static-call-graph -d ""
|
complete -xc gprof -s c -l static-call-graph
|
||||||
complete -xc gprof -s D -l ignore-non-functions -d "Ignore symbols not known to be functions"
|
complete -xc gprof -s D -l ignore-non-functions -d (_ "Ignore symbols not known to be functions")
|
||||||
complete -xc gprof -s k -r -d "Delete arcs from callgraph"
|
complete -xc gprof -s k -r -d (_ "Delete arcs from callgraph")
|
||||||
complete -xc gprof -s l -l line -d "Line by line profiling"
|
complete -xc gprof -s l -l line -d (_ "Line by line profiling")
|
||||||
complete -xc gprof -s m -l min-count -r -d "Supress output when executed less than specified times"
|
complete -xc gprof -s m -l min-count -r -d (_ "Supress output when executed less than specified times")
|
||||||
complete -xc gprof -s n -l time -d "Only propagate times for matching symbols"
|
complete -xc gprof -s n -l time -d (_ "Only propagate times for matching symbols")
|
||||||
complete -xc gprof -s N -l no-time -d "Do not propagate times for matching symbols"
|
complete -xc gprof -s N -l no-time -d (_ "Do not propagate times for matching symbols")
|
||||||
complete -xc gprof -s z -l display-unused-functions -d "Mention unused functions in flat profile"
|
complete -xc gprof -s z -l display-unused-functions -d (_ "Mention unused functions in flat profile")
|
||||||
complete -xc gprof -s d -l debug -d "Specify debugging options"
|
complete -xc gprof -s d -l debug -d (_ "Specify debugging options")
|
||||||
complete -xc gprof -s h -l help -d "Print help and exit"
|
complete -xc gprof -s h -l help -d (_ "Display help and exit")
|
||||||
complete -xc gprof -s v -l version -d "Print version and exit"
|
complete -xc gprof -s v -l version -d (_ "Display version and exit")
|
||||||
complete -xc gprof -s O -l file-format -x -a "auto bsd 4.4bsd magic prof" -d "Profile data format"
|
complete -xc gprof -s O -l file-format -x -a "auto bsd 4.4bsd magic prof" -d (_ "Profile data format")
|
||||||
complete -xc gprof -s s -l sum -d "Print summary"
|
complete -xc gprof -s s -l sum -d (_ "Print summary")
|
||||||
|
|||||||
@@ -1,47 +1,50 @@
|
|||||||
|
#
|
||||||
|
# Completions for the grep command
|
||||||
|
#
|
||||||
|
|
||||||
complete -c grep -s A -l after-context -d "Print NUM lines of trailing context"
|
complete -c grep -s A -l after-context -d (_ "Print NUM lines of trailing context")
|
||||||
complete -c grep -s a -l text -d "Process binary file as text"
|
complete -c grep -s a -l text -d (_ "Process binary file as text")
|
||||||
complete -c grep -s B -l before-context -d "Print NUM lines of leading context"
|
complete -c grep -s B -l before-context -d (_ "Print NUM lines of leading context")
|
||||||
complete -c grep -s C -l context -d "Print NUM lines of context"
|
complete -c grep -s C -l context -d (_ "Print NUM lines of context")
|
||||||
complete -c grep -s b -l byte-offset -d "Print byte offset of matches"
|
complete -c grep -s b -l byte-offset -d (_ "Print byte offset of matches")
|
||||||
complete -c grep -l binary-files -d "Assume data type for binary files" -x -a "binary text"
|
complete -c grep -l binary-files -d (_ "Assume data type for binary files") -x -a "binary text"
|
||||||
complete -c grep -l colour -x -a "never always auto"
|
complete -c grep -l colour -x -a "never always auto"
|
||||||
complete -c grep -l color -x -a "never always auto"
|
complete -c grep -l color -x -a "never always auto"
|
||||||
complete -c grep -s c -l count -d "Only print number of matches"
|
complete -c grep -s c -l count -d (_ "Only print number of matches")
|
||||||
complete -c grep -s D -l devices -x -a "read skip" -d "Action for devices"
|
complete -c grep -s D -l devices -x -a "read skip" -d (_ "Action for devices")
|
||||||
complete -c grep -s d -l directories -x -a "read skip recurse" -d "Action for directories"
|
complete -c grep -s d -l directories -x -a "read skip recurse" -d (_ "Action for directories")
|
||||||
complete -c grep -s E -l extended-regexp -d "Pattern is extended regexp"
|
complete -c grep -s E -l extended-regexp -d (_ "Pattern is extended regexp")
|
||||||
complete -xc grep -s e -l regexp -d "Pattern is a regexp"
|
complete -xc grep -s e -l regexp -d (_ "Pattern is a regexp")
|
||||||
complete -c grep -s F -l fixed -d "Pattern is a fixed string"
|
complete -c grep -s F -l fixed -d (_ "Pattern is a fixed string")
|
||||||
complete -c grep -s f -l file -r -d "Use pattern from file"
|
complete -c grep -s f -l file -r -d (_ "Use pattern from file")
|
||||||
complete -c grep -s G -l basic-regexp -d "Pattern is basic regex"
|
complete -c grep -s G -l basic-regexp -d (_ "Pattern is basic regex")
|
||||||
complete -c grep -s H -l with-filename -d "Print filename"
|
complete -c grep -s H -l with-filename -d (_ "Print filename")
|
||||||
complete -c grep -s h -l no-filename -d "Supress printing filename"
|
complete -c grep -s h -l no-filename -d (_ "Supress printing filename")
|
||||||
complete -c grep -l help -d "Display help and exit"
|
complete -c grep -l help -d (_ "Display help and exit")
|
||||||
complete -c grep -s I -d "Skip binary files"
|
complete -c grep -s I -d (_ "Skip binary files")
|
||||||
complete -c grep -s i -l ignore-case -d "Ignore case"
|
complete -c grep -s i -l ignore-case -d (_ "Ignore case")
|
||||||
complete -c grep -s L -l files-without-match -d "Print first non-matching file"
|
complete -c grep -s L -l files-without-match -d (_ "Print first non-matching file")
|
||||||
complete -c grep -s l -l files-with-match -d "Print first matching file"
|
complete -c grep -s l -l files-with-match -d (_ "Print first matching file")
|
||||||
complete -c grep -s m -l max-count -d "Stop reading after NUM matches"
|
complete -c grep -s m -l max-count -d (_ "Stop reading after NUM matches")
|
||||||
complete -c grep -l mmap -d "Use the mmap system call to read input"
|
complete -c grep -l mmap -d (_ "Use the mmap system call to read input")
|
||||||
complete -c grep -s n -l line-number -d "Print linenumber"
|
complete -c grep -s n -l line-number -d (_ "Print linenumber")
|
||||||
complete -c grep -s o -l only-matching -d "Show only matching part"
|
complete -c grep -s o -l only-matching -d (_ "Show only matching part")
|
||||||
complete -c grep -l label -d "Rename stdin"
|
complete -c grep -l label -d (_ "Rename stdin")
|
||||||
complete -c grep -l line-buffered -d "Use line buffering"
|
complete -c grep -l line-buffered -d (_ "Use line buffering")
|
||||||
complete -c grep -s q -l quiet -d "Do not write anything"
|
complete -c grep -s q -l quiet -d (_ "Do not write anything")
|
||||||
complete -c grep -l silent -d "Do not write anything"
|
complete -c grep -l silent -d (_ "Do not write anything")
|
||||||
complete -c grep -s R -l recursive -d "Read files under each directory"
|
complete -c grep -s R -l recursive -d (_ "Read files under each directory")
|
||||||
complete -c grep -s r -d "Read files under each directory"
|
complete -c grep -s r -d (_ "Read files under each directory")
|
||||||
complete -c grep -l include -d "Recurse, search file matching PATTERN"
|
complete -c grep -l include -d (_ "Recurse, search file matching PATTERN")
|
||||||
complete -c grep -l exclude -d "Recurse, skip file matching PATTERN"
|
complete -c grep -l exclude -d (_ "Recurse, skip file matching PATTERN")
|
||||||
complete -c grep -s s -l no-messages -d "Suppress error messages"
|
complete -c grep -s s -l no-messages -d (_ "Suppress error messages")
|
||||||
complete -c grep -s U -l binary -d "Treat files as binary"
|
complete -c grep -s U -l binary -d (_ "Treat files as binary")
|
||||||
complete -c grep -s u -l unix-byte-offsets -d "Report Unix-style byte offsets"
|
complete -c grep -s u -l unix-byte-offsets -d (_ "Report Unix-style byte offsets")
|
||||||
complete -c grep -s V -l version -d "Print the version number"
|
complete -c grep -s V -l version -d (_ "Display version and exit")
|
||||||
complete -c grep -s v -l invert-match -d "Invert the sense of matching"
|
complete -c grep -s v -l invert-match -d (_ "Invert the sense of matching")
|
||||||
complete -c grep -s w -l word-regexp -d "Only whole matching words"
|
complete -c grep -s w -l word-regexp -d (_ "Only whole matching words")
|
||||||
complete -c grep -s x -l line-regexp -d "Only whole matching lines"
|
complete -c grep -s x -l line-regexp -d (_ "Only whole matching lines")
|
||||||
complete -c grep -s y -d "Synonym for -i"
|
complete -c grep -s y -d (_ "Synonym for -i")
|
||||||
complete -c grep -s Z -l null -d "Output a zero byte after filename"
|
complete -c grep -s Z -l null -d (_ "Output a zero byte after filename")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
complete -c gunzip -s c -l stdout -d "Compress to stdout"
|
complete -c gunzip -s c -l stdout -d (_ "Compress to stdout")
|
||||||
complete -c gunzip -x -a "(
|
complete -c gunzip -x -a "(
|
||||||
__fish_complete_suffix (commandline -ct) .gz 'Compressed file'
|
__fish_complete_suffix (commandline -ct) .gz 'Compressed file'
|
||||||
__fish_complete_suffix (commandline -ct) .tgz 'Compressed archive'
|
__fish_complete_suffix (commandline -ct) .tgz 'Compressed archive'
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
complete -c gunzip -s f -l force -d "Overwrite"
|
complete -c gunzip -s f -l force -d (_ "Overwrite")
|
||||||
complete -c gunzip -s h -l help -d "Display help"
|
complete -c gunzip -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c gunzip -s l -l list -d "List compression information"
|
complete -c gunzip -s l -l list -d (_ "List compression information")
|
||||||
complete -c gunzip -s L -l license -d "Print license"
|
complete -c gunzip -s L -l license -d (_ "Print license")
|
||||||
complete -c gunzip -s n -l no-name -d "Do not save/restore filename"
|
complete -c gunzip -s n -l no-name -d (_ "Do not save/restore filename")
|
||||||
complete -c gunzip -s N -l name -d "Save/restore filename"
|
complete -c gunzip -s N -l name -d (_ "Save/restore filename")
|
||||||
complete -c gunzip -s q -l quiet -d "Supress warnings"
|
complete -c gunzip -s q -l quiet -d (_ "Supress warnings")
|
||||||
complete -c gunzip -s r -l recursive -d "Recurse directories"
|
complete -c gunzip -s r -l recursive -d (_ "Recurse directories")
|
||||||
complete -c gunzip -s S -l suffix -r -d "Suffix"
|
complete -c gunzip -s S -l suffix -r -d (_ "Suffix")
|
||||||
complete -c gunzip -s t -l test -d "Check integrity"
|
complete -c gunzip -s t -l test -d (_ "Check integrity")
|
||||||
complete -c gunzip -s v -l verbose -d "Display compression ratios"
|
complete -c gunzip -s v -l verbose -d (_ "Display compression ratios")
|
||||||
complete -c gunzip -s V -l version -d "Display version"
|
complete -c gunzip -s V -l version -d (_ "Display version and exit")
|
||||||
|
|
||||||
complete -c gunzip -x -a "(
|
complete -c gunzip -x -a "(
|
||||||
__fish_complete_suffix (commandline -ct) .gz 'Compressed file'
|
__fish_complete_suffix (commandline -ct) .gz 'Compressed file'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
complete -c gzip -s c -l stdout -d "Compress to stdout"
|
complete -c gzip -s c -l stdout -d (_ "Compress to stdout")
|
||||||
complete -c gzip -s d -l decompress -x -a "
|
complete -c gzip -s d -l decompress -x -a "
|
||||||
(
|
(
|
||||||
__fish_complete_suffix (commandline -ct) .gz 'Compressed file'
|
__fish_complete_suffix (commandline -ct) .gz 'Compressed file'
|
||||||
@@ -6,18 +6,18 @@ complete -c gzip -s d -l decompress -x -a "
|
|||||||
)
|
)
|
||||||
"
|
"
|
||||||
|
|
||||||
complete -c gzip -s f -l force -d "Overwrite"
|
complete -c gzip -s f -l force -d (_ "Overwrite")
|
||||||
complete -c gzip -s h -l help -d "Display help"
|
complete -c gzip -s h -l help -d (_ "Display help and exit")
|
||||||
complete -c gzip -s l -l list -d "List compression information"
|
complete -c gzip -s l -l list -d (_ "List compression information")
|
||||||
complete -c gzip -s L -l license -d "Print license"
|
complete -c gzip -s L -l license -d (_ "Print license")
|
||||||
complete -c gzip -s n -l no-name -d "Do not save/restore filename"
|
complete -c gzip -s n -l no-name -d (_ "Do not save/restore filename")
|
||||||
complete -c gzip -s N -l name -d "Save/restore filename"
|
complete -c gzip -s N -l name -d (_ "Save/restore filename")
|
||||||
complete -c gzip -s q -l quiet -d "Supress warnings"
|
complete -c gzip -s q -l quiet -d (_ "Supress warnings")
|
||||||
complete -c gzip -s r -l recursive -d "Recurse directories"
|
complete -c gzip -s r -l recursive -d (_ "Recurse directories")
|
||||||
complete -c gzip -s S -l suffix -r -d "Suffix"
|
complete -c gzip -s S -l suffix -r -d (_ "Suffix")
|
||||||
complete -c gzip -s t -l test -d "Check integrity"
|
complete -c gzip -s t -l test -d (_ "Check integrity")
|
||||||
complete -c gzip -s v -l verbose -d "Display compression ratios"
|
complete -c gzip -s v -l verbose -d (_ "Display compression ratios")
|
||||||
complete -c gzip -s V -l version -d "Display version"
|
complete -c gzip -s V -l version -d (_ "Display version and exit")
|
||||||
complete -c gzip -s 1 -l fast -d "Use fast setting"
|
complete -c gzip -s 1 -l fast -d (_ "Use fast setting")
|
||||||
complete -c gzip -s 9 -l best -d "Use high compression setting"
|
complete -c gzip -s 9 -l best -d (_ "Use high compression setting")
|
||||||
|
|
||||||
|
|||||||
@@ -3,31 +3,34 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
for i in (builtin -n)
|
for i in (builtin -n)
|
||||||
complete -c help -x -a $i -d 'Help for the '$i' builtin'
|
complete -c help -x -a $i -d (printf (_ "Help for the '%s' builtin") $i)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i in count dirh dirs help mimedb nextd open popd prevd pushd set_color tokenize psub umask type
|
for i in count dirh dirs help mimedb nextd open popd prevd pushd set_color psub umask type
|
||||||
complete -c help -x -a $i -d 'Help for the '$i' command'
|
complete -c help -x -a $i -d (printf (_ "Help for the '%s' command") $i )
|
||||||
end
|
end
|
||||||
|
|
||||||
for i in syntax todo bugs history;
|
for i in syntax todo bugs history;
|
||||||
complete -c help -x -a $i -d 'Help section on '$i
|
complete -c help -x -a $i -d (printf (_ "Help section on %s") $i)
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -c help -x -a completion -d "Help on how tab-completion works"
|
complete -c help -x -a completion -d (_ "Help on how tab-completion works")
|
||||||
complete -c help -x -a job-control -d "Help on how job control works"
|
complete -c help -x -a job-control -d (_ "Help on how job control works")
|
||||||
complete -c help -x -a difference -d "Summary on how fish differs from other shells"
|
complete -c help -x -a difference -d (_ "Summary on how fish differs from other shells")
|
||||||
|
|
||||||
complete -c help -x -a prompt -d "Help on how to set the prompt"
|
complete -c help -x -a prompt -d (_ "Help on how to set the prompt")
|
||||||
complete -c help -x -a title -d "Help on how to set the titlebar message"
|
complete -c help -x -a title -d (_ "Help on how to set the titlebar message")
|
||||||
complete -c help -x -a killring -d "Help on how to copy and paste"
|
complete -c help -x -a killring -d (_ "Help on how to copy and paste")
|
||||||
complete -c help -x -a editor -d "Help on editor shortcuts"
|
complete -c help -x -a editor -d (_ "Help on editor shortcuts")
|
||||||
complete -c help -x -a expand -d "Help on parameter expantion (Globbing)"
|
complete -c help -x -a variables -d (_ "Help on environment variables")
|
||||||
complete -c help -x -a globbing -d "Help on parameter expantion (Globbing)"
|
complete -c help -x -a color -d (_ "Help on setting syntax highlighting colors")
|
||||||
complete -c help -x -a variables -d "Help on environment variables"
|
complete -c help -x -a builtin-overview -d (_ "A short summary of all builtin commands")
|
||||||
complete -c help -x -a color -d "Help on setting syntax highlighting colors"
|
|
||||||
complete -c help -x -a prompt -d "Help on changing the prompt"
|
|
||||||
complete -c help -x -a title -d "Help on changing the titlebar messages"
|
|
||||||
complete -c help -x -a builtin-overview -d "A short summary of all builtin commands"
|
|
||||||
complete -c help -x -a changes -d "The changelog"
|
|
||||||
|
|
||||||
|
complete -c help -x -a globbing -d (_ "Help on parameter expansion (Globbing)")
|
||||||
|
complete -c help -x -a expand -d (_ "Help on parameter expansion (Globbing)")
|
||||||
|
complete -c help -x -a expand-variable -d (_ "Help on variable expansion \$VARNAME")
|
||||||
|
complete -c help -x -a expand-home -d (_ "Help on home directory expansion ~USER")
|
||||||
|
complete -c help -x -a expand-brace -d (_ "Help on brace expansion {a,b,c}")
|
||||||
|
complete -c help -x -a expand-wildcard -d (_ "Help on wildcard expansion *.*")
|
||||||
|
complete -c help -x -a expand-command-substitution -d (_ "Help on command substututions (SUBCOMMAND)")
|
||||||
|
complete -c help -x -a expand-process -d (_ "Help on process expansion %JOB")
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user