mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 03:21:16 -03:00
Compare commits
172 Commits
1.23.0
...
pre_fishfi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71bff26607 | ||
|
|
23bc10dfe6 | ||
|
|
8ae00697c9 | ||
|
|
b0c6d891e9 | ||
|
|
548164cd5e | ||
|
|
f12fd3707e | ||
|
|
8b407a32ff | ||
|
|
344b9bdba3 | ||
|
|
834ea94eb9 | ||
|
|
a060cc5893 | ||
|
|
7ef0b3b821 | ||
|
|
39a2fd1717 | ||
|
|
c66ec4df3d | ||
|
|
c25c48f763 | ||
|
|
5105d8d87e | ||
|
|
35af336ff6 | ||
|
|
157ca12d4b | ||
|
|
e9d1a54983 | ||
|
|
c8981c048f | ||
|
|
1ae44c6b3c | ||
|
|
b2887477e3 | ||
|
|
8e2db29c9a | ||
|
|
d38de7365a | ||
|
|
cde6067cae | ||
|
|
2583638f4b | ||
|
|
11360b018f | ||
|
|
bdfc62184d | ||
|
|
74f06d550a | ||
|
|
46986ad4c2 | ||
|
|
6a5d6471c5 | ||
|
|
cf0850edfd | ||
|
|
fd4ac87382 | ||
|
|
164144f126 | ||
|
|
f2ad4a2e8e | ||
|
|
df23913bb8 | ||
|
|
4ccf26fbcc | ||
|
|
081e277fe4 | ||
|
|
dcecab384a | ||
|
|
4f9b07e979 | ||
|
|
9b97c55546 | ||
|
|
364d3dbbf8 | ||
|
|
9f3a4d1640 | ||
|
|
5fca92994f | ||
|
|
fefd17fe5e | ||
|
|
6b243fbcd3 | ||
|
|
82f8c3834e | ||
|
|
e0ba91db31 | ||
|
|
fa148bf59f | ||
|
|
1b0ce33669 | ||
|
|
0cf2a1eb33 | ||
|
|
8a46a8ecb2 | ||
|
|
4f0221bc4f | ||
|
|
ce08bb2ad2 | ||
|
|
93f797326e | ||
|
|
ceba377ab8 | ||
|
|
b9b6e867df | ||
|
|
f47caefdb9 | ||
|
|
41ae7bccc2 | ||
|
|
1e27024d75 | ||
|
|
6654fff377 | ||
|
|
89d999df72 | ||
|
|
a941d82be3 | ||
|
|
694cdf5ae1 | ||
|
|
2bfe4afea2 | ||
|
|
d559c3fe2e | ||
|
|
27df727ca1 | ||
|
|
8910226d2f | ||
|
|
04f58b1a31 | ||
|
|
1b9dd0c75f | ||
|
|
a7af415b6a | ||
|
|
f8a5a59513 | ||
|
|
ac3dfb3f96 | ||
|
|
d957d23d8f | ||
|
|
d049947801 | ||
|
|
21a10c3c74 | ||
|
|
04951f8b34 | ||
|
|
c08bae6aeb | ||
|
|
3aa107c4ae | ||
|
|
e196091714 | ||
|
|
d35d65cc40 | ||
|
|
7f7b30959b | ||
|
|
70322077d2 | ||
|
|
f529b2e057 | ||
|
|
c6372a1b3f | ||
|
|
41b8db063c | ||
|
|
1b16758d7e | ||
|
|
51b5adc306 | ||
|
|
56f8993b8c | ||
|
|
8c4d1ca587 | ||
|
|
ec8b3593f3 | ||
|
|
5c9b42e260 | ||
|
|
7914c92824 | ||
|
|
208be0f4d4 | ||
|
|
7cfac5bb59 | ||
|
|
1bd09bfd40 | ||
|
|
517751f2a3 | ||
|
|
006952c571 | ||
|
|
7a8b7201a1 | ||
|
|
1157e4d7b2 | ||
|
|
6b8e7b16f6 | ||
|
|
1eb089d722 | ||
|
|
e50d0c18b0 | ||
|
|
810d5f9548 | ||
|
|
e0c317dfd4 | ||
|
|
d5320fb9f9 | ||
|
|
14c84ffbcb | ||
|
|
f71c6f3f0e | ||
|
|
6dbb9e070d | ||
|
|
47ae2a05ce | ||
|
|
810262118a | ||
|
|
f5be301a2f | ||
|
|
b1357d11b2 | ||
|
|
5fc42fcaff | ||
|
|
c1cf6a4071 | ||
|
|
972f3e121e | ||
|
|
0dd8ae4843 | ||
|
|
8a93b6f26d | ||
|
|
07717a3570 | ||
|
|
79784d3e18 | ||
|
|
c08c313c0a | ||
|
|
dfd70057b3 | ||
|
|
07dec5c3ed | ||
|
|
1ed5decf2c | ||
|
|
9b95dda6bf | ||
|
|
41015691db | ||
|
|
7e1ac2d806 | ||
|
|
35258bf1fb | ||
|
|
72025a6a38 | ||
|
|
05341b055b | ||
|
|
9d7224d756 | ||
|
|
33ec8b45a0 | ||
|
|
1dc49a4062 | ||
|
|
1123467991 | ||
|
|
4f54da3795 | ||
|
|
c8de3d24c8 | ||
|
|
31439ffb52 | ||
|
|
9111b85437 | ||
|
|
c6427c5a47 | ||
|
|
36c3bd4e8d | ||
|
|
dad549afd1 | ||
|
|
e73c2be216 | ||
|
|
b0d324f1a7 | ||
|
|
d7396ac59f | ||
|
|
3f439e9cd3 | ||
|
|
0b722864c0 | ||
|
|
75e26f0f94 | ||
|
|
8cacb33347 | ||
|
|
bf7d62fd91 | ||
|
|
4ac31e637d | ||
|
|
0ad64ad2e4 | ||
|
|
523096e5d8 | ||
|
|
0de629e009 | ||
|
|
1f6fa1208e | ||
|
|
b86856b454 | ||
|
|
6598320534 | ||
|
|
0a66dc4a31 | ||
|
|
88a2b622df | ||
|
|
e10f75483f | ||
|
|
1a66fc4c5d | ||
|
|
905b792de7 | ||
|
|
804f5ab334 | ||
|
|
f974c7c416 | ||
|
|
f3b6b74568 | ||
|
|
ab94a397c3 | ||
|
|
537ab32dd9 | ||
|
|
a2660cfb76 | ||
|
|
3743a5758b | ||
|
|
e510d10c77 | ||
|
|
f5540ff958 | ||
|
|
c2b28063e1 | ||
|
|
8d2564291d | ||
|
|
87db9517e9 |
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
*.o
|
||||
*~
|
||||
|
||||
Doxyfile.help
|
||||
Makefile
|
||||
autom4te.cache/
|
||||
command_list.txt
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
doc.h
|
||||
doc_src/commands.hdr
|
||||
doc_src/index.hdr
|
||||
etc/config.fish
|
||||
po/*.gmo
|
||||
fish
|
||||
fish.spec
|
||||
fish_indent
|
||||
fish_pager
|
||||
fish_tests
|
||||
fishd
|
||||
mimedb
|
||||
seq
|
||||
set_color
|
||||
share/config.fish
|
||||
share/man/
|
||||
toc.txt
|
||||
user_doc/
|
||||
xsel-1.2.0/
|
||||
tests/*tmp.*
|
||||
tests/foo.txt
|
||||
3
CHANGELOG
Normal file
3
CHANGELOG
Normal file
@@ -0,0 +1,3 @@
|
||||
24-01-2012 Jan Kanis
|
||||
* Added a changelog file
|
||||
* removed unescaping if the 'commandline' builtin is called without the -o (tokenise) flag
|
||||
29
Doxyfile
29
Doxyfile
@@ -53,16 +53,6 @@ CREATE_SUBDIRS = NO
|
||||
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
# This tag can be used to specify the encoding used in the generated output.
|
||||
# The encoding is not always determined by the language that is chosen,
|
||||
# but also whether or not the output is meant for Windows or non-Windows users.
|
||||
# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
|
||||
# forces the Windows encoding (this is the default for the Windows binary),
|
||||
# whereas setting the tag to NO uses a Unix-style encoding (the default for
|
||||
# all platforms other than Windows).
|
||||
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
|
||||
# include brief member descriptions after the members that are listed in
|
||||
# the file and class documentation (similar to JavaDoc).
|
||||
@@ -444,7 +434,8 @@ RECURSIVE = NO
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE =
|
||||
EXCLUDE = print_help.c xdgmimealias.c xdgmimealias.h xdgmime.c xdgmimeglob.c xdgmimeglob.h xdgmime.h xdgmimeint.c xdgmimeint.h xdgmimemagic.c xdgmimemagic.h xdgmimeparent.c xdgmimeparent.h
|
||||
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
|
||||
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
|
||||
@@ -1112,22 +1103,6 @@ DOT_PATH =
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_WIDTH = 750
|
||||
|
||||
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
|
||||
# graphs generated by dot. A depth value of 3 means that only nodes reachable
|
||||
# from the root by following a path via at most 3 edges will be shown. Nodes that
|
||||
|
||||
31
Makefile.in
31
Makefile.in
@@ -31,6 +31,8 @@
|
||||
# hallucinations.
|
||||
#
|
||||
|
||||
# Used by docdir
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
|
||||
#
|
||||
# Programs
|
||||
@@ -46,6 +48,7 @@ INSTALL:=@INSTALL@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datarootdir = @datarootdir@
|
||||
datadir = @datadir@
|
||||
bindir = @bindir@
|
||||
mandir = @mandir@
|
||||
@@ -60,7 +63,7 @@ optbindirs = @optbindirs@
|
||||
#
|
||||
|
||||
MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\"
|
||||
CFLAGS = @CFLAGS@ $(MACROS)
|
||||
CFLAGS = @CFLAGS@ $(MACROS) $(EXTRA_CFLAGS)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LIBS@ @LDFLAGS@
|
||||
LDFLAGS_FISH = ${LDFLAGS} @LIBS_FISH@ @LDFLAGS_FISH@
|
||||
@@ -245,7 +248,7 @@ FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
|
||||
#
|
||||
|
||||
SIMPLE_PROGRAMS := fish set_color mimedb fish_pager fishd fish_indent
|
||||
PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL@ @SEQ_FALLBACK@
|
||||
PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL_BIN@ @SEQ_FALLBACK@
|
||||
|
||||
|
||||
#
|
||||
@@ -264,6 +267,13 @@ TRANSLATIONS_SRC := $(wildcard po/*.po)
|
||||
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
|
||||
|
||||
|
||||
#
|
||||
# Extra util
|
||||
#
|
||||
|
||||
XSEL := @XSEL@
|
||||
XSEL_BIN := @XSEL_BIN@
|
||||
|
||||
#
|
||||
# Make everything needed for installing fish
|
||||
#
|
||||
@@ -292,9 +302,12 @@ Makefile: Makefile.in configure
|
||||
#
|
||||
|
||||
debug:
|
||||
$(MAKE) fish CFLAGS="@CFLAGS@ $(MACROS) -O0 -Wno-unused -Werror -g"
|
||||
$(MAKE) all EXTRA_CFLAGS="-O0 -Wno-unused -Werror -g"
|
||||
.PHONY: debug
|
||||
|
||||
prof:
|
||||
$(MAKE) all EXTRA_CFLAGS="-pg" LDFLAGS="-pg"
|
||||
.PHONY: prof
|
||||
|
||||
#
|
||||
# User documentation, describing the features of the fish shell.
|
||||
@@ -342,11 +355,8 @@ test: $(PROGRAMS) fish_tests
|
||||
# Build the xsel program, which is maintained in its own tarball
|
||||
#
|
||||
|
||||
xsel-0.9.6:
|
||||
tar -xf xsel-0.9.6.tar
|
||||
|
||||
xsel-0.9.6/xsel: xsel-0.9.6
|
||||
cd xsel-0.9.6; ./configure && make || echo "Failed to build xsel - either add the required dependencies or use './configure --without-xsel' to disable it."
|
||||
$(XSEL_BIN):
|
||||
$(MAKE) -C $(XSEL) || echo "Failed to build xsel - either add the required dependencies or use './configure --without-xsel' to disable it."
|
||||
|
||||
|
||||
#
|
||||
@@ -749,7 +759,7 @@ fish_indent: $(FISH_INDENT_OBJS)
|
||||
#
|
||||
|
||||
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o
|
||||
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@
|
||||
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o $(LDFLAGS_FISH) -o $@
|
||||
|
||||
|
||||
#
|
||||
@@ -857,6 +867,7 @@ distclean: clean
|
||||
rm -f fish.spec Doxyfile.help
|
||||
rm -f etc/config.fish seq share/config.fish
|
||||
rm -f config.status config.log config.h Makefile
|
||||
rm -rf $(XSEL)
|
||||
.PHONY: distclean
|
||||
|
||||
|
||||
@@ -875,8 +886,8 @@ clean:
|
||||
rm -f fish-@PACKAGE_VERSION@.tar.bz2
|
||||
rm -rf doc;
|
||||
rm -rf fish-@PACKAGE_VERSION@
|
||||
rm -rf xsel-0.9.6/
|
||||
rm -f $(TRANSLATIONS)
|
||||
test ! -d "$(XSEL)" || make -C $(XSEL) clean
|
||||
.PHONY: clean
|
||||
|
||||
|
||||
|
||||
160
builtin.c
160
builtin.c
@@ -407,6 +407,9 @@ static void builtin_missing_argument( const wchar_t *cmd, const wchar_t *opt )
|
||||
#include "builtin_ulimit.c"
|
||||
#include "builtin_jobs.c"
|
||||
|
||||
/**
|
||||
List all current key bindings
|
||||
*/
|
||||
static void builtin_bind_list()
|
||||
{
|
||||
array_list_t lst;
|
||||
@@ -442,6 +445,13 @@ static void builtin_bind_list()
|
||||
al_destroy( &lst );
|
||||
}
|
||||
|
||||
/**
|
||||
Print terminfo key binding names to string buffer used for standard output.
|
||||
|
||||
\param all if set, all terminfo key binding names will be
|
||||
printed. If not set, only ones that are defined for this terminal
|
||||
are printed.
|
||||
*/
|
||||
static void builtin_bind_key_names( int all )
|
||||
{
|
||||
array_list_t lst;
|
||||
@@ -460,6 +470,10 @@ static void builtin_bind_key_names( int all )
|
||||
al_destroy( &lst );
|
||||
}
|
||||
|
||||
/**
|
||||
Print all the special key binding functions to string buffer used for standard output.
|
||||
|
||||
*/
|
||||
static void builtin_bind_function_names()
|
||||
{
|
||||
array_list_t lst;
|
||||
@@ -478,6 +492,9 @@ static void builtin_bind_function_names()
|
||||
al_destroy( &lst );
|
||||
}
|
||||
|
||||
/**
|
||||
Add specified key binding.
|
||||
*/
|
||||
static int builtin_bind_add( wchar_t *seq, wchar_t *cmd, int terminfo )
|
||||
{
|
||||
|
||||
@@ -526,6 +543,12 @@ static int builtin_bind_add( wchar_t *seq, wchar_t *cmd, int terminfo )
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Erase specified key bindings
|
||||
|
||||
\param seq an array of all key bindings to erase
|
||||
\param all if specified, _all_ key bindings will be erased
|
||||
*/
|
||||
static void builtin_bind_erase( wchar_t **seq, int all )
|
||||
{
|
||||
if( all )
|
||||
@@ -579,7 +602,7 @@ static int builtin_bind( wchar_t **argv )
|
||||
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -750,7 +773,7 @@ static int builtin_block( wchar_t **argv )
|
||||
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -902,7 +925,7 @@ static int builtin_builtin( wchar_t **argv )
|
||||
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -983,14 +1006,16 @@ static int builtin_builtin( wchar_t **argv )
|
||||
return STATUS_BUILTIN_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Implementation of the builtin emit command, used to create events.
|
||||
*/
|
||||
static int builtin_emit( wchar_t **argv )
|
||||
{
|
||||
int argc=builtin_count_args( argv );
|
||||
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -1061,7 +1086,7 @@ static int builtin_generic( wchar_t **argv )
|
||||
int argc=builtin_count_args( argv );
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -1227,10 +1252,11 @@ static int builtin_functions( wchar_t **argv )
|
||||
int show_hidden=0;
|
||||
int res = STATUS_BUILTIN_OK;
|
||||
int query = 0;
|
||||
int copy = 0;
|
||||
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -1257,6 +1283,10 @@ static int builtin_functions( wchar_t **argv )
|
||||
L"query", no_argument, 0, 'q'
|
||||
}
|
||||
,
|
||||
{
|
||||
L"copy", no_argument, 0, 'c'
|
||||
}
|
||||
,
|
||||
{
|
||||
0, 0, 0, 0
|
||||
}
|
||||
@@ -1269,7 +1299,7 @@ static int builtin_functions( wchar_t **argv )
|
||||
|
||||
int opt = wgetopt_long( argc,
|
||||
argv,
|
||||
L"ed:nahq",
|
||||
L"ed:nahqc",
|
||||
long_options,
|
||||
&opt_index );
|
||||
if( opt == -1 )
|
||||
@@ -1313,6 +1343,10 @@ static int builtin_functions( wchar_t **argv )
|
||||
query = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
copy = 1;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
builtin_unknown_option( argv[0], argv[woptind-1] );
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
@@ -1322,9 +1356,9 @@ static int builtin_functions( wchar_t **argv )
|
||||
}
|
||||
|
||||
/*
|
||||
Erase, desc, query and list are mutually exclusive
|
||||
Erase, desc, query, copy and list are mutually exclusive
|
||||
*/
|
||||
if( (erase + (!!desc) + list + query) > 1 )
|
||||
if( (erase + (!!desc) + list + query + copy) > 1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Invalid combination of options\n" ),
|
||||
@@ -1409,6 +1443,61 @@ static int builtin_functions( wchar_t **argv )
|
||||
al_destroy( &names );
|
||||
return STATUS_BUILTIN_OK;
|
||||
}
|
||||
else if( copy )
|
||||
{
|
||||
wchar_t *current_func;
|
||||
wchar_t *new_func;
|
||||
|
||||
if( argc-woptind != 2 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Expected exactly two names (current function name, and new function name)\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help ( argv[0], sb_err );
|
||||
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
current_func = argv[woptind];
|
||||
new_func = argv[woptind+1];
|
||||
|
||||
if( !function_exists( current_func ) )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Function '%ls' does not exist\n" ),
|
||||
argv[0],
|
||||
current_func );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
if( (wcsfuncname( new_func ) != 0) || parser_keywords_is_reserved( new_func ) )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Illegal function name '%ls'\n"),
|
||||
argv[0],
|
||||
new_func );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
// keep things simple: don't allow existing names to be copy targets.
|
||||
if( function_exists( new_func ) )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Function '%ls' already exists. Cannot create copy '%ls'\n" ),
|
||||
argv[0],
|
||||
new_func,
|
||||
current_func );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
if( function_copy( current_func, new_func ) )
|
||||
return STATUS_BUILTIN_OK;
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
for( i=woptind; i<argc; i++ )
|
||||
{
|
||||
@@ -1451,7 +1540,7 @@ static int builtin_function( wchar_t **argv )
|
||||
parser_push_block( FUNCTION_DEF );
|
||||
events=al_halloc( current_block );
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -1822,7 +1911,7 @@ static int builtin_random( wchar_t **argv )
|
||||
|
||||
woptind=0;
|
||||
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -1945,7 +2034,7 @@ static int builtin_read( wchar_t **argv )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
@@ -1981,7 +2070,7 @@ static int builtin_read( wchar_t **argv )
|
||||
}
|
||||
,
|
||||
{
|
||||
L"shell", required_argument, 0, 's'
|
||||
L"shell", no_argument, 0, 's'
|
||||
}
|
||||
,
|
||||
{
|
||||
@@ -2133,6 +2222,8 @@ static int builtin_read( wchar_t **argv )
|
||||
|
||||
reader_set_buffer( commandline, wcslen( commandline ) );
|
||||
proc_push_interactive( 1 );
|
||||
|
||||
event_fire_generic(L"fish_prompt");
|
||||
line = reader_readline( );
|
||||
proc_pop_interactive();
|
||||
if( line )
|
||||
@@ -2529,23 +2620,6 @@ static int builtin_exit( wchar_t **argv )
|
||||
return ec;
|
||||
}
|
||||
|
||||
/**
|
||||
Helper function for builtin_cd, used for seting the current working
|
||||
directory
|
||||
*/
|
||||
static int set_pwd( wchar_t *env)
|
||||
{
|
||||
wchar_t dir_path[4096];
|
||||
wchar_t *res = wgetcwd( dir_path, 4096 );
|
||||
if( !res )
|
||||
{
|
||||
builtin_wperror( L"wgetcwd" );
|
||||
return STATUS_BUILTIN_OK;
|
||||
}
|
||||
env_set( env, dir_path, ENV_EXPORT | ENV_GLOBAL );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
The cd builtin. Changes the current directory to the one specified
|
||||
or to $HOME if none is specified. The directory can be relative to
|
||||
@@ -2649,7 +2723,7 @@ static int builtin_cd( wchar_t **argv )
|
||||
|
||||
res = 1;
|
||||
}
|
||||
else if( !set_pwd(L"PWD") )
|
||||
else if( !env_set_pwd() )
|
||||
{
|
||||
res=1;
|
||||
sb_printf( sb_err, _( L"%ls: Could not set PWD variable\n" ), argv[0] );
|
||||
@@ -2660,7 +2734,10 @@ static int builtin_cd( wchar_t **argv )
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Implementation of the builtin count command, used to count the
|
||||
number of arguments sent to it.
|
||||
*/
|
||||
static int builtin_count( wchar_t ** argv )
|
||||
{
|
||||
int argc;
|
||||
@@ -2669,6 +2746,10 @@ static int builtin_count( wchar_t ** argv )
|
||||
return !(argc-1);
|
||||
}
|
||||
|
||||
/**
|
||||
Implementation of the builtin contains command, used to check if a
|
||||
specified string is part of a list.
|
||||
*/
|
||||
static int builtin_contains( wchar_t ** argv )
|
||||
{
|
||||
int argc;
|
||||
@@ -2832,7 +2913,7 @@ static int builtin_source( wchar_t ** argv )
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Error while reading file '%ls'\n" ),
|
||||
argv[0],
|
||||
fn_intern == L"-" ? L"<stdin>" : fn_intern );
|
||||
fn_intern == intern_static(L"-") ? L"<stdin>" : fn_intern );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3408,11 +3489,16 @@ static int builtin_break_continue( wchar_t **argv )
|
||||
return STATUS_BUILTIN_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
Implementation of the builtin count command, used to launch the
|
||||
interactive debugger.
|
||||
*/
|
||||
|
||||
static int builtin_breakpoint( wchar_t **argv )
|
||||
{
|
||||
parser_push_block( BREAKPOINT );
|
||||
|
||||
reader_read( 0, real_io );
|
||||
reader_read( STDIN_FILENO, real_io );
|
||||
|
||||
parser_pop_block();
|
||||
|
||||
@@ -3573,7 +3659,7 @@ static int builtin_case( wchar_t **argv )
|
||||
/**
|
||||
Data about all the builtin commands in fish
|
||||
*/
|
||||
const static builtin_data_t builtin_data[]=
|
||||
static const builtin_data_t builtin_data[]=
|
||||
{
|
||||
{
|
||||
L"block", &builtin_block, N_( L"Temporarily block delivery of events" )
|
||||
@@ -3785,7 +3871,7 @@ static int internal_help( wchar_t *cmd )
|
||||
{
|
||||
CHECK( cmd, 0 );
|
||||
return contains( cmd, L"for", L"while", L"function",
|
||||
L"if", L"end", L"switch" );
|
||||
L"if", L"end", L"switch", L"count" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ int builtin_exists( wchar_t *cmd );
|
||||
of the builtin. The list is terminated by a
|
||||
null pointer. This syntax resembles the syntax
|
||||
for exec.
|
||||
\param io the io redirections to perform on this builtin.
|
||||
|
||||
\return the exit status of the builtin command
|
||||
*/
|
||||
|
||||
@@ -52,7 +52,15 @@ enum
|
||||
}
|
||||
;
|
||||
|
||||
/**
|
||||
Pointer to what the commandline builtin considers to be the current
|
||||
contents of the command line buffer.
|
||||
*/
|
||||
static wchar_t *current_buffer=0;
|
||||
/**
|
||||
What the commandline builtin considers to be the current cursor
|
||||
position.
|
||||
*/
|
||||
static int current_cursor_pos = -1;
|
||||
|
||||
/**
|
||||
@@ -180,7 +188,7 @@ static void write_part( const wchar_t *begin,
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t *buff, *esc;
|
||||
wchar_t *buff;
|
||||
|
||||
if( cut_at_cursor )
|
||||
{
|
||||
@@ -188,14 +196,12 @@ static void write_part( const wchar_t *begin,
|
||||
}
|
||||
|
||||
buff = wcsndup( begin, end-begin );
|
||||
esc = unescape( buff, UNESCAPE_INCOMPLETE );
|
||||
|
||||
// debug( 0, L"woot2 %ls -> %ls", buff, esc );
|
||||
|
||||
sb_append( sb_out, esc );
|
||||
sb_append( sb_out, buff );
|
||||
sb_append( sb_out, L"\n" );
|
||||
|
||||
free( esc );
|
||||
free( buff );
|
||||
|
||||
}
|
||||
@@ -259,7 +265,7 @@ static int builtin_commandline( wchar_t **argv )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ Functions used for implementing the complete builtin.
|
||||
/**
|
||||
Internal storage for the builtin_get_temporary_buffer() function.
|
||||
*/
|
||||
const static wchar_t *temporary_buffer;
|
||||
static const wchar_t *temporary_buffer;
|
||||
|
||||
/*
|
||||
builtin_complete_* are a set of rather silly looping functions that
|
||||
@@ -308,11 +308,6 @@ static int builtin_complete( wchar_t **argv )
|
||||
|
||||
static int recursion_level=0;
|
||||
|
||||
if( !is_interactive_session )
|
||||
{
|
||||
debug( 1, _(L"%ls: Command only available in interactive sessions"), argv[0] );
|
||||
}
|
||||
|
||||
al_init( &cmd );
|
||||
al_init( &path );
|
||||
sb_init( &short_opt );
|
||||
@@ -325,7 +320,7 @@ static int builtin_complete( wchar_t **argv )
|
||||
|
||||
while( res == 0 )
|
||||
{
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
|
||||
@@ -173,7 +173,7 @@ static int builtin_jobs( wchar_t **argv )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
|
||||
@@ -417,7 +417,7 @@ static int builtin_set( wchar_t **argv )
|
||||
/**
|
||||
Variables used for parsing the argument list
|
||||
*/
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ struct resource_t
|
||||
/**
|
||||
Array of resource_t structs, describing all known resource types.
|
||||
*/
|
||||
const static struct resource_t resource_arr[] =
|
||||
static const struct resource_t resource_arr[] =
|
||||
{
|
||||
{
|
||||
RLIMIT_CORE, L"Maximum size of core files created", L'c', 1024
|
||||
@@ -266,7 +266,7 @@ static int builtin_ulimit( wchar_t ** argv )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
const static struct woption
|
||||
static const struct woption
|
||||
long_options[] =
|
||||
{
|
||||
{
|
||||
|
||||
57
common.c
57
common.c
@@ -578,6 +578,36 @@ int read_blocked(int fd, void *buf, size_t count)
|
||||
return res;
|
||||
}
|
||||
|
||||
ssize_t write_loop(int fd, char *buff, size_t count)
|
||||
{
|
||||
ssize_t out=0;
|
||||
ssize_t out_cum=0;
|
||||
while( 1 )
|
||||
{
|
||||
out = write( fd,
|
||||
&buff[out_cum],
|
||||
count - out_cum );
|
||||
if (out == -1)
|
||||
{
|
||||
if( errno != EAGAIN &&
|
||||
errno != EINTR )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
{
|
||||
out_cum += out;
|
||||
}
|
||||
if( out_cum >= count )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return out_cum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void debug( int level, const wchar_t *msg, ... )
|
||||
{
|
||||
va_list va;
|
||||
@@ -702,6 +732,11 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
|
||||
sb_append_char( buff, L'\n' );
|
||||
}
|
||||
|
||||
/**
|
||||
Perform string escaping of a strinng by only quoting it. Assumes
|
||||
the string has already been checked for characters that can not be
|
||||
escaped this way.
|
||||
*/
|
||||
static wchar_t *escape_simple( const wchar_t *in )
|
||||
{
|
||||
wchar_t *out;
|
||||
@@ -1800,3 +1835,25 @@ void sb_format_size( string_buffer_t *sb,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double timef()
|
||||
{
|
||||
int time_res;
|
||||
struct timeval tv;
|
||||
|
||||
time_res = gettimeofday(&tv, 0);
|
||||
|
||||
if( time_res )
|
||||
{
|
||||
/*
|
||||
Fixme: What on earth is the correct parameter value for NaN?
|
||||
The man pages and the standard helpfully state that this
|
||||
parameter is implementation defined. Gcc gives a warning if
|
||||
a null pointer is used. But not even all mighty Google gives
|
||||
a hint to what value should actually be returned.
|
||||
*/
|
||||
return nan("");
|
||||
}
|
||||
|
||||
return (double)tv.tv_sec + 0.000001*tv.tv_usec;
|
||||
}
|
||||
|
||||
35
common.h
35
common.h
@@ -40,11 +40,12 @@
|
||||
*/
|
||||
#define BYTE_MAX 0xffu
|
||||
|
||||
/*
|
||||
Escape special fish syntax characters liek the semicolon
|
||||
/**
|
||||
Escape special fish syntax characters like the semicolon
|
||||
*/
|
||||
#define UNESCAPE_SPECIAL 1
|
||||
/*
|
||||
|
||||
/**
|
||||
Allow incomplete escape sequences
|
||||
*/
|
||||
#define UNESCAPE_INCOMPLETE 2
|
||||
@@ -110,9 +111,9 @@ extern wchar_t *program_name;
|
||||
*/
|
||||
#define FATAL_EXIT() \
|
||||
{ \
|
||||
char c; \
|
||||
int exit_read_count;char exit_read_buff; \
|
||||
show_stackframe(); \
|
||||
read( 0, &c, 1 ); \
|
||||
exit_read_count=read( 0, &exit_read_buff, 1 ); \
|
||||
exit( 1 ); \
|
||||
} \
|
||||
|
||||
@@ -155,10 +156,16 @@ extern wchar_t *program_name;
|
||||
*/
|
||||
#define N_(wstr) wstr
|
||||
|
||||
/**
|
||||
Check if the specified stringelement is a part of the specified string list
|
||||
*/
|
||||
#define contains( str,... ) contains_internal( str, __VA_ARGS__, (void *)0 )
|
||||
/**
|
||||
Concatenate all the specified strings into a single newly allocated one
|
||||
*/
|
||||
#define wcsdupcat( str,... ) wcsdupcat_internal( str, __VA_ARGS__, (void *)0 )
|
||||
|
||||
/*
|
||||
/**
|
||||
Print a stack trace to stderr
|
||||
*/
|
||||
void show_stackframe();
|
||||
@@ -324,6 +331,12 @@ __sentinel int contains_internal( const wchar_t *needle, ... );
|
||||
*/
|
||||
int read_blocked(int fd, void *buf, size_t count);
|
||||
|
||||
/**
|
||||
Loop a write request while failiure is non-critical. Return -1 and set errno
|
||||
in case of critical error.
|
||||
*/
|
||||
ssize_t write_loop(int fd, char *buff, size_t count);
|
||||
|
||||
|
||||
/**
|
||||
Issue a debug message with printf-style string formating and
|
||||
@@ -440,5 +453,15 @@ void bugreport();
|
||||
void sb_format_size( string_buffer_t *sb,
|
||||
long long sz );
|
||||
|
||||
/**
|
||||
Return the number of seconds from the UNIX epoch, with subsecond
|
||||
precision. This function uses the gettimeofday function, and will
|
||||
have the same precision as that function.
|
||||
|
||||
If an error occurs, NAN is returned.
|
||||
*/
|
||||
double timef();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
121
complete.c
121
complete.c
@@ -1,6 +1,6 @@
|
||||
/** \file complete.c Functions related to tab-completion.
|
||||
|
||||
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
|
||||
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
@@ -58,7 +58,7 @@ These functions are used for storing and retrieving tab-completion data, as well
|
||||
/**
|
||||
Description for ~USER completion
|
||||
*/
|
||||
#define COMPLETE_USER_DESC _( L"Home for %s" )
|
||||
#define COMPLETE_USER_DESC _( L"Home for %ls" )
|
||||
|
||||
/**
|
||||
Description for short variables. The value is concatenated to this description
|
||||
@@ -107,6 +107,14 @@ These functions are used for storing and retrieving tab-completion data, as well
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
The maximum amount of time that we're willing to spend doing
|
||||
username tilde completion. This special limit has been coded in
|
||||
because user lookup can be extremely slow in cases of a humongous
|
||||
LDAP database. (Google, I'm looking at you)
|
||||
*/
|
||||
#define MAX_USER_LOOKUP_TIME 0.2
|
||||
|
||||
/**
|
||||
Struct describing a completion option entry.
|
||||
|
||||
@@ -1662,7 +1670,7 @@ static int complete_variable( const wchar_t *whole_var,
|
||||
{
|
||||
sb_append_substring( &comp, whole_var, start_offset );
|
||||
sb_append( &comp, name );
|
||||
flags = COMPLETE_NO_CASE;
|
||||
flags = COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE;
|
||||
}
|
||||
|
||||
value = expand_escape_variable( value_unescaped );
|
||||
@@ -1724,61 +1732,11 @@ static int try_complete_variable( const wchar_t *cmd,
|
||||
static int try_complete_user( const wchar_t *cmd,
|
||||
array_list_t *comp )
|
||||
{
|
||||
const wchar_t *first_char=0;
|
||||
const wchar_t *p;
|
||||
int mode = 0;
|
||||
int res = 0;
|
||||
const wchar_t *first_char=cmd;
|
||||
int res=0;
|
||||
double start_time = timef();
|
||||
|
||||
for( p=cmd; *p; p++ )
|
||||
{
|
||||
switch( mode )
|
||||
{
|
||||
/*Between parameters*/
|
||||
case 0:
|
||||
switch( *p )
|
||||
{
|
||||
case L'\"':
|
||||
mode=2;
|
||||
p++;
|
||||
first_char = p;
|
||||
break;
|
||||
case L' ':
|
||||
case L'\t':
|
||||
case L'\n':
|
||||
case L'\r':
|
||||
break;
|
||||
default:
|
||||
mode=1;
|
||||
first_char = p;
|
||||
}
|
||||
break;
|
||||
/*Inside non-quoted parameter*/
|
||||
case 1:
|
||||
switch( *p )
|
||||
{
|
||||
case L' ':
|
||||
case L'\t':
|
||||
case L'\n':
|
||||
case L'\r':
|
||||
mode = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch( *p )
|
||||
{
|
||||
case L'\"':
|
||||
if( *(p-1) != L'\\' )
|
||||
mode =0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( mode != 0 )
|
||||
{
|
||||
if( *first_char ==L'~' )
|
||||
if( *first_char ==L'~' && !wcschr(first_char, L'/'))
|
||||
{
|
||||
const wchar_t *user_name = first_char+1;
|
||||
wchar_t *name_end = wcschr( user_name, L'~' );
|
||||
@@ -1791,29 +1749,54 @@ static int try_complete_user( const wchar_t *cmd,
|
||||
|
||||
while((pw=getpwent()) != 0)
|
||||
{
|
||||
wchar_t *pw_name = str2wcs( pw->pw_name );
|
||||
double current_time = timef();
|
||||
wchar_t *pw_name;
|
||||
|
||||
if( current_time - start_time > 0.2 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
pw_name = str2wcs( pw->pw_name );
|
||||
|
||||
if( pw_name )
|
||||
{
|
||||
if( wcsncmp( user_name, pw_name, name_len )==0 )
|
||||
{
|
||||
string_buffer_t desc;
|
||||
string_buffer_t name;
|
||||
|
||||
sb_init( &name );
|
||||
sb_printf( &name,
|
||||
L"%ls/",
|
||||
&pw_name[name_len] );
|
||||
|
||||
sb_init( &desc );
|
||||
sb_printf( &desc,
|
||||
COMPLETE_USER_DESC,
|
||||
pw->pw_gecos );
|
||||
pw_name );
|
||||
|
||||
completion_allocate( comp,
|
||||
&pw_name[name_len],
|
||||
(wchar_t *)desc.buff,
|
||||
COMPLETE_NO_SPACE );
|
||||
|
||||
res=1;
|
||||
|
||||
sb_destroy( &desc );
|
||||
}
|
||||
else if( wcsncasecmp( user_name, pw_name, name_len )==0 )
|
||||
{
|
||||
string_buffer_t name;
|
||||
string_buffer_t desc;
|
||||
|
||||
sb_init( &name );
|
||||
sb_init( &desc );
|
||||
sb_printf( &name,
|
||||
L"~%ls",
|
||||
pw_name );
|
||||
sb_printf( &desc,
|
||||
COMPLETE_USER_DESC,
|
||||
pw_name );
|
||||
|
||||
completion_allocate( comp,
|
||||
(wchar_t *)name.buff,
|
||||
(wchar_t *)desc.buff,
|
||||
0 );
|
||||
|
||||
COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE | COMPLETE_NO_SPACE );
|
||||
res=1;
|
||||
|
||||
sb_destroy( &desc );
|
||||
@@ -1826,9 +1809,9 @@ static int try_complete_user( const wchar_t *cmd,
|
||||
endpwent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
11
complete.h
11
complete.h
@@ -94,6 +94,13 @@
|
||||
*/
|
||||
#define COMPLETE_AUTO_SPACE 8
|
||||
|
||||
/**
|
||||
This completion should be inserted as-is, without escaping.
|
||||
*/
|
||||
#define COMPLETE_DONT_ESCAPE 16
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -163,7 +170,7 @@ typedef struct
|
||||
\param comp A space separated list of completions which may contain subshells.
|
||||
\param desc A description of the completion.
|
||||
\param condition a command to be run to check it this completion should be used. If \c condition is empty, the completion is always used.
|
||||
|
||||
\param flags A set of completion flags
|
||||
*/
|
||||
void complete_add( const wchar_t *cmd,
|
||||
int cmd_type,
|
||||
@@ -242,7 +249,7 @@ void complete_load( const wchar_t *cmd, int reload );
|
||||
Create a new completion entry
|
||||
|
||||
\param context The halloc context to use for allocating new memory
|
||||
\pram comp The completion string
|
||||
\param comp The completion string
|
||||
\param desc The description of the completion
|
||||
\param flags completion flags
|
||||
*/
|
||||
|
||||
61
configure.ac
61
configure.ac
@@ -9,29 +9,35 @@
|
||||
# configure the build process.
|
||||
#
|
||||
|
||||
AC_INIT(fish,1.23.0,fish-users@lists.sf.net)
|
||||
AC_INIT(fish,1.23.1,fish-users@lists.sf.net)
|
||||
|
||||
#
|
||||
# preserve configure arguments for xsel
|
||||
#
|
||||
|
||||
conf_arg=$@
|
||||
|
||||
#
|
||||
# List of output variables produced by this configure script
|
||||
#
|
||||
|
||||
AC_SUBST( docdir )
|
||||
AC_SUBST( HAVE_GETTEXT )
|
||||
AC_SUBST( LDFLAGS_FISH )
|
||||
AC_SUBST( LIBS_FISH )
|
||||
AC_SUBST( LIBS_FISH_INDENT )
|
||||
AC_SUBST( LIBS_FISH_PAGER )
|
||||
AC_SUBST( LIBS_FISHD )
|
||||
AC_SUBST( LIBS_MIMEDB )
|
||||
AC_SUBST( LIBS_SET_COLOR )
|
||||
AC_SUBST( localedir )
|
||||
AC_SUBST( optbindirs )
|
||||
AC_SUBST( prefix )
|
||||
AC_SUBST( SEQ_FALLBACK )
|
||||
AC_SUBST( XSEL )
|
||||
AC_SUBST( XSEL_MAN )
|
||||
AC_SUBST( XSEL_MAN_PATH )
|
||||
AC_SUBST(docdir)
|
||||
AC_SUBST(HAVE_GETTEXT)
|
||||
AC_SUBST(LDFLAGS_FISH)
|
||||
AC_SUBST(LIBS_FISH)
|
||||
AC_SUBST(LIBS_FISH_INDENT)
|
||||
AC_SUBST(LIBS_FISH_PAGER)
|
||||
AC_SUBST(LIBS_FISHD)
|
||||
AC_SUBST(LIBS_MIMEDB)
|
||||
AC_SUBST(LIBS_SET_COLOR)
|
||||
AC_SUBST(localedir)
|
||||
AC_SUBST(optbindirs)
|
||||
AC_SUBST(prefix)
|
||||
AC_SUBST(SEQ_FALLBACK)
|
||||
AC_SUBST(XSEL)
|
||||
AC_SUBST(XSEL_MAN)
|
||||
AC_SUBST(XSEL_BIN)
|
||||
AC_SUBST(XSEL_MAN_PATH)
|
||||
|
||||
#
|
||||
# If needed, run autoconf to regenerate the configure file
|
||||
@@ -199,16 +205,18 @@ AC_ARG_WITH(
|
||||
xsel,
|
||||
AC_HELP_STRING(
|
||||
[--without-xsel],
|
||||
[do not build the xsel program needed for X clipboard integration]
|
||||
[do not build the xsel program needed for X clipboard integration.
|
||||
If build xsel, it will be configured with the same options as fish.]
|
||||
),
|
||||
[xsel=$withval],
|
||||
[xsel=with_xsel]
|
||||
)
|
||||
|
||||
if [[ "$xsel" = "with_xsel" ]]; then
|
||||
XSEL=xsel-0.9.6/xsel
|
||||
XSEL=xsel-1.2.0
|
||||
XSEL_BIN=$XSEL/xsel
|
||||
XSEL_MAN=xsel.1x
|
||||
XSEL_MAN_PATH=xsel-0.9.6/xsel.1x
|
||||
XSEL_MAN_PATH=$XSEL/xsel.1x
|
||||
fi
|
||||
|
||||
|
||||
@@ -505,6 +513,7 @@ LIBS=""
|
||||
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
|
||||
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
|
||||
AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
|
||||
LIBS_SHARED=$LIBS
|
||||
LIBS=$LIBS_COMMON
|
||||
|
||||
@@ -518,8 +527,10 @@ if test x$local_gettext != xno; then
|
||||
AC_SEARCH_LIBS( gettext, intl,,)
|
||||
fi
|
||||
|
||||
# Check for libiconv_open if we can't find iconv_open. Silly OS X does
|
||||
# weird macro magic for the sole purpose of amusing me.
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
|
||||
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
|
||||
LIBS_FISH=$LIBS
|
||||
LIBS=$LIBS_COMMON
|
||||
|
||||
@@ -544,6 +555,7 @@ LIBS="$LIBS_SHARED"
|
||||
if test x$local_gettext != xno; then
|
||||
AC_SEARCH_LIBS( gettext, intl,,)
|
||||
fi
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
|
||||
LIBS_FISH_PAGER=$LIBS
|
||||
LIBS=$LIBS_COMMON
|
||||
|
||||
@@ -556,6 +568,7 @@ LIBS="$LIBS_SHARED"
|
||||
if test x$local_gettext != xno; then
|
||||
AC_SEARCH_LIBS( gettext, intl,,)
|
||||
fi
|
||||
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
|
||||
LIBS_FISHD=$LIBS
|
||||
LIBS=$LIBS_COMMON
|
||||
|
||||
@@ -970,6 +983,12 @@ if test ! x$local_found_posix_switch = xyes; then
|
||||
echo "Some fish features may be disabled."
|
||||
fi
|
||||
|
||||
if [[ "$xsel" = "with_xsel" ]]; then
|
||||
echo "Now configure xsel with $conf_arg"
|
||||
rm -rf $XSEL
|
||||
tar xf $XSEL.tar.gz
|
||||
cd $XSEL && ./configure $conf_arg
|
||||
fi
|
||||
echo "fish is now configured."
|
||||
echo "Use 'make' and 'make install' to build and install fish."
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ variable.
|
||||
\subsection and-example Example
|
||||
|
||||
The following code runs the \c make command to build a program, if the
|
||||
build succceeds, the program is installed. If either step fails,
|
||||
build succeeds, the program is installed. If either step fails,
|
||||
<tt>make clean</tt> is run, which removes the files created by the
|
||||
build process
|
||||
|
||||
|
||||
@@ -8,9 +8,15 @@
|
||||
The <tt>bind</tt> builtin causes fish to add a key binding from the specified sequence.
|
||||
|
||||
SEQUENCE is the character sequence to bind to. Usually, one would use
|
||||
fish escape sequences to express them. For example, Alt-w can be
|
||||
written as <tt>\\ew</tt>, and Control-x can be written as
|
||||
<tt>\\cx</tt>.
|
||||
fish escape sequences to express them. For example, because pressing
|
||||
the Alt key and another character sends that character prefixed with
|
||||
an escape character, Alt-based key bindings can be written using the
|
||||
\c \\e escape. For example, Alt-w can be written as
|
||||
<tt>\\ew</tt>. Control character can be written in much the same way
|
||||
using the \c \\c escape, for example Control-x can be written as
|
||||
<tt>\\cx</tt>. Note that Alt-based key bindings are case sensitive and
|
||||
Control base key bindings are not. This is not a design choice in
|
||||
fish, it is simply how terminals work.
|
||||
|
||||
If SEQUENCE is the empty string, i.e. an empty set of quotes, this is
|
||||
interpreted as the default keybinding. It will be used whenever no
|
||||
|
||||
@@ -19,7 +19,7 @@ regular wildcard expansion using filenames.
|
||||
|
||||
Note that fish does not fall through on case statements. Though the
|
||||
syntax may look a bit like C switch statements, it behaves more like
|
||||
the case statementes of traditional shells.
|
||||
the case statements of traditional shells.
|
||||
|
||||
Also note that command substitutions in a case statement will be
|
||||
evaluated even if it's body is not taken. This may seem
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
\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
|
||||
href='index.html#completion-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
|
||||
|
||||
@@ -122,8 +122,8 @@ 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.
|
||||
- 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
|
||||
- All blocks end with the \c end builtin
|
||||
- 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.
|
||||
|
||||
\section disc The law of discoverability
|
||||
|
||||
@@ -147,7 +147,7 @@ until the next time she/he uses the same program.
|
||||
|
||||
Examples:
|
||||
|
||||
- Everything should be tab-completable, and every tab completion should have a description
|
||||
- Everything should be tab-completable, and every tab completion should have a description.
|
||||
- Every syntax error and error in a builtin command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
|
||||
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
|
||||
- The language should be uniform, so that once the user understands the command/argument syntax, he will know the whole language, and be able to use tab-completion to discover new featues.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
- <a href='#faq-default'>How do I make fish my default shell?</a>
|
||||
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
|
||||
- <a href='#faq-greeting'>How do I change the greeting message?</a>
|
||||
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
||||
|
||||
<hr>
|
||||
|
||||
@@ -56,8 +57,8 @@ feature, write <code>set CDPATH .</code> on the commandline.
|
||||
If fish is unable to locate a command with a given name, fish will
|
||||
test if a directory of that name exists. If it does, it is implicitly
|
||||
assumed that you want to change working directory. For example, the
|
||||
fastest way to switch to your home directory is to simply type
|
||||
<code>~</code>.
|
||||
fastest way to switch to your home directory is to simply press
|
||||
<code>~</code> and enter.
|
||||
|
||||
<hr>
|
||||
|
||||
@@ -92,8 +93,8 @@ In order to change your default shell, type:
|
||||
|
||||
You may need to adjust the above path to e.g. /usr/bin/fish. Use the command <code>which fish</code> if you are unsure of where fish is installed.
|
||||
|
||||
You will need to log out and back in again for the change to take
|
||||
effect.
|
||||
Unfortunatly, there is no way to make the changes take effect at once,
|
||||
you will need to log out and back in again.
|
||||
|
||||
<hr>
|
||||
|
||||
@@ -104,7 +105,7 @@ Quick answer:
|
||||
Run the following command in fish:
|
||||
|
||||
<pre>
|
||||
echo function fish_title;end ~/.config/fish/config.fish
|
||||
echo 'function fish_title;end' > ~/.config/fish/config.fish
|
||||
</pre>
|
||||
|
||||
Problem solved!
|
||||
@@ -136,5 +137,25 @@ the greeting use:
|
||||
set fish_greeting
|
||||
</pre>
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-history Why doesn't history substitution ("!$" etc.) work?
|
||||
|
||||
Because history substitution is an awkward interface that was invented before
|
||||
interactive line editing was even possible. Fish drops it in favor of
|
||||
perfecting the interactive history recall interface. Switching requires a
|
||||
small change of habits: if you want to modify an old line/word, first recall
|
||||
it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
|
||||
type "sudo ".
|
||||
|
||||
Fish history recall is very simple yet effective:
|
||||
|
||||
- As in any modern shell, the Up arrow recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
|
||||
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
|
||||
- Alt+Up recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
|
||||
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press Alt+Up. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
|
||||
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (Alt+D and Alt+Backspace are your friends).
|
||||
|
||||
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
\section fish_indent fish_indent - indenter and prettyfier
|
||||
\section fish_indent fish_indent - indenter and prettifier
|
||||
|
||||
\subsection fish_indent-synopsis Synopsis
|
||||
<tt>fish_indent [options]</tt>
|
||||
|
||||
\subsection fish_indent-description Description
|
||||
|
||||
\c fish_indent is used to indent or otherwise prettyfy a piece of fish
|
||||
\c fish_indent is used to indent or otherwise prettify a piece of fish
|
||||
code. \c fish_indent reads commands from standard input and outputs
|
||||
them to standard output.
|
||||
|
||||
\c fish_indent underatands the following options:
|
||||
\c fish_indent understands the following options:
|
||||
|
||||
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
|
||||
- <tt>-i</tt> or <tt>--no-indent</tt> do not indent commands
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
\section fish_prompt fish_prompt - define the apperance of the command line promp
|
||||
\section fish_prompt fish_prompt - define the apperance of the command line prompt
|
||||
|
||||
\subsection fish_promt-synopsis Synopsis
|
||||
<pre>function fish_prompt
|
||||
|
||||
9
doc_src/funced.txt
Normal file
9
doc_src/funced.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
\section funced funced - edit a function interactively
|
||||
|
||||
\subsection funced-synopsis Synopsis
|
||||
<code>funced NAME</code>
|
||||
|
||||
\subsection funced-description Description
|
||||
|
||||
Use the funced command to interactively edit the definition of a
|
||||
function. If there is no function with the name specified, a skeleton function is inserted, if a function exist, the definion will be shown on the command line.
|
||||
12
doc_src/funcsave.txt
Normal file
12
doc_src/funcsave.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
\section funcsave funcsave - save the definition of a function to the users autoload directory
|
||||
|
||||
\subsection funcsave-synopsis Synopsis
|
||||
<tt>funcsave FUNCTION_NAME</tt>
|
||||
|
||||
\subsection funcsave-description Description
|
||||
|
||||
funcsave is used to save the current definition of a function to
|
||||
a file which will be autoloaded by current and future fish
|
||||
sessions. This can be useful if you have interactively created a new
|
||||
function and wish to save it for later use.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
\subsection function-description Description
|
||||
|
||||
- <code>-d DESCRIPTION</code> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description
|
||||
- <code>-e</code> or <code>--on-event EVENT_NAME</code> tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
|
||||
- <code>-j PID</code> or <code> --on-job-exit PID</code> tells fish to run this function when the job with group id PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
|
||||
- <code>-p PID</code> or <code> --on-process-exit PID</code> tells fish to run this function when the fish child process with process id PID exits
|
||||
- <code>-s</code> or <code>--on-signal SIGSPEC</code> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP)
|
||||
@@ -26,6 +27,11 @@ will write <code>hello</code> whenever the user enters \c hi.
|
||||
If the user enters any additional arguments after the function, they
|
||||
are inserted into the environment <a href="index.html#variables-arrays">variable array</a> argv.
|
||||
|
||||
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href='#emit">emit</a> builtin. Fish generates the following named events:
|
||||
|
||||
- \c fish_prompt, which is emitted whenever a new fish prompt is about to be displayed
|
||||
- \c fish_command_not_found, which is emitted whenever a command lookup failed
|
||||
|
||||
\subsection function-example Example
|
||||
|
||||
<pre>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
This builtin command is used to print or erase functions.
|
||||
|
||||
- <code>-a</code> or <code>--all</code> list all functions, even those whose name start with an underscore.
|
||||
- <code>-c OLDNAME NEWNAME</code> or <code>--copy OLDNAME NEWNAME</code> creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
||||
- <code>-d DESCRIPTION</code> or <code>--description=DESCRIPTION</code> change the description of this function
|
||||
- <code>-e</code> or <code>--erase</code> causes the specified functions to be erased.
|
||||
- <code>-h</code> or <code>--help</code> display a help message and exit
|
||||
@@ -23,5 +24,8 @@ Automatically loaded functions can not be removed using functions
|
||||
-e. Either remove the definition file or change the
|
||||
$fish_function_path variable to remove autoloaded functions.
|
||||
|
||||
Function copies, created with -c, will not have any event/signal/on-exit
|
||||
notifications that the original may have had.
|
||||
|
||||
The exit status of the functions builtin is the number functions
|
||||
specified in the argument list that do not exist.
|
||||
|
||||
@@ -135,11 +135,15 @@ these characters, so called escape sequences are provided. These are:
|
||||
- <code>'\\\<'</code>, escapes the less than character
|
||||
- <code>'\\\>'</code>, escapes the more than character
|
||||
- <code>'\\^'</code>, escapes the circumflex character
|
||||
- <code>'\\&'</code>, escapes the ampersand character
|
||||
- <code>'\\;'</code>, escapes the semicolon character
|
||||
- <code>'\\"'</code>, escapes the quote character
|
||||
- <code>'\\''</code>, escapes the apostrophe character
|
||||
- <code>'\\x<i>xx</i>'</code>, where <code><i>xx</i></code> is a hexadecimal number, escapes the ascii character with the specified value. For example, \\x9 is the tab character.
|
||||
- <code>'\\X<i>xx</i>'</code>, where <code><i>xx</i></code> is a hexadecimal number, escapes a byte of data with the specified value. If you are using a mutibyte encoding, this can be used to enter invalid strings. Only use this if you know what you are doing.
|
||||
- <code>'\\<i>ooo</i>'</code>, where <code><i>ooo</i></code> is an octal number, escapes the ascii character with the specified value. For example, \\011 is the tab character.
|
||||
- <code>'\\u<i>xxxx</i>'</code>, where <code><i>xxxx</i></code> is a hexadecimal number, escapes the 16-bit unicode character with the specified value. For example, \\u9 is the tab character.
|
||||
- <code>'\\U<i>xxxxxxxx</i>'</code>, where <code><i>xxxxxxxx</i></code> is a hexadecimal number, escapes the 32-bit unicode character with the specified value. For example, \\U9 is the tab character.
|
||||
- <code>'\\u<i>xxxx</i>'</code>, where <code><i>xxxx</i></code> is a hexadecimal number, escapes the 16-bit Unicode character with the specified value. For example, \\u9 is the tab character.
|
||||
- <code>'\\U<i>xxxxxxxx</i>'</code>, where <code><i>xxxxxxxx</i></code> is a hexadecimal number, escapes the 32-bit Unicode character with the specified value. For example, \\U9 is the tab character.
|
||||
- <code>'\\c<i>x</i>'</code>, where <code><i>x</i></code> is a letter of the alphabet, escapes the control sequence generated by pressing the control key and the specified letter. For example, \\ci is the tab character
|
||||
|
||||
\subsection redirects IO redirection
|
||||
@@ -306,7 +310,7 @@ a filename consisting of the name of the function plus the suffix
|
||||
|
||||
The default value for \$fish_function_path is \c ~/.config/fish/functions
|
||||
\c /etc/fish/functions \c /usr/share/fish/functions. The exact path
|
||||
to the last two of these may be slighly different depending on what
|
||||
to the last two of these may be slightly different depending on what
|
||||
install path prefix was chosen at configuration time. The rationale
|
||||
behind having three different directories is that the first one is for
|
||||
user specific functions, the second one is for system-wide additional
|
||||
@@ -466,11 +470,11 @@ prints a list of all user groups with the groups members as description.
|
||||
|
||||
<pre>__fish_complete_pids</pre>
|
||||
|
||||
prints a list of all procceses IDs with the command name as description.
|
||||
prints a list of all processes IDs with the command name as description.
|
||||
|
||||
<pre>__fish_complete_suffix SUFFIX</pre>
|
||||
|
||||
performs file completion allowing only files ending in SUFFIX. The mimetype database is usded to find a suitable description.
|
||||
performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description.
|
||||
|
||||
<pre>__fish_complete_users</pre>
|
||||
|
||||
@@ -494,7 +498,7 @@ prints a list of all known network interfaces.
|
||||
<pre>__fish_print_packages</pre>
|
||||
|
||||
prints a list of all installed packages. This function currently handles
|
||||
debian, rpm and gentoo packages.
|
||||
Debian, rpm and Gentoo packages.
|
||||
|
||||
|
||||
|
||||
@@ -509,7 +513,7 @@ of the name of the command to complete and the suffix '.fish'.
|
||||
|
||||
The default value for \$fish_complete_path is ~/.config/fish/completions,
|
||||
/etc/fish/completions and /usr/share/fish/completions. The exact
|
||||
path to the last two of these may be slighly different depending on
|
||||
path to the last two of these may be slightly different depending on
|
||||
what install path prefix was chosen at configuration time. If a
|
||||
suitable file is found in one of these directories, it will be
|
||||
automatically loaded and the search will be stopped. The rationale
|
||||
@@ -519,14 +523,14 @@ completions and the last one is for default fish completions.
|
||||
|
||||
If you have written new completions for a common
|
||||
Unix command, please consider sharing your work by sending it to <a
|
||||
href='mailto: fish-users@lists.sf.net'>the fish mailinglist</a>.
|
||||
href='mailto: fish-users@lists.sf.net'>the fish mailing list</a>.
|
||||
|
||||
|
||||
\section expand Parameter expansion (Globbing)
|
||||
|
||||
When an argument for a program is given on the commandline, it
|
||||
undergoes the process of parameter expansion before it is sent on to
|
||||
the command. Parameter expansion is a powerful set of mechamisms that
|
||||
the command. Parameter expansion is a powerful set of mechanisms that
|
||||
allow you to expand the parameter in various ways, including
|
||||
performing wildcard matching on files, inserting the value of
|
||||
environment variables into the parameter or even using the output of
|
||||
@@ -620,9 +624,8 @@ 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 supports the former, and has no support whatsoever
|
||||
for the latter or anything like it. So what is '{$VARNAME}' then?
|
||||
Well, '{WHATEVER}' is <a href='#brace'>brace expansion</a>, identical
|
||||
to that supported by e.g. bash. 'a{b,c}d' -> 'abd acd' works
|
||||
both in bash and on fish. So '{$VARNAME}' is a bracket-expansion with
|
||||
Well, '{WHATEVER}' is <a href='#brace'>brace expansion</a>, e.g. 'a{b,c}d' -> 'abd acd'.
|
||||
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
|
||||
@@ -684,7 +687,7 @@ The \% (percent) character at the beginning of a parameter followed by
|
||||
a string is expanded into a process id. The following expansions are
|
||||
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.
|
||||
- Otherwise, if the string is the id of a job, the result is the process
|
||||
group id of the job.
|
||||
- Otherwise, if any child processes match the specified string, their
|
||||
@@ -749,7 +752,7 @@ the shell through <a href="expand-variable">variable expansion</a>.
|
||||
|
||||
Example:
|
||||
|
||||
To use the value of a the variable \c smurf, write $ (dollar symbol)
|
||||
To use the value of the variable \c smurf, write $ (dollar symbol)
|
||||
followed by the name of the variable, like <code>echo Smurfs are
|
||||
usually $smurf_color</code>, which would print the result 'Smurfs are
|
||||
usually blue'.
|
||||
@@ -868,7 +871,7 @@ echo $PATH[3]
|
||||
</pre>
|
||||
|
||||
Note that array indices start at 1 in fish, not 0, as is more common
|
||||
in other languages. This is because many common unix tools like seq
|
||||
in other languages. This is because many common Unix tools like seq
|
||||
are more suited to such use.
|
||||
|
||||
If you do not use any brackets, all the elements of the array will be
|
||||
@@ -928,7 +931,7 @@ values of most of these variables.
|
||||
- \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 PWD, which is the current working directory.
|
||||
- \c status, which is the exit status of the last foreground job to exit.
|
||||
- \c status, which is the exit status of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number.
|
||||
- \c USER, which is the username. This variable can only be changed by the root user.
|
||||
|
||||
The names of these variables are mostly derived from the csh family of
|
||||
@@ -967,6 +970,8 @@ variable may also be set to a specific value:
|
||||
- 126 means that while a file with the specified name was located, it was not executable
|
||||
- 127 means that no function, builtin or command with the given name could be located
|
||||
|
||||
If a process exits through a signal, the exit status will be 128 plus the number of the signal.
|
||||
|
||||
\subsection variables-color Variables for changing highlighting colors
|
||||
|
||||
The colors used by fish for syntax highlighting can be configured by
|
||||
@@ -975,7 +980,7 @@ variables can be one of the colors accepted by the <a
|
||||
href='commands.html#set_color'>set_color</a> command. The \c --bold
|
||||
or \c -b switches accepted by \c set_color are also accepted.
|
||||
|
||||
The following variables are available to change the highligting colors
|
||||
The following variables are available to change the highlighting colors
|
||||
in fish:
|
||||
|
||||
- \c fish_color_normal, the default color
|
||||
@@ -1050,7 +1055,7 @@ Here are some of the commands available in the editor:
|
||||
- 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 respecitvely
|
||||
- Delete and backspace removes one character forwards or backwards respectively
|
||||
- Ctrl-c deletes 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-k move contents from the cursor to the end of line to the <a href="#killring">killring</a>
|
||||
@@ -1140,7 +1145,7 @@ than a single line:
|
||||
|
||||
- Pressing the enter key while a block of commands is unclosed, i.e. when one or more block commands such as 'for', 'begin' or 'if' do not have a corresponding 'end' command.
|
||||
- Pressing Alt-enter instead of pressing the enter key.
|
||||
- By backslash escaping a newline, i.e. by inserting a backslash (\\) character pefore pressing the enter key.
|
||||
- By backslash escaping a newline, i.e. by inserting a backslash (\\) character before pressing the enter key.
|
||||
|
||||
The fish commandline editor works exactly the same in single line mode
|
||||
and in multiline mode. To move between lines use the left and right
|
||||
@@ -1241,7 +1246,7 @@ fish_title function is executed before and after a new command is
|
||||
executed or put into the foreground and the output is used as a
|
||||
titlebar message. The $_ environment variable will always contain the
|
||||
name of the job to be put into the foreground (Or 'fish' if control is
|
||||
returning to the shell) when the fish_prompt function is called.
|
||||
returning to the shell) when the \c fish_prompt function is called.
|
||||
|
||||
Example:
|
||||
<p>
|
||||
@@ -1256,6 +1261,12 @@ end
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
\subsection greeting Configurable greeting
|
||||
|
||||
If a function named fish_greeting exists after initialization, it will
|
||||
be run when entering interactive mode. Otherwise,if an environment
|
||||
variable named fish_greeting exists, it will be printed.
|
||||
|
||||
\subsection event Event handlers
|
||||
|
||||
When defining a new function in fish, it is possible to make it into an
|
||||
@@ -1266,6 +1277,7 @@ specific event takes place. Events that can trigger a handler currently are:
|
||||
- When a process or job exits
|
||||
- When the value of a variable is updated
|
||||
- When the prompt is about to be shown
|
||||
- When a command lookup fails
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1280,9 +1292,9 @@ For more information on how to define new event handlers, see the
|
||||
documentation for the <a href='commands.html#function'>function</a>
|
||||
command.
|
||||
|
||||
\subsection debuging Debuging fish scripts
|
||||
\subsection debugging Debugging fish scripts
|
||||
|
||||
Fish includes a built in debuger. The debuger allows you to stop
|
||||
Fish includes a built in debugger. The debugger allows you to stop
|
||||
execution of a script at an arbitrary point and launch a prompt. This
|
||||
prompt can then be used to check or change the value of any variables
|
||||
or perform any shellscript command. To resume normal execution of the
|
||||
@@ -1290,15 +1302,15 @@ script, simply exit the prompt.
|
||||
|
||||
To start the debugger, simply call the builtin command
|
||||
'breakpoint'. The default action of the TRAP signal is to call this
|
||||
builtin, so a running script can be debuged by sending it the TRAP
|
||||
signal. Once in the debuger, it is easy to insert new breakpoints by
|
||||
builtin, so a running script can be debugged by sending it the TRAP
|
||||
signal. Once in the debugger, it is easy to insert new breakpoints by
|
||||
using the funced function to edit the definition of a function.
|
||||
|
||||
\section issues Common issues with fish
|
||||
|
||||
If you install fish in your home directory, fish will not work
|
||||
correctly for any other user than yourself. This is because fish needs
|
||||
its initalization files to function properly. To solve this
|
||||
its initialization files to function properly. To solve this
|
||||
problem, either copy the initialization files to each fish users home
|
||||
directory, or install them in /etc.
|
||||
|
||||
@@ -1310,7 +1322,7 @@ 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,
|
||||
To make a translation of fish, you will first need the source code,
|
||||
available from the <a href='http://www.fishshell.org'>fish
|
||||
homepage</a>. Download the latest version, and then extract it using a
|
||||
command like <code>tar -zxf fish-VERSION.tar.gz</code>.
|
||||
@@ -1318,7 +1330,7 @@ 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
|
||||
You will now need to configure the source code 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
|
||||
@@ -1326,7 +1338,7 @@ 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
|
||||
Now you have the source code 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
|
||||
@@ -1346,7 +1358,7 @@ msgstr ""
|
||||
</pre>
|
||||
|
||||
The first line is the English string to translate, the second line
|
||||
should contain your translation. For example, in swedish the above
|
||||
should contain your translation. For example, in Swedish the above
|
||||
might become:
|
||||
|
||||
<pre>
|
||||
@@ -1395,8 +1407,7 @@ g++, javac, java, gcj, lpr, doxygen, whois)
|
||||
- Selectable completions in the pager
|
||||
- Per process output redirection
|
||||
- Reduce the space of the pager by one line to allow the commandline to remain visible.
|
||||
- down-arrow could be used to save the current command to the history. Or give the next command in-sequnce. Or both.
|
||||
- Drop support for inputrc-files. Use shellscripts and the bind builtin. Also, redo the syntax for the bind builtin to something more sane.
|
||||
- down-arrow could be used to save the current command to the history. Or give the next command in-sequence. Or both.
|
||||
- History could reload itself when the file is updated. This would need to be done in a clever way to avoid chain reactions
|
||||
- The error function should probably be moved into it's own library, and be made mere general purpose.
|
||||
- The code validation functions should be moved from the parser to parse_util.
|
||||
@@ -1410,6 +1421,8 @@ g++, javac, java, gcj, lpr, doxygen, whois)
|
||||
- Don't use expand_string to perform completions. wildcard_complete can be called directly, the brace expansion handling should be universal, and the process expansion can be moved to complete.c.
|
||||
- Make the history search support incremental searching
|
||||
- An automatic logout feature
|
||||
- Make tab completions completely silent by default, i.e. kill stderr when running completion commands. This needs to be overridalbe for debugging purposes.
|
||||
- Move history to an environment variable
|
||||
|
||||
\subsection bugs Known bugs and issues
|
||||
|
||||
@@ -1417,16 +1430,14 @@ g++, javac, java, gcj, lpr, doxygen, whois)
|
||||
- delete-word is broken on the commandline 'sudo update-alternatives --config x-'
|
||||
- Sometimes autoheader needs to be run on a fresh tarball. Fix dates before creating tarballs.
|
||||
- The completion autoloader does not remember which completions where actually autoloaded, and may unload manually specified completions.
|
||||
- There have been stray reports of issues with strang values of the PATH variable during startup.
|
||||
- There have been stray reports of issues with strange values of the PATH variable during startup.
|
||||
- bindings in config.fish are overwritten by default key bindings.
|
||||
- Adding 'bind -k ...' doesn't overwrite non-keybinding binds of the same sequence.
|
||||
- History file does not remove duplicates.
|
||||
- History file should apply some kind of maximum history length.
|
||||
- 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 to have this problem.
|
||||
|
||||
If you think you have found a bug not described here, please send a
|
||||
report to <a href="mailto:fish-users@lists.sf.net">fish-users@lists.sf.net</a>.
|
||||
|
||||
|
||||
\subsection issues Known issues
|
||||
|
||||
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
|
||||
to have this problem.
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,28 +1,11 @@
|
||||
/** \page license Licenses
|
||||
|
||||
Fish Copyright (C) 2005-2006 Axel Liljencrantz. Fish is released under
|
||||
<h2>License for fish</h2>
|
||||
|
||||
Fish Copyright (C) 2005-2009 Axel Liljencrantz. Fish is released under
|
||||
the GNU General Public License, version 2. The license agreement is
|
||||
included below.
|
||||
|
||||
Fish contains code under the BSD license, namely versions of the
|
||||
two functions strlcat and strlcpy, modified for use with wide
|
||||
character strings. This code is copyrighted by Todd C. Miller. The
|
||||
license agreement is included below.
|
||||
|
||||
The XSel command, written and copyrighted by Conrad Parker, is
|
||||
distributed together with, and used by fish. It is released under the MIT
|
||||
license. The license agreement is included below.
|
||||
|
||||
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
|
||||
by the mimedb command, which is a part of fish. It is released under
|
||||
the LGPL. The license agreement is included below.
|
||||
|
||||
Fish contains code from the glibc library, namely the wcstok
|
||||
function. This code is licensed under the LGPL. The license agreement
|
||||
is included below.
|
||||
|
||||
|
||||
<HR>
|
||||
|
||||
<H2><A NAME="SEC1" HREF="gpl.html#TOC1">GNU GENERAL PUBLIC LICENSE</A></H2>
|
||||
<P>
|
||||
@@ -480,6 +463,18 @@ without express or implied warranty.
|
||||
|
||||
<HR>
|
||||
|
||||
<h2>License for xdgmime and glibc</h2>
|
||||
|
||||
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
|
||||
by the mimedb command, which is a part of fish. It is released under
|
||||
the LGPL, version 2 or later, or under the Academic Free License,
|
||||
version 2. Version 2 of the LGPL license agreement is included below.
|
||||
|
||||
Fish contains code from the glibc library, namely the wcstok
|
||||
function. This code is licensed under the LGPL, version 2 or
|
||||
later. Version 2 of the LPGL license agreement is included below.
|
||||
|
||||
|
||||
<H2><A NAME="SEC1" HREF="#TOC1">GNU LESSER GENERAL PUBLIC LICENSE</A></H2>
|
||||
|
||||
<P>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
\section open open - open file in it's default application
|
||||
\section open open - open file in its default application
|
||||
|
||||
\subsection open-synopsis Synopsis
|
||||
<tt>open FILES...</tt>
|
||||
|
||||
\subsection open-description Description
|
||||
|
||||
The \c open command is used to open a file in it's default application. \c open is implemented using the <a href="commands.html#mimedb">mimedb</a> command.
|
||||
The \c open command is used to open a file in its default application. \c open is implemented using the \c xdg-open command if it exists, or else the <a href="commands.html#mimedb">mimedb</a> command.
|
||||
|
||||
\subsection open-example Example
|
||||
|
||||
<tt>open *.txt</tt> opens all the text files in the current directory using your systems default text editor.
|
||||
<tt>open *.txt</tt> opens all the text files in the current directory using your system's default text editor.
|
||||
|
||||
@@ -17,7 +17,7 @@ variable.
|
||||
\subsection or-example Example
|
||||
|
||||
The following code runs the \c make command to build a program, if the
|
||||
build succceeds, the program is installed. If either step fails,
|
||||
build succeeds, the program is installed. If either step fails,
|
||||
<tt>make clean</tt> is run, which removes the files created by the
|
||||
build process
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
\section save_function save_function - save the definition of a function to the users autoload directory
|
||||
|
||||
\subsection save_function-synopsis Synopsis
|
||||
<tt>save_function FUNCTION_NAME</tt>
|
||||
|
||||
\subsection save_function-description Description
|
||||
|
||||
save_function is used to save the current definition of a function to
|
||||
a file which will be autoloaded by current and future fish
|
||||
sessions. This can be useful if you have interactively created a new
|
||||
function and wish to save it for later use.
|
||||
|
||||
@@ -28,3 +28,9 @@ result in a white font color.
|
||||
Not all terminal emulators support all these features. This is not a
|
||||
bug in set_color but a missing feature in the terminal emulator.
|
||||
|
||||
set_color uses the terminfo database to look up how to change terminal
|
||||
colors on whatever terminal is in use. Some systems have old and
|
||||
incomplete terminfo databases, and may lack color information for
|
||||
terminals that support it. Download and install the latest version of
|
||||
ncurses and recompile fish against it in order to fix this issue.
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
- <tt>-f</tt> or <tt>--current-filename</tt> prints the filename of the currently running script
|
||||
- <tt>-n</tt> or <tt>--current-line-number</tt> prints the line number of the currently running script
|
||||
- <tt>-j CONTROLTYPE</tt> or <tt>--job-control=CONTROLTYPE</tt> set the job control type. Can be one of: none, full, interactive
|
||||
- <tt>-t</tt> or <tt>--print-stack-trace</tt>
|
||||
- <tt>-t</tt> or <tt>--print-stack-trace</tt> prints a stack trace of all function calls on the call stack
|
||||
- <tt>-h</tt> or <tt>--help</tt> display a help message and exit
|
||||
|
||||
@@ -56,7 +56,7 @@ The fish implementation of ulimit should behave identically to the
|
||||
implementation in bash, except for these differences:
|
||||
|
||||
- Fish ulimit supports GNU-style long options for all switches
|
||||
- Fish ulimit does not support the -p option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because it this method of determining pipe sixe is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
|
||||
- Fish ulimit does not support the -p option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because it this method of determining pipe size is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
|
||||
- Fish ulimit does not support getting or setting multiple limits in one command, except reporting all values using the -a switch
|
||||
|
||||
\subsection ulimit-example Example
|
||||
|
||||
54
env.c
54
env.c
@@ -480,6 +480,21 @@ static void setup_path()
|
||||
al_destroy( &l );
|
||||
}
|
||||
|
||||
int env_set_pwd()
|
||||
{
|
||||
wchar_t dir_path[4096];
|
||||
wchar_t *res = wgetcwd( dir_path, 4096 );
|
||||
if( !res )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
env_set( L"PWD", dir_path, ENV_EXPORT | ENV_GLOBAL );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Set up default values for various variables if not defined.
|
||||
*/
|
||||
static void env_set_defaults()
|
||||
{
|
||||
|
||||
@@ -502,6 +517,8 @@ static void env_set_defaults()
|
||||
free( unam_narrow );
|
||||
}
|
||||
|
||||
env_set_pwd();
|
||||
|
||||
}
|
||||
|
||||
void env_init()
|
||||
@@ -510,6 +527,7 @@ void env_init()
|
||||
struct passwd *pw;
|
||||
wchar_t *uname;
|
||||
wchar_t *version;
|
||||
wchar_t *shlvl;
|
||||
|
||||
sb_init( &dyn_var );
|
||||
b_init( &export_buffer );
|
||||
@@ -526,6 +544,7 @@ void env_init()
|
||||
hash_put( &env_read_only, L"LINES", L"" );
|
||||
hash_put( &env_read_only, L"COLUMNS", L"" );
|
||||
hash_put( &env_read_only, L"PWD", L"" );
|
||||
hash_put( &env_read_only, L"SHLVL", L"" );
|
||||
|
||||
/*
|
||||
Names of all dynamically calculated variables
|
||||
@@ -627,6 +646,38 @@ void env_init()
|
||||
&start_fishd,
|
||||
&universal_callback );
|
||||
|
||||
/*
|
||||
Set up SHLVL variable
|
||||
*/
|
||||
shlvl = env_get( L"SHLVL" );
|
||||
if ( shlvl )
|
||||
{
|
||||
wchar_t *nshlvl, **end_nshlvl;
|
||||
/* add an extra space for digit dump (9+1=10) */
|
||||
size_t i = wcslen( shlvl ) + 2 * sizeof(wchar_t);
|
||||
|
||||
nshlvl = malloc(i);
|
||||
end_nshlvl = calloc( 1, sizeof(nshlvl) );
|
||||
if ( !nshlvl || !end_nshlvl )
|
||||
DIE_MEM();
|
||||
|
||||
if ( nshlvl && swprintf( nshlvl, i,
|
||||
L"%ld", wcstoul( shlvl, end_nshlvl, 10 )+1 ) != -1 )
|
||||
{
|
||||
env_set( L"SHLVL",
|
||||
nshlvl,
|
||||
ENV_GLOBAL | ENV_EXPORT );
|
||||
}
|
||||
free( end_nshlvl );
|
||||
free( nshlvl );
|
||||
}
|
||||
else
|
||||
{
|
||||
env_set( L"SHLVL",
|
||||
L"1",
|
||||
ENV_GLOBAL | ENV_EXPORT );
|
||||
}
|
||||
|
||||
/*
|
||||
Set correct defaults for e.g. USER and HOME variables
|
||||
*/
|
||||
@@ -1442,6 +1493,9 @@ static void export_func1( void *k, void *v, void *aux )
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Get list of all exported variables
|
||||
*/
|
||||
static void get_exported( env_node_t *n, hash_table_t *h )
|
||||
{
|
||||
if( !n )
|
||||
|
||||
7
env.h
7
env.h
@@ -132,4 +132,11 @@ char **env_export_arr( int recalc );
|
||||
*/
|
||||
void env_get_names( array_list_t *l, int flags );
|
||||
|
||||
/**
|
||||
Update the PWD variable
|
||||
directory
|
||||
*/
|
||||
int env_set_pwd();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -176,8 +176,10 @@ static char *iconv_wide_names_2[]=
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
wchar_t *utf2wcs( const char *in )
|
||||
/**
|
||||
Convert utf-8 string to wide string
|
||||
*/
|
||||
static wchar_t *utf2wcs( const char *in )
|
||||
{
|
||||
iconv_t cd=(iconv_t) -1;
|
||||
int i,j;
|
||||
@@ -253,7 +255,7 @@ wchar_t *utf2wcs( const char *in )
|
||||
return 0;
|
||||
}
|
||||
|
||||
nconv = iconv( cd, (const char **)&in, &in_len, &nout, &out_len );
|
||||
nconv = iconv( cd, (char **)&in, &in_len, &nout, &out_len );
|
||||
|
||||
if (nconv == (size_t) -1)
|
||||
{
|
||||
@@ -287,7 +289,10 @@ wchar_t *utf2wcs( const char *in )
|
||||
return out;
|
||||
}
|
||||
|
||||
char *wcs2utf( const wchar_t *in )
|
||||
/**
|
||||
Convert wide string to utf-8
|
||||
*/
|
||||
static char *wcs2utf( const wchar_t *in )
|
||||
{
|
||||
iconv_t cd=(iconv_t) -1;
|
||||
int i,j;
|
||||
@@ -404,6 +409,9 @@ void env_universal_common_destroy()
|
||||
hash_destroy( &env_universal_var );
|
||||
}
|
||||
|
||||
/**
|
||||
Read one byte of date form the specified connection
|
||||
*/
|
||||
static int read_byte( connection_t *src )
|
||||
{
|
||||
|
||||
@@ -740,6 +748,9 @@ void try_send_all( connection_t *c )
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Escape specified string
|
||||
*/
|
||||
static wchar_t *full_escape( const wchar_t *in )
|
||||
{
|
||||
string_buffer_t out;
|
||||
|
||||
11
event.c
11
event.c
@@ -704,9 +704,11 @@ void event_free( event_t *e )
|
||||
}
|
||||
|
||||
|
||||
void event_fire_generic(const wchar_t *name)
|
||||
void event_fire_generic_internal(const wchar_t *name, ...)
|
||||
{
|
||||
event_t ev;
|
||||
va_list va;
|
||||
wchar_t *arg;
|
||||
|
||||
CHECK( name, );
|
||||
|
||||
@@ -715,6 +717,13 @@ void event_fire_generic(const wchar_t *name)
|
||||
ev.function_name=0;
|
||||
|
||||
al_init( &ev.arguments );
|
||||
va_start( va, name );
|
||||
while( (arg=va_arg(va, wchar_t *) )!= 0 )
|
||||
{
|
||||
al_push( &ev.arguments, arg );
|
||||
}
|
||||
va_end( va );
|
||||
|
||||
event_fire( &ev );
|
||||
}
|
||||
|
||||
|
||||
3
event.h
3
event.h
@@ -164,7 +164,8 @@ const wchar_t *event_get_desc( event_t *e );
|
||||
/**
|
||||
Fire a generic event with the specified name
|
||||
*/
|
||||
void event_fire_generic(const wchar_t *name);
|
||||
#define event_fire_generic( ... ) event_fire_generic_internal( __VA_ARGS__, (void *)0 )
|
||||
|
||||
void event_fire_generic_internal(const wchar_t *name,...);
|
||||
|
||||
#endif
|
||||
|
||||
113
exec.c
113
exec.c
@@ -53,6 +53,11 @@
|
||||
*/
|
||||
#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" )
|
||||
|
||||
/**
|
||||
file descriptor redirection error message
|
||||
*/
|
||||
#define WRITE_ERROR _( L"An error occurred while writing output" )
|
||||
|
||||
/**
|
||||
file redirection error message
|
||||
*/
|
||||
@@ -92,6 +97,18 @@ static array_list_t *open_fds=0;
|
||||
|
||||
static int set_child_group( job_t *j, process_t *p, int print_errors );
|
||||
|
||||
static void exec_write_and_exit( int fd, char *buff, size_t count, int status )
|
||||
{
|
||||
if( write_loop(fd, buff, count) == -1 )
|
||||
{
|
||||
debug( 0, WRITE_ERROR);
|
||||
wperror( L"write" );
|
||||
exit(status);
|
||||
}
|
||||
exit( status );
|
||||
}
|
||||
|
||||
|
||||
void exec_close( int fd )
|
||||
{
|
||||
int i;
|
||||
@@ -443,6 +460,40 @@ static int setup_child_process( job_t *j, process_t *p )
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the interpreter for the specified script. Returns 0 if file
|
||||
is not a script with a shebang. This function leaks memory on every
|
||||
call. Only use it in the execve error handler which calls exit
|
||||
right afterwards, anyway.
|
||||
*/
|
||||
static wchar_t *get_interpreter( wchar_t *file )
|
||||
{
|
||||
string_buffer_t sb;
|
||||
FILE *fp = wfopen( file, "r" );
|
||||
sb_init( &sb );
|
||||
wchar_t *res = 0;
|
||||
if( fp )
|
||||
{
|
||||
while( 1 )
|
||||
{
|
||||
wint_t ch = getwc( fp );
|
||||
if( ch == WEOF )
|
||||
break;
|
||||
if( ch == L'\n' )
|
||||
break;
|
||||
sb_append_char( &sb, (wchar_t)ch );
|
||||
}
|
||||
}
|
||||
|
||||
res = (wchar_t *)sb.buff;
|
||||
|
||||
if( !wcsncmp( L"#! /", res, 4 ) )
|
||||
return res+3;
|
||||
if( !wcsncmp( L"#!/", res, 3 ) )
|
||||
return res+2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is executed by the child process created by a call to
|
||||
@@ -549,22 +600,22 @@ static void launch_process( process_t *p )
|
||||
if( arg_max > 0 )
|
||||
{
|
||||
|
||||
sb_format_size( &sz2, ARG_MAX );
|
||||
sb_format_size( &sz2, arg_max );
|
||||
|
||||
debug( 0,
|
||||
L"The total size of the argument and environment lists (%ls) exceeds the system limit of %ls.",
|
||||
L"The total size of the argument and environment lists (%ls) exceeds the operating system limit of %ls.",
|
||||
(wchar_t *)sz1.buff,
|
||||
(wchar_t *)sz2.buff);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug( 0,
|
||||
L"The total size of the argument and environment lists (%ls) exceeds the system limit.",
|
||||
L"The total size of the argument and environment lists (%ls) exceeds the operating system limit.",
|
||||
(wchar_t *)sz1.buff);
|
||||
}
|
||||
|
||||
debug( 0,
|
||||
L"Please try running the command again with fewer arguments.");
|
||||
L"Try running the command again with fewer arguments.");
|
||||
sb_destroy( &sz1 );
|
||||
sb_destroy( &sz2 );
|
||||
|
||||
@@ -573,9 +624,41 @@ static void launch_process( process_t *p )
|
||||
break;
|
||||
}
|
||||
|
||||
case ENOEXEC:
|
||||
{
|
||||
wperror(L"exec");
|
||||
|
||||
debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
|
||||
exit(STATUS_EXEC_FAIL);
|
||||
}
|
||||
|
||||
case ENOENT:
|
||||
{
|
||||
wchar_t *interpreter = get_interpreter( p->actual_cmd );
|
||||
|
||||
if( interpreter && waccess( interpreter, X_OK ) )
|
||||
{
|
||||
debug(0, L"The file '%ls' specified the interpreter '%ls', which is not an executable command.", p->actual_cmd, interpreter );
|
||||
}
|
||||
else
|
||||
{
|
||||
debug(0, L"The file '%ls' or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found.", p->actual_cmd);
|
||||
}
|
||||
|
||||
exit(STATUS_EXEC_FAIL);
|
||||
}
|
||||
|
||||
case ENOMEM:
|
||||
{
|
||||
debug(0, L"Out of memory");
|
||||
exit(STATUS_EXEC_FAIL);
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
|
||||
wperror(L"exec");
|
||||
|
||||
// debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
|
||||
exit(STATUS_EXEC_FAIL);
|
||||
}
|
||||
}
|
||||
@@ -830,6 +913,9 @@ static pid_t exec_fork()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Perform output from builtins
|
||||
*/
|
||||
static void do_builtin_io( wchar_t *out, wchar_t *err )
|
||||
{
|
||||
|
||||
@@ -1357,15 +1443,17 @@ void exec( job_t *j )
|
||||
|
||||
if( pid == 0 )
|
||||
{
|
||||
|
||||
/*
|
||||
This is the child process. Write out the contents of the pipeline.
|
||||
*/
|
||||
p->pid = getpid();
|
||||
setup_child_process( j, p );
|
||||
write( io_buffer->fd,
|
||||
|
||||
exec_write_and_exit(io_buffer->fd,
|
||||
io_buffer->param2.out_buffer->buff,
|
||||
io_buffer->param2.out_buffer->used );
|
||||
exit( status );
|
||||
io_buffer->param2.out_buffer->used,
|
||||
status);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1411,10 +1499,10 @@ void exec( job_t *j )
|
||||
p->pid = getpid();
|
||||
setup_child_process( j, p );
|
||||
|
||||
write( 1,
|
||||
exec_write_and_exit( 1,
|
||||
input_redirect->param2.out_buffer->buff,
|
||||
input_redirect->param2.out_buffer->used );
|
||||
exit( 0 );
|
||||
input_redirect->param2.out_buffer->used,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1487,7 +1575,8 @@ void exec( job_t *j )
|
||||
{
|
||||
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
|
||||
|
||||
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!p->status):p->status );
|
||||
int status = p->status;
|
||||
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!status):status );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
13
expand.c
13
expand.c
@@ -109,11 +109,11 @@ parameter expansion.
|
||||
|
||||
/**
|
||||
Characters which make a string unclean if they are the first
|
||||
character of the string. See \c is_clean().
|
||||
character of the string. See \c expand_is_clean().
|
||||
*/
|
||||
#define UNCLEAN_FIRST L"~%"
|
||||
/**
|
||||
Unclean characters. See \c is_clean().
|
||||
Unclean characters. See \c expand_is_clean().
|
||||
*/
|
||||
#define UNCLEAN L"$*?\\\"'({})"
|
||||
|
||||
@@ -764,7 +764,9 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Parse an array slicing specification
|
||||
*/
|
||||
static int parse_slice( wchar_t *in, wchar_t **end_ptr, array_list_t *idx )
|
||||
{
|
||||
|
||||
@@ -1517,6 +1519,11 @@ static void remove_internal_separator( const void *s, int conv )
|
||||
*out++ = conv?L'*':ANY_STRING;
|
||||
break;
|
||||
|
||||
case ANY_STRING_RECURSIVE:
|
||||
in++;
|
||||
*out++ = conv?L'*':ANY_STRING_RECURSIVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
*out++ = *in++;
|
||||
}
|
||||
|
||||
4
expand.h
4
expand.h
@@ -58,6 +58,10 @@
|
||||
Use unencoded private-use keycodes for internal characters
|
||||
*/
|
||||
#define EXPAND_RESERVED 0xf000
|
||||
/**
|
||||
End of range reserved for expand
|
||||
*/
|
||||
#define EXPAND_RESERVED_END 0xf000f
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -1183,5 +1183,12 @@ long sysconf(int name)
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NAN
|
||||
double nan(char *tagp)
|
||||
{
|
||||
return 0.0/0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
32
fallback.h
32
fallback.h
@@ -54,9 +54,18 @@ typedef char tputs_arg_t;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WINSIZE
|
||||
/**
|
||||
Structure used to get the size of a terminal window
|
||||
*/
|
||||
struct winsize
|
||||
{
|
||||
/**
|
||||
Number of rows
|
||||
*/
|
||||
unsigned short ws_row;
|
||||
/**
|
||||
Number of columns
|
||||
*/
|
||||
unsigned short ws_col;
|
||||
}
|
||||
;
|
||||
@@ -400,17 +409,35 @@ extern int _nl_msg_cat_cntr;
|
||||
|
||||
|
||||
#ifndef HAVE_KILLPG
|
||||
/**
|
||||
Send specified signal to specified process group.
|
||||
*/
|
||||
int killpg( int pgr, int sig );
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_WORKING_GETOPT_LONG
|
||||
|
||||
/**
|
||||
Struct describing a long getopt option
|
||||
*/
|
||||
struct option
|
||||
{
|
||||
/**
|
||||
Name of option
|
||||
*/
|
||||
const char *name;
|
||||
/**
|
||||
Flag
|
||||
*/
|
||||
int has_arg;
|
||||
/**
|
||||
Flag
|
||||
*/
|
||||
int *flag;
|
||||
/**
|
||||
Return value
|
||||
*/
|
||||
int val;
|
||||
}
|
||||
;
|
||||
@@ -442,4 +469,9 @@ long sysconf(int name);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NAN
|
||||
double nan(char *tagp);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
13
fish.c
13
fish.c
@@ -66,7 +66,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
/**
|
||||
The string describing the single-character options accepted by the main fish binary
|
||||
*/
|
||||
#define GETOPT_STRING "hilnvc:p:d:"
|
||||
#define GETOPT_STRING "+hilnvc:p:d:"
|
||||
|
||||
/**
|
||||
Parse init files
|
||||
@@ -106,10 +106,9 @@ static int read_init()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
Parse the argument list, return the index of the first non-switch
|
||||
arguments.
|
||||
|
||||
*/
|
||||
static int fish_parse_opt( int argc, char **argv, char **cmd_ptr )
|
||||
{
|
||||
@@ -324,12 +323,12 @@ int main( int argc, char **argv )
|
||||
{
|
||||
if( my_optind == argc )
|
||||
{
|
||||
res = reader_read( 0, 0 );
|
||||
res = reader_read( STDIN_FILENO, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
char **ptr;
|
||||
char *file = *(argv+1);
|
||||
char *file = *(argv+(my_optind++));
|
||||
int i;
|
||||
string_buffer_t sb;
|
||||
int fd;
|
||||
@@ -341,11 +340,11 @@ int main( int argc, char **argv )
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( *(argv+2))
|
||||
if( *(argv+my_optind))
|
||||
{
|
||||
sb_init( &sb );
|
||||
|
||||
for( i=1,ptr = argv+2; *ptr; i++, ptr++ )
|
||||
for( i=1,ptr = argv+my_optind; *ptr; i++, ptr++ )
|
||||
{
|
||||
if( i != 1 )
|
||||
sb_append( &sb, ARRAY_SEP_STR );
|
||||
|
||||
@@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/** \file main.c
|
||||
/** \file fish_indent.c
|
||||
The fish_indent proegram.
|
||||
*/
|
||||
|
||||
@@ -48,13 +48,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#define GETOPT_STRING "hvi"
|
||||
|
||||
void read_file( FILE *f, string_buffer_t *b )
|
||||
/**
|
||||
Read the entire contents of a file into the specified string_Buffer_t
|
||||
*/
|
||||
static void read_file( FILE *f, string_buffer_t *b )
|
||||
{
|
||||
while( 1 )
|
||||
{
|
||||
errno=0;
|
||||
wint_t c = fgetwc( f );
|
||||
if( c == WEOF )
|
||||
{
|
||||
if( errno )
|
||||
{
|
||||
wperror(L"fgetwc");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -62,6 +72,9 @@ void read_file( FILE *f, string_buffer_t *b )
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Insert the specified number of tabe into the output buffer
|
||||
*/
|
||||
static void insert_tabs( string_buffer_t *out, int indent )
|
||||
{
|
||||
int i;
|
||||
@@ -73,6 +86,9 @@ static void insert_tabs( string_buffer_t *out, int indent )
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Indent the specified input
|
||||
*/
|
||||
static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
{
|
||||
tokenizer tok;
|
||||
@@ -109,6 +125,11 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
{
|
||||
indent--;
|
||||
}
|
||||
/* case should have the same indent level as switch*/
|
||||
else if( wcscmp( unesc, L"case" ) == 0 )
|
||||
{
|
||||
indent--;
|
||||
}
|
||||
else if( wcscmp( unesc, L"end" ) == 0 )
|
||||
{
|
||||
indent--;
|
||||
@@ -116,7 +137,7 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
}
|
||||
|
||||
|
||||
if( do_indent && flags)
|
||||
if( do_indent && flags && prev_type != TOK_PIPE )
|
||||
{
|
||||
insert_tabs( out, indent );
|
||||
}
|
||||
@@ -128,7 +149,9 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_printf( out, L" %ls", last );
|
||||
if ( prev_type != TOK_REDIRECT_FD )
|
||||
sb_append( out, L" " );
|
||||
sb_append( out, last );
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -145,40 +168,61 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
|
||||
case TOK_PIPE:
|
||||
{
|
||||
sb_append( out, L" | " );
|
||||
sb_append( out, L" " );
|
||||
if ( last[0] == '2' && !last[1] ) {
|
||||
sb_append( out, L"^" );
|
||||
} else if ( last[0] != '1' || last[1] ) {
|
||||
sb_append( out, last, L">" );
|
||||
}
|
||||
sb_append( out, L"| " );
|
||||
is_command = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case TOK_REDIRECT_OUT:
|
||||
case TOK_REDIRECT_APPEND:
|
||||
case TOK_REDIRECT_IN:
|
||||
case TOK_REDIRECT_FD:
|
||||
{
|
||||
sb_append( out, L" " );
|
||||
if ( wcscmp( last, L"2" ) == 0 ) {
|
||||
sb_append( out, L"^" );
|
||||
} else {
|
||||
if ( wcscmp( last, L"1" ) != 0 )
|
||||
sb_append( out, last );
|
||||
switch( type )
|
||||
{
|
||||
case TOK_REDIRECT_OUT:
|
||||
sb_append( out, L"> " );
|
||||
sb_append( out, L">" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TOK_REDIRECT_APPEND:
|
||||
sb_append( out, L">> " );
|
||||
{
|
||||
sb_append( out, L" " );
|
||||
if ( wcscmp( last, L"2" ) == 0 ) {
|
||||
sb_append( out, L"^^" );
|
||||
} else {
|
||||
if ( wcscmp( last, L"1" ) != 0 )
|
||||
sb_append( out, last );
|
||||
sb_append( out, L">>" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TOK_REDIRECT_IN:
|
||||
sb_append( out, L"< " );
|
||||
{
|
||||
sb_append( out, L" " );
|
||||
if ( wcscmp( last, L"0" ) != 0 )
|
||||
sb_append( out, last );
|
||||
sb_append( out, L"<" );
|
||||
break;
|
||||
}
|
||||
|
||||
case TOK_REDIRECT_FD:
|
||||
sb_append( out, L">& " );
|
||||
break;
|
||||
|
||||
}
|
||||
{
|
||||
sb_append( out, L" " );
|
||||
if ( wcscmp( last, L"1" ) != 0 )
|
||||
sb_append( out, last );
|
||||
sb_append( out, L">&" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case TOK_BACKGROUND:
|
||||
{
|
||||
sb_append( out, L"&\n" );
|
||||
@@ -187,7 +231,6 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case TOK_COMMENT:
|
||||
{
|
||||
if( do_indent && flags)
|
||||
@@ -217,7 +260,12 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
|
||||
return res;
|
||||
}
|
||||
|
||||
wchar_t *trim( wchar_t *in )
|
||||
/**
|
||||
Remove any prefix and suffix newlines from the specified
|
||||
string. Does not allocete a new string, edits the string in place
|
||||
and returns a pointer somewhere into the string.
|
||||
*/
|
||||
static wchar_t *trim( wchar_t *in )
|
||||
{
|
||||
wchar_t *end;
|
||||
|
||||
@@ -245,7 +293,9 @@ wchar_t *trim( wchar_t *in )
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The main mathod. Run the program.
|
||||
*/
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
string_buffer_t sb_in;
|
||||
|
||||
@@ -351,7 +351,7 @@ static int pager_buffered_writer( char c)
|
||||
*/
|
||||
static void pager_flush()
|
||||
{
|
||||
write( 1, pager_buffer->buff, pager_buffer->used );
|
||||
write_loop( 1, pager_buffer->buff, pager_buffer->used );
|
||||
pager_buffer->used = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -750,6 +750,9 @@ static void test_expand()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Test path functions
|
||||
*/
|
||||
static void test_path()
|
||||
{
|
||||
say( L"Testing path functions" );
|
||||
|
||||
2
fishd.c
2
fishd.c
@@ -521,7 +521,7 @@ static void load_or_save( int save)
|
||||
if( save )
|
||||
{
|
||||
|
||||
write( c.fd, SAVE_MSG, strlen(SAVE_MSG) );
|
||||
write_loop( c.fd, SAVE_MSG, strlen(SAVE_MSG) );
|
||||
enqueue_all( &c );
|
||||
}
|
||||
else
|
||||
|
||||
67
function.c
67
function.c
@@ -41,9 +41,9 @@
|
||||
typedef struct
|
||||
{
|
||||
/** Function definition */
|
||||
wchar_t *cmd;
|
||||
wchar_t *definition;
|
||||
/** Function description */
|
||||
wchar_t *desc;
|
||||
wchar_t *description;
|
||||
/**
|
||||
File where this function was defined
|
||||
*/
|
||||
@@ -53,6 +53,9 @@ typedef struct
|
||||
*/
|
||||
int definition_offset;
|
||||
|
||||
/**
|
||||
List of all named arguments for this function
|
||||
*/
|
||||
array_list_t *named_arguments;
|
||||
|
||||
|
||||
@@ -61,6 +64,10 @@ typedef struct
|
||||
*/
|
||||
int is_autoload;
|
||||
|
||||
/**
|
||||
Set to non-zero if invoking this function shadows the variables
|
||||
of the underlying function.
|
||||
*/
|
||||
int shadows;
|
||||
}
|
||||
function_internal_data_t;
|
||||
@@ -155,6 +162,9 @@ void function_init()
|
||||
&hash_wcs_cmp );
|
||||
}
|
||||
|
||||
/**
|
||||
Clear specified value, but not key
|
||||
*/
|
||||
static void clear_entry( void *key, void *value )
|
||||
{
|
||||
halloc_free( value );
|
||||
@@ -180,7 +190,7 @@ void function_add( function_data_t *data )
|
||||
|
||||
d = halloc( 0, sizeof( function_internal_data_t ) );
|
||||
d->definition_offset = parse_util_lineno( parser_get_buffer(), current_block->tok_pos )-1;
|
||||
d->cmd = halloc_wcsdup( d, data->definition );
|
||||
d->definition = halloc_wcsdup( d, data->definition );
|
||||
|
||||
if( data->named_arguments )
|
||||
{
|
||||
@@ -192,9 +202,9 @@ void function_add( function_data_t *data )
|
||||
}
|
||||
}
|
||||
|
||||
cmd_end = d->cmd + wcslen(d->cmd)-1;
|
||||
cmd_end = d->definition + wcslen(d->definition)-1;
|
||||
|
||||
d->desc = data->description?halloc_wcsdup( d, data->description ):0;
|
||||
d->description = data->description?halloc_wcsdup( d, data->description ):0;
|
||||
d->definition_file = intern(reader_current_filename());
|
||||
d->is_autoload = is_autoload;
|
||||
d->shadows = data->shadows;
|
||||
@@ -208,6 +218,43 @@ void function_add( function_data_t *data )
|
||||
|
||||
}
|
||||
|
||||
int function_copy( const wchar_t *name, const wchar_t *new_name )
|
||||
{
|
||||
int i;
|
||||
function_internal_data_t *d, *orig_d;
|
||||
|
||||
CHECK( name, 0 );
|
||||
CHECK( new_name, 0 );
|
||||
|
||||
orig_d = (function_internal_data_t *)hash_get(&function, name);
|
||||
if( !orig_d )
|
||||
return 0;
|
||||
|
||||
d = halloc(0, sizeof( function_internal_data_t ) );
|
||||
d->definition_offset = orig_d->definition_offset;
|
||||
d->definition = halloc_wcsdup( d, orig_d->definition );
|
||||
if( orig_d->named_arguments )
|
||||
{
|
||||
d->named_arguments = al_halloc( d );
|
||||
for( i=0; i<al_get_count( orig_d->named_arguments ); i++ )
|
||||
{
|
||||
al_push( d->named_arguments, halloc_wcsdup( d, (wchar_t *)al_get( orig_d->named_arguments, i ) ) );
|
||||
}
|
||||
d->description = orig_d->description?halloc_wcsdup(d, orig_d->description):0;
|
||||
d->shadows = orig_d->shadows;
|
||||
|
||||
// This new instance of the function shouldn't be tied to the def
|
||||
// file of the original.
|
||||
d->definition_file = 0;
|
||||
d->is_autoload = 0;
|
||||
}
|
||||
|
||||
hash_put( &function, intern(new_name), d );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int function_exists( const wchar_t *cmd )
|
||||
{
|
||||
|
||||
@@ -266,7 +313,7 @@ const wchar_t *function_get_definition( const wchar_t *name )
|
||||
data = (function_internal_data_t *)hash_get( &function, name );
|
||||
if( data == 0 )
|
||||
return 0;
|
||||
return data->cmd;
|
||||
return data->definition;
|
||||
}
|
||||
|
||||
array_list_t *function_get_named_arguments( const wchar_t *name )
|
||||
@@ -307,7 +354,7 @@ const wchar_t *function_get_desc( const wchar_t *name )
|
||||
if( data == 0 )
|
||||
return 0;
|
||||
|
||||
return _(data->desc);
|
||||
return _(data->description);
|
||||
}
|
||||
|
||||
void function_set_desc( const wchar_t *name, const wchar_t *desc )
|
||||
@@ -322,7 +369,7 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc )
|
||||
if( data == 0 )
|
||||
return;
|
||||
|
||||
data->desc = halloc_wcsdup( data, desc );
|
||||
data->description = halloc_wcsdup( data, desc );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,6 +378,10 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc )
|
||||
static int al_contains_str( array_list_t *list, const wchar_t * str )
|
||||
{
|
||||
int i;
|
||||
|
||||
CHECK( list, 0 );
|
||||
CHECK( str, 0 );
|
||||
|
||||
for( i=0; i<al_get_count( list ); i++ )
|
||||
{
|
||||
if( wcscmp( al_get( list, i ), str) == 0 )
|
||||
|
||||
33
function.h
33
function.h
@@ -15,15 +15,38 @@
|
||||
#include "util.h"
|
||||
|
||||
/**
|
||||
Structure describing a function
|
||||
*/
|
||||
Structure describing a function. This is used by the parser to
|
||||
store data on a function while parsing it. It is not used
|
||||
internally to store functions, the function_internal_data_t
|
||||
structure is used for that purpose. Parhaps these two should be
|
||||
merged.
|
||||
*/
|
||||
typedef struct function_data
|
||||
{
|
||||
/**
|
||||
Name of function
|
||||
*/
|
||||
wchar_t *name;
|
||||
/**
|
||||
Description of function
|
||||
*/
|
||||
wchar_t *description;
|
||||
/**
|
||||
Function definition
|
||||
*/
|
||||
wchar_t *definition;
|
||||
/**
|
||||
List of all event handlers for this function
|
||||
*/
|
||||
array_list_t *events;
|
||||
/**
|
||||
List of all named arguments for this function
|
||||
*/
|
||||
array_list_t *named_arguments;
|
||||
/**
|
||||
Set to non-zero if invoking this function shadows the variables
|
||||
of the underlying function.
|
||||
*/
|
||||
int shadows;
|
||||
}
|
||||
function_data_t;
|
||||
@@ -108,4 +131,10 @@ array_list_t *function_get_named_arguments( const wchar_t *name );
|
||||
*/
|
||||
int function_get_shadows( const wchar_t *name );
|
||||
|
||||
/**
|
||||
Creates a new function using the same definition as the specified function.
|
||||
Returns non-zero if copy is successful.
|
||||
*/
|
||||
int function_copy( const wchar_t *name, const wchar_t *new_name );
|
||||
|
||||
#endif
|
||||
|
||||
6
halloc.c
6
halloc.c
@@ -78,6 +78,9 @@ typedef struct halloc
|
||||
}
|
||||
halloc_t;
|
||||
|
||||
/**
|
||||
Allign the specified pointer
|
||||
*/
|
||||
static char *align_ptr( char *in )
|
||||
{
|
||||
unsigned long step = maxi(sizeof(double),sizeof(void *));
|
||||
@@ -87,6 +90,9 @@ static char *align_ptr( char *in )
|
||||
return (char *)long_out;
|
||||
}
|
||||
|
||||
/**
|
||||
Allign specifies size_t
|
||||
*/
|
||||
static size_t align_sz( size_t in )
|
||||
{
|
||||
size_t step = maxi(sizeof(double),sizeof(void *));
|
||||
|
||||
16
highlight.c
16
highlight.c
@@ -530,6 +530,20 @@ static void highlight_param( const wchar_t * buff,
|
||||
}
|
||||
}
|
||||
|
||||
static int has_expand_reserved( wchar_t *str )
|
||||
{
|
||||
while( *str )
|
||||
{
|
||||
if( *str >= EXPAND_RESERVED &&
|
||||
*str <= EXPAND_RESERVED_END )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void highlight_shell( wchar_t * buff,
|
||||
int *color,
|
||||
@@ -639,7 +653,7 @@ void highlight_shell( wchar_t * buff,
|
||||
wcsdup(tok_last( &tok )),
|
||||
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES);
|
||||
|
||||
if( cmd == 0 )
|
||||
if( (cmd == 0) || has_expand_reserved( cmd ) )
|
||||
{
|
||||
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
||||
}
|
||||
|
||||
@@ -252,6 +252,9 @@ static wchar_t *history_unescape_newlines( wchar_t *in )
|
||||
return (wchar_t *)out->buff;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the specified item is already loaded
|
||||
*/
|
||||
static int item_is_new( history_mode_t *m, void *d )
|
||||
{
|
||||
char *begin = (char *)d;
|
||||
@@ -409,6 +412,9 @@ static void history_destroy_mode( history_mode_t *m )
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Free all memory used by specified mistory mode
|
||||
*/
|
||||
static void history_destroy_mode_wrapper( void *n, history_mode_t *m )
|
||||
{
|
||||
halloc_free( m );
|
||||
|
||||
27
input.c
27
input.c
@@ -232,6 +232,9 @@ static const wchar_t code_arr[] =
|
||||
*/
|
||||
static array_list_t mappings = {0,0,0};
|
||||
|
||||
/**
|
||||
List of all terminfo mappings
|
||||
*/
|
||||
static array_list_t *terminfo_mappings = 0;
|
||||
|
||||
|
||||
@@ -240,28 +243,18 @@ static array_list_t *terminfo_mappings = 0;
|
||||
*/
|
||||
static int is_init = 0;
|
||||
|
||||
/**
|
||||
Initialize terminfo.
|
||||
*/
|
||||
static void input_terminfo_init();
|
||||
/**
|
||||
Deallocate memory used by terminfo. Or at least try to. Terminfo leaks.
|
||||
*/
|
||||
static void input_terminfo_destroy();
|
||||
|
||||
/**
|
||||
Returns the function description for the given function code.
|
||||
*/
|
||||
/*
|
||||
static const wchar_t *input_get_desc( wchar_t c )
|
||||
{
|
||||
|
||||
int i;
|
||||
for( i = 0; i<(sizeof( code_arr )/sizeof(wchar_t)) ; i++ )
|
||||
{
|
||||
if( c == code_arr[i] )
|
||||
{
|
||||
return desc_arr[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void input_mapping_add( const wchar_t *sequence,
|
||||
const wchar_t *command )
|
||||
@@ -300,7 +293,7 @@ static int interrupt_handler()
|
||||
/*
|
||||
Fire any pending events
|
||||
*/
|
||||
event_fire( 0 );
|
||||
event_fire( NULL );
|
||||
|
||||
/*
|
||||
Reap stray processes, including printing exit status messages
|
||||
|
||||
19
input.h
19
input.h
@@ -89,19 +89,26 @@ void input_unreadch( wint_t ch );
|
||||
|
||||
|
||||
/**
|
||||
Add a key mapping from the specified sequence
|
||||
Add a key mapping from the specified sequence to the specified command
|
||||
|
||||
\param mode the name of the mapping mode to add this mapping to
|
||||
\param s the sequence
|
||||
\param d a description of the sequence
|
||||
\param cmd an input function that will be run whenever the key sequence occurs
|
||||
\param sequence the sequence to bind
|
||||
\param command an input function that will be run whenever the key sequence occurs
|
||||
*/
|
||||
void input_mapping_add( const wchar_t *sequence, const wchar_t *cmd );
|
||||
void input_mapping_add( const wchar_t *sequence, const wchar_t *command );
|
||||
|
||||
/**
|
||||
Insert all mapping names into the specified array_list_t
|
||||
*/
|
||||
void input_mapping_get_names( array_list_t *list );
|
||||
|
||||
/**
|
||||
Erase binding for specified key sequence
|
||||
*/
|
||||
int input_mapping_erase( const wchar_t *sequence );
|
||||
|
||||
/**
|
||||
Return the command bound to the specified key sequence
|
||||
*/
|
||||
const wchar_t *input_mapping_get( const wchar_t *sequence );
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ Implementation file for the low level input library
|
||||
|
||||
/**
|
||||
Time in milliseconds to wait for another byte to be available for
|
||||
reading after \x1b is read before assuming that escape key was
|
||||
reading after \\x1b is read before assuming that escape key was
|
||||
pressed, and not an escape sequence.
|
||||
*/
|
||||
#define WAIT_ON_ESCAPE 10
|
||||
|
||||
3
io.h
3
io.h
@@ -44,6 +44,9 @@ typedef struct io_data
|
||||
} param2
|
||||
;
|
||||
|
||||
/**
|
||||
Set to true if this is an input io redirection
|
||||
*/
|
||||
int is_input;
|
||||
|
||||
/** Pointer to the next IO redirection */
|
||||
|
||||
46
kill.c
46
kill.c
@@ -45,19 +45,25 @@ static ll_node_t /** Last kill string */*kill_last=0, /** Current kill string */
|
||||
static wchar_t *cut_buffer=0;
|
||||
|
||||
/**
|
||||
Test if the xsel command is installed
|
||||
Test if the xsel command is installed. Since this is called often,
|
||||
cache the result.
|
||||
*/
|
||||
static int has_xsel()
|
||||
{
|
||||
static int called=0;
|
||||
static int res = 0;
|
||||
|
||||
if (!called) {
|
||||
void *context = halloc(0, 0);
|
||||
wchar_t *path = path_get_path( context, L"xsel" );
|
||||
int res = !!path;
|
||||
res = !!path;
|
||||
halloc_free( context );
|
||||
called = 1;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Add the string to the internal killring
|
||||
*/
|
||||
@@ -86,17 +92,41 @@ static void kill_add_internal( wchar_t *str )
|
||||
|
||||
void kill_add( wchar_t *str )
|
||||
{
|
||||
wchar_t *cmd = NULL;
|
||||
wchar_t *escaped_str;
|
||||
kill_add_internal(str);
|
||||
|
||||
if( !has_xsel() )
|
||||
return;
|
||||
|
||||
/*
|
||||
Check to see if user has set the FISH_CLIPBOARD_CMD variable,
|
||||
and, if so, use it instead of checking the display, etc.
|
||||
|
||||
I couldn't think of a safe way to allow overide of the echo
|
||||
command too, so, the command used must accept the input via stdin.
|
||||
*/
|
||||
wchar_t *clipboard;
|
||||
if( (clipboard = env_get(L"FISH_CLIPBOARD_CMD")) )
|
||||
{
|
||||
escaped_str = escape( str, 1 );
|
||||
cmd = wcsdupcat(L"echo -n ", escaped_str, clipboard);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is for sending the kill to the X copy-and-paste buffer */
|
||||
if( !has_xsel() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wchar_t *disp;
|
||||
if( (disp = env_get( L"DISPLAY" )) )
|
||||
{
|
||||
wchar_t *escaped_str = escape( str, 1 );
|
||||
wchar_t *cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
|
||||
escaped_str = escape( str, 1 );
|
||||
cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd != NULL)
|
||||
{
|
||||
if( exec_subshell( cmd, 0 ) == -1 )
|
||||
{
|
||||
/*
|
||||
|
||||
120
mimedb.c
120
mimedb.c
@@ -94,6 +94,17 @@ license. Read the source code of the library for more information.
|
||||
*/
|
||||
#define GETOPT_STRING "tfimdalhv"
|
||||
|
||||
/**
|
||||
Error message if system call goes wrong.
|
||||
*/
|
||||
#define ERROR_SYSTEM "%s: Could not execute command \"%s\"\n"
|
||||
|
||||
/**
|
||||
Exit code if system call goes wrong.
|
||||
*/
|
||||
#define STATUS_ERROR_SYSTEM 1
|
||||
|
||||
|
||||
/**
|
||||
All types of input and output possible
|
||||
*/
|
||||
@@ -203,7 +214,7 @@ static char * search_ini( const char *filename, const char *match )
|
||||
buf[0]=0;
|
||||
done = 1;
|
||||
}
|
||||
else if( strncmp( buf, match,len )==0)
|
||||
else if( strncmp( buf, match, len ) == 0 && buf[len] == '=' )
|
||||
{
|
||||
done=1;
|
||||
}
|
||||
@@ -229,7 +240,9 @@ static char * search_ini( const char *filename, const char *match )
|
||||
*/
|
||||
static char *file_exists( const char *dir, const char *in )
|
||||
{
|
||||
char *filename = my_malloc( strlen( dir ) + strlen(in) + 1 );
|
||||
int dir_len = strlen( dir );
|
||||
int need_sep = dir[dir_len - 1] != '/';
|
||||
char *filename = my_malloc( dir_len + need_sep + strlen( in ) + 1 );
|
||||
char *replaceme;
|
||||
struct stat buf;
|
||||
|
||||
@@ -240,7 +253,9 @@ static char *file_exists( const char *dir, const char *in )
|
||||
return 0;
|
||||
}
|
||||
strcpy( filename, dir );
|
||||
strcat( filename, in );
|
||||
if ( need_sep )
|
||||
filename[dir_len++] = '/';
|
||||
strcpy( filename + dir_len, in );
|
||||
|
||||
if( !stat( filename, &buf ) )
|
||||
return filename;
|
||||
@@ -274,9 +289,15 @@ static char *file_exists( const char *dir, const char *in )
|
||||
Try to find the specified file in any of the possible directories
|
||||
where mime files can be located. This code is shamelessly stolen
|
||||
from xdg_run_command_on_dirs.
|
||||
|
||||
\param list Full file paths will be appended to this list.
|
||||
\param f The relative filename search for the the data directories.
|
||||
\param all If zero, then stop after the first filename.
|
||||
\return The number of filenames added to the list.
|
||||
*/
|
||||
static char *get_filename( char *f )
|
||||
static int append_filenames( array_list_t *list, char *f, int all )
|
||||
{
|
||||
int prev_count = al_get_count( list );
|
||||
char *result;
|
||||
const char *xdg_data_home;
|
||||
const char *xdg_data_dirs;
|
||||
@@ -286,8 +307,12 @@ static char *get_filename( char *f )
|
||||
if (xdg_data_home)
|
||||
{
|
||||
result = file_exists( xdg_data_home, f );
|
||||
if (result)
|
||||
return result;
|
||||
if ( result )
|
||||
{
|
||||
al_push( list, result );
|
||||
if ( !all )
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -298,23 +323,27 @@ static char *get_filename( char *f )
|
||||
{
|
||||
char *guessed_xdg_home;
|
||||
|
||||
guessed_xdg_home = my_malloc (strlen (home) + strlen ("/.local/share/") + 1);
|
||||
guessed_xdg_home = my_malloc (strlen (home) + strlen ("/.local/share") + 1);
|
||||
if( !guessed_xdg_home )
|
||||
return 0;
|
||||
|
||||
strcpy (guessed_xdg_home, home);
|
||||
strcat (guessed_xdg_home, "/.local/share/");
|
||||
strcat (guessed_xdg_home, "/.local/share");
|
||||
result = file_exists( guessed_xdg_home, f );
|
||||
free (guessed_xdg_home);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
if ( result )
|
||||
{
|
||||
al_push( list, result );
|
||||
if ( !all )
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xdg_data_dirs = getenv ("XDG_DATA_DIRS");
|
||||
if (xdg_data_dirs == NULL)
|
||||
xdg_data_dirs = "/usr/local/share/:/usr/share/";
|
||||
xdg_data_dirs = "/usr/local/share:/usr/share";
|
||||
|
||||
ptr = xdg_data_dirs;
|
||||
|
||||
@@ -334,10 +363,7 @@ static char *get_filename( char *f )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*end_ptr == ':')
|
||||
len = end_ptr - ptr;
|
||||
else
|
||||
len = end_ptr - ptr + 1;
|
||||
dir = my_malloc (len + 1);
|
||||
if( !dir )
|
||||
return 0;
|
||||
@@ -348,12 +374,32 @@ static char *get_filename( char *f )
|
||||
|
||||
free (dir);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
if ( result )
|
||||
{
|
||||
al_push( list, result );
|
||||
if ( !all ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ptr = end_ptr;
|
||||
}
|
||||
return 0;
|
||||
return al_get_count( list ) - prev_count;
|
||||
}
|
||||
|
||||
/**
|
||||
Find at most one file relative to the XDG data directories.
|
||||
*/
|
||||
static char *get_filename( char *f )
|
||||
{
|
||||
array_list_t list;
|
||||
char *first = NULL;
|
||||
|
||||
al_init( &list );
|
||||
append_filenames( &list, f, 0 );
|
||||
first = al_pop( &list );
|
||||
al_destroy( &list );
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,7 +516,7 @@ static char *get_description( const char *mimetype )
|
||||
int fd;
|
||||
struct stat st;
|
||||
char *contents;
|
||||
char *start=0, *stop=0;
|
||||
char *start=0, *stop=0, *best_start=0;
|
||||
|
||||
if( !start_re )
|
||||
{
|
||||
@@ -583,6 +629,7 @@ static char *get_description( const char *mimetype )
|
||||
while( !regexec(start_re, start, 1, match, 0) )
|
||||
{
|
||||
int new_w = match[0].rm_eo - match[0].rm_so;
|
||||
start += match[0].rm_eo;
|
||||
|
||||
if( new_w > w )
|
||||
{
|
||||
@@ -591,12 +638,13 @@ static char *get_description( const char *mimetype )
|
||||
match, so we use the new match
|
||||
*/
|
||||
w=new_w;
|
||||
start += match[0].rm_eo;
|
||||
best_start = start;
|
||||
}
|
||||
}
|
||||
|
||||
if( w != -1 )
|
||||
{
|
||||
start = best_start;
|
||||
if( !regexec(stop_re, start, 1, match, 0) )
|
||||
{
|
||||
/*
|
||||
@@ -625,22 +673,32 @@ static char *get_description( const char *mimetype )
|
||||
static char *get_action( const char *mimetype )
|
||||
{
|
||||
char *res=0;
|
||||
int i;
|
||||
|
||||
char *launcher;
|
||||
char *end;
|
||||
char *mime_filename;
|
||||
array_list_t mime_filenames;
|
||||
|
||||
char *launcher_str;
|
||||
char *launcher_str = NULL;
|
||||
char *launcher_filename, *launcher_command_str, *launcher_command;
|
||||
char *launcher_full;
|
||||
|
||||
mime_filename = get_filename( DESKTOP_DEFAULT );
|
||||
if( !mime_filename )
|
||||
al_init( &mime_filenames );
|
||||
if( !append_filenames( &mime_filenames, DESKTOP_DEFAULT, 1 ) )
|
||||
{
|
||||
al_destroy( &mime_filenames );
|
||||
return 0;
|
||||
}
|
||||
|
||||
launcher_str = search_ini( mime_filename, mimetype );
|
||||
for ( i = 0; i < al_get_count( &mime_filenames ); i++ )
|
||||
{
|
||||
launcher_str = search_ini( al_get( &mime_filenames, i ), mimetype );
|
||||
if ( launcher_str )
|
||||
break;
|
||||
}
|
||||
|
||||
free( mime_filename );
|
||||
al_foreach( &mime_filenames, free );
|
||||
al_destroy( &mime_filenames );
|
||||
|
||||
if( !launcher_str )
|
||||
{
|
||||
@@ -665,7 +723,7 @@ static char *get_action( const char *mimetype )
|
||||
Core 3) we also test some common subclassings.
|
||||
*/
|
||||
|
||||
if( strncmp( mimetype, "text/", 5 ) == 0 )
|
||||
if( strncmp( mimetype, "text/plain", 10) != 0 && strncmp( mimetype, "text/", 5 ) == 0 )
|
||||
return get_action( "text/plain" );
|
||||
|
||||
return 0;
|
||||
@@ -704,7 +762,7 @@ static char *get_action( const char *mimetype )
|
||||
|
||||
free( launcher_full );
|
||||
|
||||
launcher_command_str = search_ini( launcher_filename, "Exec=" );
|
||||
launcher_command_str = search_ini( launcher_filename, "Exec" );
|
||||
|
||||
if( !launcher_command_str )
|
||||
{
|
||||
@@ -1125,8 +1183,12 @@ static void launch( char *filter, array_list_t *files, int fileno )
|
||||
writer( '&' );
|
||||
writer( '\0' );
|
||||
|
||||
// fprintf( stderr, "mimedb: %s\n", launch_buff );
|
||||
system( launch_buff );
|
||||
if( system( launch_buff ) == -1 )
|
||||
{
|
||||
fprintf( stderr, _( ERROR_SYSTEM ), MIMEDB, launch_buff );
|
||||
exit(STATUS_ERROR_SYSTEM);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
5
output.c
5
output.c
@@ -121,6 +121,9 @@ static char *writestr_buff = 0;
|
||||
|
||||
static int (*out)(char c) = &writeb_internal;
|
||||
|
||||
/**
|
||||
Name of terminal
|
||||
*/
|
||||
static wchar_t *current_term = 0;
|
||||
|
||||
|
||||
@@ -359,7 +362,7 @@ void set_color( int c, int c2 )
|
||||
*/
|
||||
static int writeb_internal( char c )
|
||||
{
|
||||
write( 1, &c, 1 );
|
||||
write_loop( 1, &c, 1 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
14
output.h
14
output.h
@@ -73,7 +73,9 @@ enum
|
||||
|
||||
void set_color( int c, int c2 );
|
||||
|
||||
|
||||
/**
|
||||
Write specified multibyte string
|
||||
*/
|
||||
#define writembs( mbs ) \
|
||||
{ \
|
||||
char *tmp = mbs; \
|
||||
@@ -144,10 +146,18 @@ int writeb( tputs_arg_t b );
|
||||
void output_set_writer( int (*writer)(char) );
|
||||
|
||||
//typedef int (*func_ptr_t)(char);
|
||||
|
||||
/**
|
||||
Return the current output writer
|
||||
*/
|
||||
int (*output_get_writer())(char) ;
|
||||
|
||||
/**
|
||||
Set the terminal name
|
||||
*/
|
||||
void output_set_term( wchar_t *term );
|
||||
/**
|
||||
Return the terminal name
|
||||
*/
|
||||
wchar_t *output_get_term();
|
||||
|
||||
#endif
|
||||
|
||||
22
parser.c
22
parser.c
@@ -292,7 +292,7 @@ struct block_lookup_entry
|
||||
/**
|
||||
List of all legal block types
|
||||
*/
|
||||
const static struct block_lookup_entry block_lookup[]=
|
||||
static const struct block_lookup_entry block_lookup[]=
|
||||
{
|
||||
{
|
||||
WHILE, L"while", WHILE_BLOCK
|
||||
@@ -436,6 +436,7 @@ typedef struct
|
||||
/**
|
||||
Return the current number of block nestings
|
||||
*/
|
||||
/*
|
||||
static int block_count( block_t *b )
|
||||
{
|
||||
|
||||
@@ -443,7 +444,7 @@ static int block_count( block_t *b )
|
||||
return 0;
|
||||
return( block_count(b->outer)+1);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void parser_push_block( int type )
|
||||
{
|
||||
@@ -1513,7 +1514,9 @@ static void parse_job_argument_list( process_t *p,
|
||||
{
|
||||
case TOK_STRING:
|
||||
{
|
||||
target = (wchar_t *)expand_one( j, wcsdup( tok_last( tok ) ), 0);
|
||||
target = (wchar_t *)expand_one( j,
|
||||
wcsdup( tok_last( tok ) ),
|
||||
no_exec ? EXPAND_SKIP_VARIABLES : 0);
|
||||
|
||||
if( target == 0 && error_code == 0 )
|
||||
{
|
||||
@@ -2086,6 +2089,7 @@ static int parse_job( process_t *p,
|
||||
current_tokenizer_pos=tmp;
|
||||
|
||||
job_set_flag( j, JOB_SKIP, 1 );
|
||||
event_fire_generic(L"fish_command_not_found", (wchar_t *)al_get( args, 0 ) );
|
||||
proc_set_last_status( err==ENOENT?STATUS_UNKNOWN_COMMAND:STATUS_NOT_EXECUTABLE );
|
||||
}
|
||||
}
|
||||
@@ -2315,8 +2319,12 @@ static void eval_job( tokenizer *tok )
|
||||
j = job_create();
|
||||
job_set_flag( j, JOB_FOREGROUND, 1 );
|
||||
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) );
|
||||
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) && (!is_subshell && !is_event));
|
||||
job_set_flag( j, JOB_SKIP_NOTIFICATION, is_subshell || is_block || is_event || (!is_interactive));
|
||||
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) \
|
||||
&& (!is_subshell && !is_event));
|
||||
job_set_flag( j, JOB_SKIP_NOTIFICATION, is_subshell \
|
||||
|| is_block \
|
||||
|| is_event \
|
||||
|| (!is_interactive));
|
||||
|
||||
current_block->job = j;
|
||||
|
||||
@@ -2536,7 +2544,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
|
||||
|
||||
error_code = 0;
|
||||
|
||||
event_fire( 0 );
|
||||
event_fire( NULL );
|
||||
|
||||
while( tok_has_next( current_tokenizer ) &&
|
||||
!error_code &&
|
||||
@@ -2544,7 +2552,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
|
||||
!exit_status() )
|
||||
{
|
||||
eval_job( current_tokenizer );
|
||||
event_fire( 0 );
|
||||
event_fire( NULL );
|
||||
}
|
||||
|
||||
int prev_block_type = current_block->type;
|
||||
|
||||
10
path.h
10
path.h
@@ -9,6 +9,9 @@
|
||||
#ifndef FISH_PATH_H
|
||||
#define FISH_PATH_H
|
||||
|
||||
/**
|
||||
Return value for path_cdpath_get when locatied a rotten symlink
|
||||
*/
|
||||
#define EROTTEN 1
|
||||
|
||||
/**
|
||||
@@ -48,6 +51,13 @@ wchar_t *path_get_path( void *context, const wchar_t *cmd );
|
||||
*/
|
||||
wchar_t *path_get_cdpath( void *context, wchar_t *in );
|
||||
|
||||
/**
|
||||
Remove doulbe slashes and trailing slashes from a path,
|
||||
e.g. transform foo//bar/ into foo/bar.
|
||||
|
||||
The returned string is allocated using the specified halloc
|
||||
context.
|
||||
*/
|
||||
wchar_t *path_make_canonical( void *context, const wchar_t *path );
|
||||
|
||||
|
||||
|
||||
16
print_help.c
16
print_help.c
@@ -5,18 +5,30 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "print_help.h"
|
||||
|
||||
#define CMD_LEN 1024
|
||||
|
||||
#define HELP_ERR "Could not show help message\n"
|
||||
|
||||
/* defined in common.h */
|
||||
ssize_t write_loop(int fd, char *buff, size_t count);
|
||||
|
||||
|
||||
void print_help( char *c, int fd )
|
||||
{
|
||||
char cmd[ CMD_LEN];
|
||||
int printed = snprintf( cmd, CMD_LEN, "fish -c '__fish_print_help %s >&%d'", c, fd );
|
||||
|
||||
if( printed < CMD_LEN )
|
||||
system( cmd );
|
||||
{
|
||||
if( (system( cmd ) == -1) )
|
||||
{
|
||||
write_loop(2, HELP_ERR, strlen(HELP_ERR));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
51
proc.c
51
proc.c
@@ -343,30 +343,35 @@ static void mark_process_status( job_t *j,
|
||||
process_t *p,
|
||||
int status )
|
||||
{
|
||||
p->status = status;
|
||||
// debug( 0, L"Process %ls %ls", p->argv[0], WIFSTOPPED (status)?L"stopped":(WIFEXITED( status )?L"exited":(WIFSIGNALED( status )?L"signaled to exit":L"BLARGH")) );
|
||||
p->status = status;
|
||||
|
||||
if (WIFSTOPPED (status))
|
||||
{
|
||||
p->stopped = 1;
|
||||
}
|
||||
else
|
||||
else if (WIFSIGNALED(status) || WIFEXITED(status))
|
||||
{
|
||||
p->completed = 1;
|
||||
|
||||
|
||||
if (( !WIFEXITED( status ) ) &&
|
||||
(! WIFSIGNALED( status )) )
|
||||
}
|
||||
else
|
||||
{
|
||||
ssize_t ignore;
|
||||
|
||||
/* This should never be reached */
|
||||
p->completed = 1;
|
||||
|
||||
char mess[MESS_SIZE];
|
||||
snprintf( mess,
|
||||
MESS_SIZE,
|
||||
"Process %d exited abnormally\n",
|
||||
(int) p->pid );
|
||||
|
||||
write( 2, mess, strlen(mess) );
|
||||
}
|
||||
/*
|
||||
If write fails, do nothing. We're in a signal handlers error
|
||||
handler. If things aren't working properly, it's safer to
|
||||
give up.
|
||||
*/
|
||||
ignore = write( 2, mess, strlen(mess) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -817,8 +822,8 @@ static int select_try( job_t *j )
|
||||
int retval;
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec=5;
|
||||
tv.tv_usec=0;
|
||||
tv.tv_sec=0;
|
||||
tv.tv_usec=10000;
|
||||
|
||||
retval =select( maxfd+1, &fds, 0, 0, &tv );
|
||||
return retval > 0;
|
||||
@@ -926,7 +931,7 @@ static int terminal_give_to_job( job_t *j, int cont )
|
||||
static int terminal_return_from_job( job_t *j)
|
||||
{
|
||||
|
||||
if( tcsetpgrp (0, getpid()) )
|
||||
if( tcsetpgrp (0, getpgrp()) )
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetpgrp" );
|
||||
@@ -1106,7 +1111,7 @@ void job_continue (job_t *j, int cont)
|
||||
while( p->next )
|
||||
p = p->next;
|
||||
|
||||
if( WIFEXITED( p->status ) )
|
||||
if( WIFEXITED( p->status ) || WIFSIGNALED(p->status))
|
||||
{
|
||||
/*
|
||||
Mark process status only if we are in the foreground
|
||||
@@ -1114,8 +1119,9 @@ void job_continue (job_t *j, int cont)
|
||||
*/
|
||||
if( p->pid )
|
||||
{
|
||||
debug( 3, L"Set status of %ls to %d", j->command, WEXITSTATUS(p->status) );
|
||||
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(WEXITSTATUS(p->status)?0:1):WEXITSTATUS(p->status) );
|
||||
int status = proc_format_status(p->status);
|
||||
|
||||
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?!status:status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1140,6 +1146,21 @@ void job_continue (job_t *j, int cont)
|
||||
|
||||
}
|
||||
|
||||
int proc_format_status(int status)
|
||||
{
|
||||
if( WIFSIGNALED( status ) )
|
||||
{
|
||||
return 128+WTERMSIG(status);
|
||||
}
|
||||
else if( WIFEXITED( status ) )
|
||||
{
|
||||
return WEXITSTATUS(status);
|
||||
}
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void proc_sanity_check()
|
||||
{
|
||||
job_t *j;
|
||||
|
||||
6
proc.h
6
proc.h
@@ -485,4 +485,10 @@ void proc_push_interactive( int value );
|
||||
*/
|
||||
void proc_pop_interactive();
|
||||
|
||||
/**
|
||||
Format an exit status code as returned by e.g. wait into a fish exit code number as accepted by proc_set_last_status.
|
||||
*/
|
||||
int proc_format_status(int status) ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
270
reader.c
270
reader.c
@@ -117,6 +117,9 @@ commence.
|
||||
*/
|
||||
#define DEFAULT_PROMPT L"echo \"$USER@\"; hostname|cut -d . -f 1; echo \" \"; pwd; printf '> ';"
|
||||
|
||||
/**
|
||||
The name of the function that prints the fish prompt
|
||||
*/
|
||||
#define PROMPT_FUNCTION_NAME L"fish_prompt"
|
||||
|
||||
/**
|
||||
@@ -132,15 +135,40 @@ commence.
|
||||
*/
|
||||
#define READAHEAD_MAX 256
|
||||
|
||||
/**
|
||||
A mode for calling the reader_kill function. In this mode, the new
|
||||
string is appended to the current contents of the kill buffer.
|
||||
*/
|
||||
#define KILL_APPEND 0
|
||||
/**
|
||||
A mode for calling the reader_kill function. In this mode, the new
|
||||
string is prepended to the current contents of the kill buffer.
|
||||
*/
|
||||
#define KILL_PREPEND 1
|
||||
|
||||
|
||||
/**
|
||||
History search mode. This value means that no search is currently
|
||||
performed.
|
||||
*/
|
||||
#define NO_SEARCH 0
|
||||
/**
|
||||
History search mode. This value means that we are perforing a line
|
||||
history search.
|
||||
*/
|
||||
#define LINE_SEARCH 1
|
||||
/**
|
||||
History search mode. This value means that we are perforing a token
|
||||
history search.
|
||||
*/
|
||||
#define TOKEN_SEARCH 2
|
||||
|
||||
/**
|
||||
History search mode. This value means we are searching backwards.
|
||||
*/
|
||||
#define SEARCH_BACKWARD 0
|
||||
/**
|
||||
History search mode. This value means we are searching forwards.
|
||||
*/
|
||||
#define SEARCH_FORWARD 1
|
||||
|
||||
/**
|
||||
@@ -155,6 +183,9 @@ typedef struct reader_data
|
||||
*/
|
||||
wchar_t *buff;
|
||||
|
||||
/**
|
||||
The representation of the current screen contents
|
||||
*/
|
||||
screen_t screen;
|
||||
|
||||
/**
|
||||
@@ -252,6 +283,9 @@ typedef struct reader_data
|
||||
*/
|
||||
int prev_end_loop;
|
||||
|
||||
/**
|
||||
The current contents of the top item in the kill ring.
|
||||
*/
|
||||
string_buffer_t kill_item;
|
||||
|
||||
/**
|
||||
@@ -509,6 +543,9 @@ static int check_size()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Compare two completion entrys
|
||||
*/
|
||||
static int completion_cmp( const void *a, const void *b )
|
||||
{
|
||||
completion_t *c= *((completion_t **)a);
|
||||
@@ -518,6 +555,9 @@ static int completion_cmp( const void *a, const void *b )
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Sort an array_list_t containing compltion_t structs.
|
||||
*/
|
||||
static void sort_completion_list( array_list_t *comp )
|
||||
{
|
||||
qsort( comp->arr,
|
||||
@@ -584,10 +624,16 @@ void reader_write_title()
|
||||
don't. Since we can't see the underlying terminal below screen
|
||||
there is no way to fix this.
|
||||
*/
|
||||
if( !term || !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
|
||||
if ( !term )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
|
||||
{
|
||||
char *n = ttyname( STDIN_FILENO );
|
||||
|
||||
|
||||
if( contains( term, L"linux" ) )
|
||||
{
|
||||
return;
|
||||
@@ -601,7 +647,7 @@ void reader_write_title()
|
||||
|
||||
title = function_exists( L"fish_title" )?L"fish_title":DEFAULT_TITLE;
|
||||
|
||||
if( wcslen( title ) ==0 )
|
||||
if( wcslen( title ) == 0 )
|
||||
return;
|
||||
|
||||
al_init( &l );
|
||||
@@ -655,10 +701,11 @@ static void exec_prompt()
|
||||
|
||||
sb_clear( &data->prompt_buff );
|
||||
|
||||
for( i=0; i<al_get_count( &prompt_list); i++ )
|
||||
for( i = 0; i < al_get_count( &prompt_list )-1; i++ )
|
||||
{
|
||||
sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ) );
|
||||
sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ), L"\n" );
|
||||
}
|
||||
sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ));
|
||||
|
||||
al_foreach( &prompt_list, &free );
|
||||
al_destroy( &prompt_list );
|
||||
@@ -949,9 +996,8 @@ static void get_param( wchar_t *cmd,
|
||||
string.
|
||||
|
||||
\param val the string to insert
|
||||
\param is_complete Whether this completion is the whole string or
|
||||
just the common prefix of several completions. If the former, end by
|
||||
printing a space (and an end quote if the parameter is quoted).
|
||||
\param flags A union of all flags describing the completion to insert. See the completion_t struct for more information on possible values.
|
||||
|
||||
*/
|
||||
static void completion_insert( const wchar_t *val, int flags )
|
||||
{
|
||||
@@ -959,12 +1005,15 @@ static void completion_insert( const wchar_t *val, int flags )
|
||||
|
||||
wchar_t quote;
|
||||
int add_space = !(flags & COMPLETE_NO_SPACE);
|
||||
int do_replace = (flags&COMPLETE_NO_CASE);
|
||||
int do_replace = (flags & COMPLETE_NO_CASE);
|
||||
int do_escape = !(flags & COMPLETE_DONT_ESCAPE);
|
||||
|
||||
// debug( 0, L"Insert completion %ls with flags %d", val, flags);
|
||||
|
||||
if( do_replace )
|
||||
{
|
||||
|
||||
int tok_start, tok_len;
|
||||
int tok_start, tok_len, move_cursor;
|
||||
wchar_t *begin, *end;
|
||||
string_buffer_t sb;
|
||||
wchar_t *escaped;
|
||||
@@ -978,19 +1027,29 @@ static void completion_insert( const wchar_t *val, int flags )
|
||||
sb_init( &sb );
|
||||
sb_append_substring( &sb, data->buff, begin - data->buff );
|
||||
|
||||
if( do_escape )
|
||||
{
|
||||
escaped = escape( val, ESCAPE_ALL | ESCAPE_NO_QUOTED );
|
||||
|
||||
sb_append( &sb, escaped );
|
||||
move_cursor = wcslen(escaped);
|
||||
free( escaped );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_append( &sb, val );
|
||||
move_cursor = wcslen(val);
|
||||
}
|
||||
|
||||
|
||||
if( add_space )
|
||||
{
|
||||
sb_append( &sb, L" " );
|
||||
move_cursor += 1;
|
||||
}
|
||||
|
||||
sb_append( &sb, end );
|
||||
|
||||
reader_set_buffer( (wchar_t *)sb.buff, (begin-data->buff)+wcslen(val)+!!add_space );
|
||||
reader_set_buffer( (wchar_t *)sb.buff, (begin-data->buff)+move_cursor );
|
||||
sb_destroy( &sb );
|
||||
|
||||
reader_super_highlight_me_plenty( data->buff_pos, 0 );
|
||||
@@ -998,6 +1057,9 @@ static void completion_insert( const wchar_t *val, int flags )
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( do_escape )
|
||||
{
|
||||
|
||||
get_param( data->buff,
|
||||
@@ -1045,6 +1107,11 @@ static void completion_insert( const wchar_t *val, int flags )
|
||||
else
|
||||
*pout = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
replaced = wcsdup(val);
|
||||
}
|
||||
|
||||
if( insert_str( replaced ) )
|
||||
{
|
||||
@@ -1054,7 +1121,7 @@ static void completion_insert( const wchar_t *val, int flags )
|
||||
if( add_space )
|
||||
{
|
||||
|
||||
if( (quote) &&
|
||||
if( quote &&
|
||||
(data->buff[data->buff_pos] != quote ) )
|
||||
{
|
||||
/*
|
||||
@@ -1225,7 +1292,7 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
|
||||
io_buffer_destroy( in);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
Flash the screen. This function only changed the color of the
|
||||
current line, since the flash_screen sequnce is rather painful to
|
||||
look at in most terminal emulators.
|
||||
@@ -1253,6 +1320,46 @@ static void reader_flash()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Characters that may not be part of a token that is to be replaced
|
||||
by a case insensitive completion.
|
||||
*/
|
||||
#define REPLACE_UNCLEAN L"$*?({})"
|
||||
|
||||
/**
|
||||
Check if the specified string can be replaced by a case insensitive
|
||||
complition with the specified flags.
|
||||
|
||||
Advanced tokens like those containing {}-style expansion can not at
|
||||
the moment be replaced, other than if the new token is already an
|
||||
exact replacement, e.g. if the COMPLETE_DONT_ESCAPE flag is set.
|
||||
*/
|
||||
|
||||
int reader_can_replace( const wchar_t *in, int flags )
|
||||
{
|
||||
|
||||
const wchar_t * str = in;
|
||||
|
||||
if( flags & COMPLETE_DONT_ESCAPE )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
CHECK( in, 1 );
|
||||
|
||||
/*
|
||||
Test characters that have a special meaning in any character position
|
||||
*/
|
||||
while( *str )
|
||||
{
|
||||
if( wcschr( REPLACE_UNCLEAN, *str ) )
|
||||
return 0;
|
||||
str++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Handle the list of completions. This means the following:
|
||||
@@ -1288,8 +1395,14 @@ static int handle_completions( array_list_t *comp )
|
||||
context = halloc( 0, 0 );
|
||||
tok = halloc_wcsndup( context, begin, end-begin );
|
||||
|
||||
/*
|
||||
Check trivial cases
|
||||
*/
|
||||
switch( al_get_count( comp ) )
|
||||
{
|
||||
/*
|
||||
No suitable completions found, flash screen and retur
|
||||
*/
|
||||
case 0:
|
||||
{
|
||||
reader_flash();
|
||||
@@ -1297,12 +1410,21 @@ static int handle_completions( array_list_t *comp )
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
Exactly one suitable completion found - insert it
|
||||
*/
|
||||
case 1:
|
||||
{
|
||||
|
||||
completion_t *c = (completion_t *)al_get( comp, 0 );
|
||||
|
||||
if( !(c->flags & COMPLETE_NO_CASE) || expand_is_clean( tok ) )
|
||||
/*
|
||||
If this is a replacement completion, check
|
||||
that we know how to replace it, e.g. that
|
||||
the token doesn't contain evil operators
|
||||
like {}
|
||||
*/
|
||||
if( !(c->flags & COMPLETE_NO_CASE) || reader_can_replace( tok, c->flags ) )
|
||||
{
|
||||
completion_insert( c->completion,
|
||||
c->flags );
|
||||
@@ -1316,12 +1438,17 @@ static int handle_completions( array_list_t *comp )
|
||||
|
||||
if( !done )
|
||||
{
|
||||
|
||||
/*
|
||||
Try to find something to insert whith the correct case
|
||||
*/
|
||||
for( i=0; i<al_get_count( comp ); i++ )
|
||||
{
|
||||
completion_t *c = (completion_t *)al_get( comp, i );
|
||||
int new_len;
|
||||
|
||||
/*
|
||||
Ignore case insensitive completions for now
|
||||
*/
|
||||
if( c->flags & COMPLETE_NO_CASE )
|
||||
continue;
|
||||
|
||||
@@ -1340,6 +1467,9 @@ static int handle_completions( array_list_t *comp )
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
If we found something to insert, do it.
|
||||
*/
|
||||
if( len > 0 )
|
||||
{
|
||||
if( count > 1 )
|
||||
@@ -1352,14 +1482,16 @@ static int handle_completions( array_list_t *comp )
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( !done && base == 0 )
|
||||
{
|
||||
/*
|
||||
Try to find something to insert ignoring case
|
||||
*/
|
||||
|
||||
if( begin )
|
||||
{
|
||||
|
||||
if( expand_is_clean( tok ) )
|
||||
{
|
||||
int offset = wcslen( tok );
|
||||
|
||||
count = 0;
|
||||
@@ -1369,9 +1501,16 @@ static int handle_completions( array_list_t *comp )
|
||||
completion_t *c = (completion_t *)al_get( comp, i );
|
||||
int new_len;
|
||||
|
||||
|
||||
if( !(c->flags & COMPLETE_NO_CASE) )
|
||||
continue;
|
||||
|
||||
if( !reader_can_replace( tok, c->flags ) )
|
||||
{
|
||||
len=0;
|
||||
break;
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
if( base )
|
||||
@@ -1397,7 +1536,7 @@ static int handle_completions( array_list_t *comp )
|
||||
completion_insert( base, flags );
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1449,7 +1588,7 @@ static int handle_completions( array_list_t *comp )
|
||||
get_param( data->buff, data->buff_pos, "e, 0, 0, 0 );
|
||||
is_quoted = (quote != L'\0');
|
||||
|
||||
write(1, "\n", 1 );
|
||||
write_loop(1, "\n", 1 );
|
||||
|
||||
run_pager( prefix, is_quoted, comp );
|
||||
}
|
||||
@@ -1486,12 +1625,53 @@ static void reader_interactive_init()
|
||||
not enable it for us.
|
||||
*/
|
||||
|
||||
/* Loop until we are in the foreground. */
|
||||
/*
|
||||
Check if we are in control of the terminal, so that we don't do
|
||||
semi-expensive things like reset signal handlers unless we
|
||||
really have to, which we often don't.
|
||||
*/
|
||||
if (tcgetpgrp( 0 ) != shell_pgid)
|
||||
{
|
||||
int block_count = 0;
|
||||
int i;
|
||||
|
||||
/*
|
||||
Bummer, we are not in control of the terminal. Stop until
|
||||
parent has given us control of it. Stopping in fish is a bit
|
||||
of a challange, what with all the signal fidgeting, we need
|
||||
to reset a bunch of signal state, making this coda a but
|
||||
unobvious.
|
||||
|
||||
In theory, reseting signal handlers could cause us to miss
|
||||
signal deliveries. In practice, this code should only be run
|
||||
suring startup, when we're not waiting for any signals.
|
||||
*/
|
||||
while (signal_is_blocked())
|
||||
{
|
||||
signal_unblock();
|
||||
block_count++;
|
||||
}
|
||||
signal_reset_handlers();
|
||||
|
||||
/*
|
||||
Ok, signal handlers are taken out of the picture. Stop ourself in a loop
|
||||
until we are in control of the terminal.
|
||||
*/
|
||||
while (tcgetpgrp( 0 ) != shell_pgid)
|
||||
{
|
||||
killpg( shell_pgid, SIGTTIN);
|
||||
}
|
||||
|
||||
signal_set_handlers();
|
||||
|
||||
for( i=0; i<block_count; i++ )
|
||||
{
|
||||
signal_block();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Put ourselves in our own process group. */
|
||||
shell_pgid = getpid ();
|
||||
if( getpgrp() != shell_pgid )
|
||||
@@ -1801,7 +1981,7 @@ static void handle_token_history( int forward, int reset )
|
||||
|
||||
\param dir Direction to move/erase. 0 means move left, 1 means move right.
|
||||
\param erase Whether to erase the characters along the way or only move past them.
|
||||
\param do_append if erase is true, this flag decides if the new kill item should be appended to the previous kill item.
|
||||
\param new if the new kill item should be appended to the previous kill item or not.
|
||||
*/
|
||||
static void move_word( int dir, int erase, int new )
|
||||
{
|
||||
@@ -1970,6 +2150,10 @@ void reader_set_buffer( wchar_t *b, int p )
|
||||
data->buff_pos=l;
|
||||
}
|
||||
|
||||
data->search_mode = NO_SEARCH;
|
||||
sb_clear( &data->search_buff );
|
||||
history_reset();
|
||||
|
||||
reader_super_highlight_me_plenty( data->buff_pos,
|
||||
0 );
|
||||
reader_repaint_needed();
|
||||
@@ -1984,11 +2168,42 @@ int reader_get_cursor_pos()
|
||||
return data->buff_pos;
|
||||
}
|
||||
|
||||
#define ENV_CMD_DURATION L"CMD_DURATION"
|
||||
|
||||
void set_env_cmd_duration(struct timeval *after, struct timeval *before)
|
||||
{
|
||||
time_t secs = after->tv_sec - before->tv_sec;
|
||||
suseconds_t usecs = after->tv_usec - before->tv_usec;
|
||||
wchar_t buf[16];
|
||||
|
||||
if (after->tv_usec < before->tv_usec) {
|
||||
usecs += 1000000;
|
||||
secs -= 1;
|
||||
}
|
||||
|
||||
if (secs < 1) {
|
||||
env_remove( ENV_CMD_DURATION, 0 );
|
||||
} else {
|
||||
if (secs < 10) { // 10 secs
|
||||
swprintf(buf, 16, L"%lu.%02us", secs, usecs / 10000);
|
||||
} else if (secs < 60) { // 1 min
|
||||
swprintf(buf, 16, L"%lu.%01us", secs, usecs / 100000);
|
||||
} else if (secs < 600) { // 10 mins
|
||||
swprintf(buf, 16, L"%lum %lu.%01us", secs / 60, secs % 60, usecs / 100000);
|
||||
} else if (secs < 5400) { // 1.5 hours
|
||||
swprintf(buf, 16, L"%lum %lus", secs / 60, secs % 60);
|
||||
} else {
|
||||
swprintf(buf, 16, L"%.1fh", secs / 3600.0f);
|
||||
}
|
||||
env_set( ENV_CMD_DURATION, buf, ENV_EXPORT );
|
||||
}
|
||||
}
|
||||
|
||||
void reader_run_command( const wchar_t *cmd )
|
||||
{
|
||||
|
||||
wchar_t *ft;
|
||||
struct timeval time_before, time_after;
|
||||
|
||||
ft= tok_first( cmd );
|
||||
|
||||
@@ -2000,9 +2215,14 @@ void reader_run_command( const wchar_t *cmd )
|
||||
|
||||
term_donate();
|
||||
|
||||
gettimeofday(&time_before, NULL);
|
||||
|
||||
eval( cmd, 0, TOP );
|
||||
job_reap( 1 );
|
||||
|
||||
gettimeofday(&time_after, NULL);
|
||||
set_env_cmd_duration(&time_after, &time_before);
|
||||
|
||||
term_steal();
|
||||
|
||||
env_set( L"_", program_name, ENV_GLOBAL );
|
||||
@@ -2228,7 +2448,7 @@ static void handle_end_loop()
|
||||
|
||||
if( !reader_exit_forced() && !data->prev_end_loop && job_count && !is_breakpoint )
|
||||
{
|
||||
writestr(_( L"There are stopped jobs\n" ));
|
||||
writestr(_( L"There are stopped jobs. A second attempt to exit will enforce their termination.\n" ));
|
||||
|
||||
reader_exit( 0, 0 );
|
||||
data->prev_end_loop=1;
|
||||
@@ -2517,7 +2737,7 @@ wchar_t *reader_readline()
|
||||
case R_REPAINT:
|
||||
{
|
||||
exec_prompt();
|
||||
write( 1, "\r", 1 );
|
||||
write_loop( 1, "\r", 1 );
|
||||
s_reset( &data->screen, 0 );
|
||||
reader_repaint();
|
||||
break;
|
||||
@@ -2564,9 +2784,11 @@ wchar_t *reader_readline()
|
||||
comp = al_halloc( 0 );
|
||||
data->complete_func( buffcpy, comp );
|
||||
|
||||
|
||||
sort_completion_list( comp );
|
||||
remove_duplicates( comp );
|
||||
|
||||
|
||||
free( buffcpy );
|
||||
comp_empty = handle_completions( comp );
|
||||
|
||||
|
||||
31
screen.c
31
screen.c
@@ -86,6 +86,10 @@ static int try_sequence( char *seq, wchar_t *str )
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the number of columns left until the next tab stop, given
|
||||
the current cursor postion.
|
||||
*/
|
||||
static int next_tab_stop( int in )
|
||||
{
|
||||
/*
|
||||
@@ -232,6 +236,10 @@ static int calc_prompt_width( wchar_t *prompt )
|
||||
{
|
||||
res = next_tab_stop( res );
|
||||
}
|
||||
else if( prompt[j] == L'\n' )
|
||||
{
|
||||
res = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -333,7 +341,7 @@ static void s_check_status( screen_t *s)
|
||||
*/
|
||||
|
||||
int prev_line = s->actual_cursor[1];
|
||||
write( 1, "\r", 1 );
|
||||
write_loop( 1, "\r", 1 );
|
||||
s_reset( s, 0 );
|
||||
s->actual_cursor[1] = prev_line;
|
||||
}
|
||||
@@ -696,8 +704,8 @@ static void s_update( screen_t *scr, wchar_t *prompt )
|
||||
|
||||
for( j=start_pos; j<al_get_count( &o_line->text ); j++ )
|
||||
{
|
||||
wchar_t o = (wchar_t)al_get( &o_line->text, j );
|
||||
int o_c = (int)al_get( &o_line->color, j );
|
||||
wchar_t o = (wchar_t)(long)al_get( &o_line->text, j );
|
||||
int o_c = (int)(long)al_get( &o_line->color, j );
|
||||
|
||||
|
||||
if( !o )
|
||||
@@ -713,8 +721,8 @@ static void s_update( screen_t *scr, wchar_t *prompt )
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t s = (wchar_t)al_get( &s_line->text, j );
|
||||
int s_c = (int)al_get( &s_line->color, j );
|
||||
wchar_t s = (wchar_t)(long)al_get( &s_line->text, j );
|
||||
int s_c = (int)(long)al_get( &s_line->color, j );
|
||||
if( o != s || o_c != s_c )
|
||||
{
|
||||
s_move( scr, &output, current_width, i );
|
||||
@@ -752,13 +760,16 @@ static void s_update( screen_t *scr, wchar_t *prompt )
|
||||
|
||||
if( output.used )
|
||||
{
|
||||
write( 1, output.buff, output.used );
|
||||
write_loop( 1, output.buff, output.used );
|
||||
}
|
||||
|
||||
b_destroy( &output );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Returns non-zero if we are using a dumb terminal.
|
||||
*/
|
||||
static int is_dumb()
|
||||
{
|
||||
return ( !cursor_up || !cursor_down || !cursor_left || !cursor_right );
|
||||
@@ -797,9 +808,9 @@ void s_write( screen_t *s,
|
||||
char *prompt_narrow = wcs2str( prompt );
|
||||
char *buffer_narrow = wcs2str( b );
|
||||
|
||||
write( 1, "\r", 1 );
|
||||
write( 1, prompt_narrow, strlen( prompt_narrow ) );
|
||||
write( 1, buffer_narrow, strlen( buffer_narrow ) );
|
||||
write_loop( 1, "\r", 1 );
|
||||
write_loop( 1, prompt_narrow, strlen( prompt_narrow ) );
|
||||
write_loop( 1, buffer_narrow, strlen( buffer_narrow ) );
|
||||
|
||||
free( prompt_narrow );
|
||||
free( buffer_narrow );
|
||||
@@ -931,7 +942,7 @@ void s_reset( screen_t *s, int reset_cursor )
|
||||
This should prevent reseting the cursor position during the
|
||||
next repaint.
|
||||
*/
|
||||
write( 1, "\r", 1 );
|
||||
write_loop( 1, "\r", 1 );
|
||||
s->actual_cursor[1] = prev_line;
|
||||
}
|
||||
fstat( 1, &s->prev_buff_1 );
|
||||
|
||||
12
screen.h
12
screen.h
@@ -2,9 +2,13 @@
|
||||
|
||||
The screen library allows the interactive reader to write its
|
||||
output to screen efficiently by keeping an inetrnal representation
|
||||
of the current screen contents and trying to find the most
|
||||
of the current screen contents and trying to find a reasonably
|
||||
efficient way for transforming that to the desired screen content.
|
||||
*/
|
||||
|
||||
The current implementation is less smart than ncurses allows
|
||||
and can not for example move blocks of text around to handle text
|
||||
insertion.
|
||||
*/
|
||||
#ifndef FISH_SCREEN_H
|
||||
#define FISH_SCREEN_H
|
||||
|
||||
@@ -13,7 +17,7 @@
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
/**
|
||||
The internal representation of the desired screen contents.
|
||||
*/
|
||||
array_list_t desired;
|
||||
@@ -35,7 +39,7 @@ typedef struct
|
||||
*/
|
||||
string_buffer_t actual_prompt;
|
||||
|
||||
/*
|
||||
/**
|
||||
The actual width of the screen at the time of the last screen
|
||||
write.
|
||||
*/
|
||||
|
||||
6
seq.in
6
seq.in
@@ -45,4 +45,8 @@ for i in $from $step $to
|
||||
end
|
||||
end
|
||||
|
||||
echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
|
||||
if [ $step -ge 0 ]
|
||||
echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
|
||||
else
|
||||
echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc
|
||||
end
|
||||
|
||||
@@ -332,7 +332,7 @@ int main( int argc, char **argv )
|
||||
|
||||
if( del_curterm( cur_term ) == ERR )
|
||||
{
|
||||
fprintf( stderr, _("Error while closing terminfo") );
|
||||
fprintf( stderr, "%s", _("Error while closing terminfo") );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
28
share/completions/adduser.fish
Normal file
28
share/completions/adduser.fish
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Command specific completions for the adduser command.
|
||||
# These completions where generated from the commands
|
||||
# man page by the make_completions.py script, but may
|
||||
# have been hand edited since.
|
||||
#
|
||||
|
||||
complete -x -c adduser -a "(__fish_complete_users; __fish_complete_groups)"
|
||||
complete -c adduser -l conf --description 'Specify config file' -r
|
||||
complete -c adduser -l disabled-login --description 'Do not run passwd to set the password'
|
||||
complete -c adduser -l disabled-password --description 'Like --disabled-login, but logins are still possible (for example using SSH RSA keys) but not using password authentication'
|
||||
complete -c adduser -l force-badname --description 'By default, user and group names are checked against the configurable regular expression NAME_REGEX (or NAME_REGEX if --system is specified) specified in the configuration file'
|
||||
complete -c adduser -l gecos --description 'Set the gecos field for the new entry generated' -r
|
||||
complete -c adduser -l gid --description 'When creating a group, this option forces the new groupid to be the given number' -r
|
||||
complete -c adduser -l group --description 'When combined with --system, a group with the same name and ID as the system user is created'
|
||||
complete -c adduser -l help --description 'Display brief instructions'
|
||||
complete -c adduser -l home --description 'Use specified directory as the user\'s home directory' -x -a '(__fish_complete_directories)'
|
||||
complete -c adduser -l shell --description 'Use shell as the user\'s login shell, rather than the default specified by the configuration file' -x -a '(cat /etc/shells)'
|
||||
complete -c adduser -l ingroup --description 'Add the new user to GROUP instead of a usergroup or the default group defined by USERS_GID in the configuration file' -x -a '(cat /etc/group|cut -d : -f 1)'
|
||||
complete -c adduser -l no-create-home --description 'Do not create the home directory, even if it doesni\'t exist'
|
||||
complete -c adduser -l quiet --description 'Suppress informational messages, only show warnings and errors'
|
||||
complete -c adduser -l debug --description 'Be verbose, most useful if you want to nail down a problem with adduser'
|
||||
complete -c adduser -l system --description 'Create a system user or group'
|
||||
complete -c adduser -l uid --description 'Force the new userid to be the given number' -r
|
||||
complete -c adduser -l firstuid --description 'Override the first uid in the range that the uid is chosen from (overrides FIRST_UID specified in the configuration file)' -r
|
||||
complete -c adduser -l lastuid --description 'ID Override the last uid in the range that the uid is chosen from ( LAST_UID )' -r
|
||||
complete -c adduser -l add_extra_groups --description 'Add new user to extra groups defined in the configuration file'
|
||||
complete -c adduser -l version --description 'Display version and copyright information'
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
function __fish_apt_no_subcommand --description 'Test if aptitude has yet to be given the subcommand'
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i autoclean clean forget-new keep-all update upgrade changelog dist-upgrade download forbid-version hold install keep markauto purge reinstall remove show unhold unmarkauto search help
|
||||
if contains -- $i autoclean clean forget-new keep-all update safe-upgrade changelog full-upgrade download forbid-version hold install keep markauto purge reinstall remove show unhold unmarkauto search help
|
||||
return 1
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@ end
|
||||
|
||||
function __fish_apt_use_package --description 'Test if aptitude command should have packages as potential completion'
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i changelog dist-upgrade download forbid-version hold install keep-all markauto purge reinstall remove show unhold unmarkauto
|
||||
if contains -- $i changelog full-upgrade download forbid-version hold install keep-all markauto purge reinstall remove show unhold unmarkauto
|
||||
return 0
|
||||
end
|
||||
end
|
||||
@@ -26,9 +26,9 @@ complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'clean' --description
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'forget-new' --description 'Forget all internal information about what packages are \'new\''
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'keep-all' --description 'Cancel all scheduled actions on all packages'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'update' --description 'Update the list of available packages from the apt sources'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'upgrade' --description 'Upgrade installed packages to their most recent version'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'safe-upgrade' --description 'Upgrade installed packages to their most recent version'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'changelog' --description 'Download and displays the Debian changelog for the packages'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'dist-upgrade' --description 'Upgrade, removing or installing packages as necessary'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'full-upgrade' --description 'Upgrade, removing or installing packages as necessary'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'download' --description 'Download the packages to the current directory'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'forbid-version' --description 'Forbid the upgrade to a particular version'
|
||||
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'hold' --description 'Ignore the packages by future upgrade commands'
|
||||
|
||||
19
share/completions/badblocks.fish
Normal file
19
share/completions/badblocks.fish
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Command specific completions for the badblocks command.
|
||||
# These completions where generated from the commands
|
||||
# man page by the make_completions.py script, and
|
||||
# have been hand edited since.
|
||||
#
|
||||
|
||||
complete -c badblocks -s b --description 'Block-size Specify the size of blocks in bytes'
|
||||
complete -c badblocks -s c --description 'Number of blocks is the number of blocks which are tested at a time'
|
||||
complete -c badblocks -s f --description 'Normally, badblocks will refuse to do a read/write or a nondestructive test on a device which is mounted, since either can cause the system to potentially crash and/or damage the filesys‐ tem even if it is mounted read-only'
|
||||
complete -c badblocks -s i --description 'Input_file Read a list of already existing known bad blocks'
|
||||
complete -c badblocks -s o --description 'Output_file Write the list of bad blocks to the specified file'
|
||||
complete -c badblocks -s p --description 'Repeat scanning the disk until there are no new blocks discovered in specified number of consecutive scans of the disk'
|
||||
complete -c badblocks -s t --description 'Test_pattern Specify a test pattern to be read (and written) to disk blocks'
|
||||
complete -c badblocks -s n --description 'Use non-destructive read-write mode'
|
||||
complete -c badblocks -s s --description 'Show the progress of the scan by writing out the block numbers as they are checked'
|
||||
complete -c badblocks -s v --description 'Verbose mode'
|
||||
complete -c badblocks -s w --description 'Use write-mode test'
|
||||
complete -c badblocks -s X --description 'Internal flag only to be used by e2fsck(8) and mke2fs(8)'
|
||||
3
share/completions/djview.fish
Normal file
3
share/completions/djview.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
complete -c djview -x -a "(__fish_complete_suffix .djvu)"
|
||||
|
||||
3
share/completions/djview3.fish
Normal file
3
share/completions/djview3.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
complete -c djview3 -x -a "(__fish_complete_suffix .djvu)"
|
||||
|
||||
3
share/completions/djview4.fish
Normal file
3
share/completions/djview4.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
complete -c djview4 -x -a "(__fish_complete_suffix .djvu)"
|
||||
|
||||
6
share/completions/dlocate.fish
Normal file
6
share/completions/dlocate.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
complete -c dlocate -s S -x -d 'List records that match filenames'
|
||||
complete -c dlocate -s L -d 'List all files in the package' -xa '(__fish_print_packages)'
|
||||
complete -c dlocate -o ls -d 'ls -ldF all files in the package' -xa '(__fish_print_packages)'
|
||||
complete -c dlocate -o du -d 'du -sck all files in the package' -xa '(__fish_print_packages)'
|
||||
|
||||
6
share/completions/dpkg.fish
Normal file
6
share/completions/dpkg.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
complete -c dpkg -s i -l install -d 'Install .deb package' -xa '(__fish_complete_suffix .deb)'
|
||||
complete -c dpkg -s r -l remove -d 'Remove package' -xa '(__fish_print_packages)'
|
||||
complete -c dpkg -s P -l purge -d 'Purge package' -xa '(__fish_print_packages)'
|
||||
complete -c dpkg -l force-all -d 'Continue on all problems'
|
||||
|
||||
94
share/completions/effectv.fish
Normal file
94
share/completions/effectv.fish
Normal file
@@ -0,0 +1,94 @@
|
||||
# completions for effectv 0.3.9 or similiar
|
||||
|
||||
complete -c effectv -f -a "QuarkTV" -d "Dissolves moving objects"
|
||||
complete -c effectv -f -a "FireTV" -d "Clips incoming objects and burns it"
|
||||
complete -c effectv -f -a "BurningTV" -d "Burns incoming objects"
|
||||
complete -c effectv -f -a "RadioacTV" -d "Brightens moving objects and blurs it"
|
||||
complete -c effectv -f -a "StreakTV" -d "Makes 8 afterimages"
|
||||
complete -c effectv -f -a "BaltanTV" -d "Makes afterimages longer"
|
||||
complete -c effectv -f -a "1DTV" -d "Grabs a horizontal line from video every 1/30 sec"
|
||||
complete -c effectv -f -a "DotTV" -d "Converts the picture into a set of dots"
|
||||
complete -c effectv -f -a "MosaicTV" -d "Censors incoming objects"
|
||||
complete -c effectv -f -a "PuzzleTV" -d "Scrambles the picture"
|
||||
complete -c effectv -f -a "PredatorTV" -d "Makes incoming objects invisible visibly"
|
||||
complete -c effectv -f -a "SpiralTV" -d "Spiraling effect"
|
||||
complete -c effectv -f -a "SimuraTV" -d "Color distortion and image mirroring"
|
||||
complete -c effectv -f -a "EdgeTV" -d "Detects edge and display it like good old computer way"
|
||||
complete -c effectv -f -a "ShagadelicTV" -d "Go back to swinging '60s"
|
||||
complete -c effectv -f -a "NoiseTV" -d "Makes incoming objects noisy"
|
||||
complete -c effectv -f -a "AgingTV" -d "Film-aging effect"
|
||||
complete -c effectv -f -a "LifeTV" -d "Conway's life game with video input interaction"
|
||||
complete -c effectv -f -a "TransFormTV" -d "Performs positional translations on images"
|
||||
complete -c effectv -f -a "SparkTV" -d "Spark effect"
|
||||
complete -c effectv -f -a "warpTV" -d "Goo'ing effect"
|
||||
complete -c effectv -f -a "HolographicTV" -d "Holographic vision seen in Star Wars"
|
||||
complete -c effectv -f -a "cycleTV" -d "Color cycling effect"
|
||||
complete -c effectv -f -a "RippleTV" -d "Ripple mark effect"
|
||||
complete -c effectv -f -a "DiceTV" -d "A 'dicing' effect"
|
||||
complete -c effectv -f -a "VertigoTV" -d "Alpha blending with zoomed and rotated images"
|
||||
complete -c effectv -f -a "DeinterlaceTV" -d "Deinterlacing video images"
|
||||
complete -c effectv -f -a "nervousTV" -d "Realtime frame shuffling effect"
|
||||
complete -c effectv -f -a "RndmTV" -d "Gives you a noisy picture in color or B/W"
|
||||
complete -c effectv -f -a "RevTV" -d "Waveform monitor effect"
|
||||
complete -c effectv -f -a "RandomDotStereoTV" -d "Makes random dot stereo stream from video input"
|
||||
complete -c effectv -f -a "LensTV" -d "Old school demo lens effect"
|
||||
complete -c effectv -f -a "DiffTV" -d "Hilights interframe differences"
|
||||
complete -c effectv -f -a "BrokenTV" -d "Simulates broken TV"
|
||||
complete -c effectv -f -a "WarholTV" -d "Hommage to Andy Warhol"
|
||||
complete -c effectv -f -a "MatrixTV" -d "A Matrix like effect"
|
||||
complete -c effectv -f -a "PUPTV" -d "Comes from \"Partial UPdate\", certain part of image is updated at a frame"
|
||||
complete -c effectv -f -a "ChameleonTV" -d "Vanishing into the wall..."
|
||||
|
||||
complete -c effectv -o help -d "show usage information"
|
||||
complete -c effectv -o device -r -d "[FILE] use device FILE for video4linux (default is /dev/video0)"
|
||||
complete -c effectv -o channel -r -d "[CHANNEL] channel number of video source (default is 0)"
|
||||
|
||||
set __fish_effectv_norms "ntsc
|
||||
pal
|
||||
secam
|
||||
pal-nc
|
||||
pal-m
|
||||
pal-n
|
||||
ntsc-jp"
|
||||
complete -c effectv -o norm -x -a '(echo $__fish_effectv_norms)' -d "[NORM] set video norm (default is ntsc)"
|
||||
|
||||
set __fish_effectv_freqs "argentina
|
||||
australia
|
||||
australia-optus
|
||||
canada-cable
|
||||
china-bcast
|
||||
europe-east
|
||||
europe-west
|
||||
france
|
||||
ireland
|
||||
italy
|
||||
japan-bcast
|
||||
japan-cable
|
||||
newzealand
|
||||
southafrica
|
||||
us-bcast
|
||||
us-cable
|
||||
us-cable-hrc"
|
||||
complete -c effectv -o freqtab -x -a '(echo $__fish_effectv_freqs)' -d "[FREQUTAB] set frequency table"
|
||||
|
||||
complete -c effectv -o fullscreen -d "enable fullscreen mode"
|
||||
complete -c effectv -o hardware -d "use direct video memory (if possible)"
|
||||
complete -c effectv -o doublebuffer -d "enable double buffering mode (if possible)"
|
||||
complete -c effectv -o fps -d "show frames/sec"
|
||||
complete -c effectv -o size -x -a "WxH" -d "[WxH] set the size of capturing image to WxH pixels (default 320x240)"
|
||||
complete -c effectv -o geometry -x -a "WxH" -d "[WxH] set the size of screen to WxH pixels"
|
||||
complete -c effectv -o scale -x -d "[NUMBER] set the scaling. When the capturing size is set, the screen size is scaled by NUMBER"
|
||||
complete -c effectv -o autoplay -x -d "[FRAMES] change effects automatically every FRAMES"
|
||||
|
||||
set __fish_effectv_palettes "grey
|
||||
rgb24
|
||||
rgb555
|
||||
rgb565
|
||||
yuv410p
|
||||
yuv411p
|
||||
yuv420p
|
||||
yuv422
|
||||
yuv422p"
|
||||
complete -c effectv -o palette -x -a '(echo $__fish_effectv_palettes)' -d "[PALETTE] set the PALETTE of capturing device"
|
||||
|
||||
complete -c effectv -o vloopback -r -d "[FILE] use device FILE for output of vloopback device"
|
||||
@@ -37,6 +37,7 @@ complete -c find -o cnewer --description "File status last changed more recently
|
||||
complete -c find -o ctime --description "File status last changed specified number of days ago" -r
|
||||
|
||||
complete -c find -o empty --description "File is empty and is either a regular file or a directory"
|
||||
complete -c find -o executable --description "File is executable"
|
||||
complete -c find -o false --description "Always false"
|
||||
complete -c find -o fstype --description "File is on filesystem of specified type" -a "(__fish_print_filesystems)" -r
|
||||
complete -c find -o gid --description "Numeric group id of file" -r
|
||||
|
||||
1
share/completions/funced.fish
Normal file
1
share/completions/funced.fish
Normal file
@@ -0,0 +1 @@
|
||||
complete -c funced -xa "(functions -na)" --description "Save function"
|
||||
1
share/completions/funcsave.fish
Normal file
1
share/completions/funcsave.fish
Normal file
@@ -0,0 +1 @@
|
||||
complete -c funcsave -xa "(functions -na)" --description "Save function"
|
||||
@@ -5,7 +5,7 @@ complete -c function -s j -l on-job-exit --description "Make the function a job
|
||||
complete -c function -s p -l on-process-exit --description "Make the function a process exit event handler" -x
|
||||
complete -c function -s s -l on-signal --description "Make the function a signal event handler" -x
|
||||
complete -c function -s v -l on-variable --description "Make the function a variable update event handler" -x
|
||||
complete -c function -s v -l on-event --description "Make the function a generic event handler" -x
|
||||
complete -c function -s e -l on-event --description "Make the function a generic event handler" -x
|
||||
complete -c function -s b -l key-binding --description "Allow dash (-) in function name"
|
||||
complete -c function -s a -l argument-names --description "Specify named arguments"
|
||||
complete -c function -s S -l no-scope-shadowing --description "Do not shadow variable scope of calling function"
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#####
|
||||
# Global options
|
||||
complete -c gem -n 'not __subcommand_given' -s h -l help -d "Print usage informations and quit"
|
||||
complete -c gem -n 'not __subcommand_given' -s v -l version -d "Print the version and quit"
|
||||
complete -c gem -n 'not __fish_use_subcommand' -s h -l help -d "Print usage informations and quit"
|
||||
complete -c gem -n 'not __fish_use_subcommand' -s v -l version -d "Print the version and quit"
|
||||
|
||||
#####
|
||||
# Subcommands
|
||||
@@ -31,7 +31,7 @@ complete -c gem -n '__fish_use_subcommand' -xa 'update\t"'(_ "Update the named g
|
||||
# Subcommand switches
|
||||
|
||||
# common opts
|
||||
set -l common_opt -c gem -n 'not __fish_use_subcommand' #'__subcommand_given'
|
||||
set -l common_opt -c gem -n 'not __fish_use_subcommand'
|
||||
complete $common_opt -l source --description "Use URL as the remote source for gems" -x
|
||||
complete $common_opt -s p -l http-proxy --description "Use the given HTTP proxy for remote operations" -x
|
||||
complete $common_opt -l no-http-proxy --description "Use no HTTP proxy for remote operations"
|
||||
|
||||
246
share/completions/git.fish
Normal file
246
share/completions/git.fish
Normal file
@@ -0,0 +1,246 @@
|
||||
# fish completion for git
|
||||
|
||||
function __fish_git_branches
|
||||
git branch --no-color -a 2>/dev/null | sed 's/^..//'
|
||||
end
|
||||
|
||||
function __fish_git_tags
|
||||
git tag
|
||||
end
|
||||
|
||||
function __fish_git_heads
|
||||
__fish_git_branches
|
||||
__fish_git_tags
|
||||
end
|
||||
|
||||
function __fish_git_remotes
|
||||
git remote
|
||||
end
|
||||
|
||||
function __fish_git_ranges
|
||||
set from (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[0]')
|
||||
set to (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[1]')
|
||||
if [ "$from" = "" ]
|
||||
__fish_git_branches
|
||||
return 0
|
||||
end
|
||||
|
||||
for from_ref in (__fish_git_heads | grep -e "$from")
|
||||
for to_ref in (__fish_git_heads | grep -e "$to")
|
||||
printf "%s..%s\n" $from_ref $to_ref
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_git_needs_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -eq 1 -a $cmd[1] = 'git' ]
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_git_using_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -gt 1 ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
# general options
|
||||
complete -f -c git -n 'not __fish_git_needs_command' -l help -d 'Display the manual of a git command'
|
||||
|
||||
#### fetch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a fetch -d 'Download objects and refs from another repository'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -a '(__fish_git_remotes)' -d 'Remote'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s q -l quiet -d 'Be quiet'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s v -l verbose -d 'Be verbose'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append ref names and object names'
|
||||
# TODO --upload-pack
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s f -l force -d 'Force update of local branches'
|
||||
# TODO other options
|
||||
|
||||
### remote
|
||||
complete -f -c git -n '__fish_git_needs_command' -a remote -d 'Manage set of tracked repositories'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a '(__fish_git_remotes)'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -s v -l verbose -d 'Be verbose'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a add -d 'Adds a new remote'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a rm -d 'Removes a remote'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a show -d 'Shows a remote'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a prune -d 'Deletes all stale tracking branches'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a update -d 'Fetches updates'
|
||||
# TODO options
|
||||
|
||||
### show
|
||||
complete -f -c git -n '__fish_git_needs_command' -a show -d 'Shows the last commit of a branch'
|
||||
complete -f -c git -n '__fish_git_using_command show' -a '(__fish_git_branches)' -d 'Branch'
|
||||
# TODO options
|
||||
|
||||
### show-branch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a show-branch -d 'Shows the commits on branches'
|
||||
complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_heads)' --description 'Branch'
|
||||
# TODO options
|
||||
|
||||
### add
|
||||
complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to the index'
|
||||
# TODO options
|
||||
|
||||
### checkout
|
||||
complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch'
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
|
||||
# TODO options
|
||||
|
||||
### apply
|
||||
complete -f -c git -n '__fish_git_needs_command' -a apply -d 'Apply a patch on a git index file and a working tree'
|
||||
# TODO options
|
||||
|
||||
### archive
|
||||
complete -f -c git -n '__fish_git_needs_command' -a archive -d 'Create an archive of files from a named tree'
|
||||
# TODO options
|
||||
|
||||
### bisect
|
||||
complete -f -c git -n '__fish_git_needs_command' -a bisect -d 'Find the change that introduced a bug by binary search'
|
||||
# TODO options
|
||||
|
||||
### branch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a branch -d 'List, create, or delete branches'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -a '(__fish_git_branches)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s d -d 'Delete Branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s D -d 'Force deletion of branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s m -d 'Rename branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s M -d 'Force renaming branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s a -d 'Lists both local and remote branches'
|
||||
|
||||
### cherry-pick
|
||||
complete -f -c git -n '__fish_git_needs_command' -a cherry-pick -d 'Apply the change introduced by an existing commit'
|
||||
complete -f -c git -n '__fish_git_using_command cherry-pick' -a '(__fish_git_branches)' -d 'Branch'
|
||||
# TODO options
|
||||
|
||||
### clone
|
||||
complete -f -c git -n '__fish_git_needs_command' -a clone -d 'Clone a repository into a new directory'
|
||||
# TODO options
|
||||
|
||||
### commit
|
||||
complete -c git -n '__fish_git_needs_command' -a commit -d 'Record changes to the repository'
|
||||
complete -c git -n '__fish_git_using_command commit' -l amend -d 'Amend the log message of the last commit'
|
||||
# TODO options
|
||||
|
||||
### diff
|
||||
complete -c git -n '__fish_git_needs_command' -a diff -d 'Show changes between commits, commit and working tree, etc'
|
||||
complete -c git -n '__fish_git_using_command diff' -a '(__fish_git_ranges)' -d 'Branch'
|
||||
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
|
||||
# TODO options
|
||||
|
||||
### grep
|
||||
complete -c git -n '__fish_git_needs_command' -a grep -d 'Print lines matching a pattern'
|
||||
# TODO options
|
||||
|
||||
### init
|
||||
complete -f -c git -n '__fish_git_needs_command' -a init -d 'Create an empty git repository or reinitialize an existing one'
|
||||
# TODO options
|
||||
|
||||
### log
|
||||
complete -c git -n '__fish_git_needs_command' -a log -d 'Show commit logs'
|
||||
complete -c git -n '__fish_git_using_command log' -a '(__fish_git_heads) (__fish_git_ranges)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command log' -l pretty -a 'oneline short medium full fuller email raw format:'
|
||||
# TODO options
|
||||
|
||||
### merge
|
||||
complete -f -c git -n '__fish_git_needs_command' -a merge -d 'Join two or more development histories together'
|
||||
complete -f -c git -n '__fish_git_using_command merge' -a '(__fish_git_branches)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l commit -d "Autocommit the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-commit -d "Don't autocommit the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l stat -d "Show diffstat of the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -s n -l no-stat -d "Don't show diffstat of the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l squash -d "Squash changes from other branch as a single commit"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-squash -d "Don't squash changes"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l ff -d "Don't generate a merge commit if merge is fast forward"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-ff -d "Generate a merge commit even if merge is fast forward"
|
||||
|
||||
# TODO options
|
||||
|
||||
### mv
|
||||
complete -c git -n '__fish_git_needs_command' -a mv -d 'Move or rename a file, a directory, or a symlink'
|
||||
# TODO options
|
||||
|
||||
### prune
|
||||
complete -f -c git -n '__fish_git_needs_command' -a prune -d 'Prune all unreachable objects from the object database'
|
||||
# TODO options
|
||||
|
||||
### pull
|
||||
complete -f -c git -n '__fish_git_needs_command' -a pull -d 'Fetch from and merge with another repository or a local branch'
|
||||
# TODO options
|
||||
|
||||
### push
|
||||
complete -f -c git -n '__fish_git_needs_command' -a push -d 'Update remote refs along with associated objects'
|
||||
# TODO options
|
||||
|
||||
### rebase
|
||||
complete -f -c git -n '__fish_git_needs_command' -a rebase -d 'Forward-port local commits to the updated upstream head'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_branches)' -d 'Branch'
|
||||
# TODO options
|
||||
|
||||
### reset
|
||||
complete -c git -n '__fish_git_needs_command' -a reset -d 'Reset current HEAD to the specified state'
|
||||
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset files in working directory'
|
||||
complete -c git -n '__fish_git_using_command reset' -a '(__fish_git_branches)'
|
||||
# TODO options
|
||||
|
||||
### revert
|
||||
complete -f -c git -n '__fish_git_needs_command' -a revert -d 'Revert an existing commit'
|
||||
# TODO options
|
||||
|
||||
### rm
|
||||
complete -c git -n '__fish_git_needs_command' -a rm -d 'Remove files from the working tree and from the index'
|
||||
complete -c git -n '__fish_git_using_command rm' -f
|
||||
complete -c git -n '__fish_git_using_command rm' -l cached -d 'Keep local copies'
|
||||
complete -c git -n '__fish_git_using_command rm' -l ignore-unmatch -d 'Exit with a zero status even if no files matched'
|
||||
complete -c git -n '__fish_git_using_command rm' -s r -d 'Allow recursive removal'
|
||||
complete -c git -n '__fish_git_using_command rm' -s q -l quiet -d 'Suppress the output'
|
||||
complete -c git -n '__fish_git_using_command rm' -s f -l force -d 'Override the up-to-date check'
|
||||
complete -c git -n '__fish_git_using_command rm' -s n -l dry-run -d 'Dry run'
|
||||
# TODO options
|
||||
|
||||
### status
|
||||
complete -f -c git -n '__fish_git_needs_command' -a status -d 'Show the working tree status'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s s -l short -d 'Give the output in the short-format'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s b -l branch -d 'Show the branch and tracking info even in short-format'
|
||||
complete -f -c git -n '__fish_git_using_command status' -l porcelain -d 'Give the output in a stable, easy-to-parse format'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s z -d 'Terminate entries with NUL character'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s u -l untracked-files -x -a 'no normal all' -d 'The untracked files handling mode'
|
||||
complete -f -c git -n '__fish_git_using_command status' -l ignore-submodules -x -a 'none untracked dirty all' -d 'Ignore changes to submodules'
|
||||
# TODO options
|
||||
|
||||
### tag
|
||||
complete -f -c git -n '__fish_git_needs_command' -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
|
||||
complete -f -c git -n '__fish_git_using_command tag; and __fish_not_contain_opt -s d; and __fish_not_contain_opt -s v; and test (count (commandline -opc | grep -v -e \'^-\')) -eq 3' -a '(__fish_git_branches)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s d -d 'Remove a tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s v -d 'Verify signature of a tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s f -d 'Force overwriting exising tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s s -d 'Make a GPG-signed tag'
|
||||
complete -f -c git -n '__fish_contains_opt -s d' -a '(__fish_git_tags)' -d 'Tag'
|
||||
complete -f -c git -n '__fish_contains_opt -s v' -a '(__fish_git_tags)' -d 'Tag'
|
||||
# TODO options
|
||||
|
||||
### config
|
||||
complete -f -c git -n '__fish_git_needs_command' -a config -d 'Set and read git configuration variables'
|
||||
# TODO options
|
||||
|
||||
### format-patch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a format-patch -d 'Generate patch series to send upstream'
|
||||
complete -f -c git -n '__fish_git_using_command format-patch' -a '(__fish_git_branches)' -d 'Branch'
|
||||
|
||||
## git submodule
|
||||
complete -f -c git -n '__fish_git_needs_command' -a submodule -d 'Initialize, update or inspect submodules'
|
||||
complete -f -c git -n '__fish_git_using_command submodule' -a 'add status init update summary foreach sync' -d 'Make a GPG-signed tag'
|
||||
|
||||
## git whatchanged
|
||||
complete -f -c git -n '__fish_git_needs_command' -a whatchanged -d 'Show logs with difference each commit introduces'
|
||||
|
||||
## Aliases (custom user-defined commands)
|
||||
complete -c git -n '__fish_git_needs_command' -a '(git config --get-regexp alias | sed -e "s/^alias\.\(\S\+\).*/\1/")' -d 'Alias (user-defined command)'
|
||||
12
share/completions/groupadd.fish
Normal file
12
share/completions/groupadd.fish
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Command specific completions for the groupadd command.
|
||||
# These completions where generated from the commands
|
||||
# man page by the make_completions.py script, but may
|
||||
# have been hand edited since.
|
||||
#
|
||||
|
||||
complete -c groupadd -s f --description 'Exit with success status if the specified group already exists'
|
||||
complete -c groupadd -s g --description 'The numerical value of the group\'s ID'
|
||||
complete -c groupadd -s h -l help --description 'Display help message and exit'
|
||||
complete -c groupadd -s K --description 'Overrides default key/value pairs from /etc/login'
|
||||
complete -c groupadd -s o --description 'This option permits to add group with non-unique GID'
|
||||
4
share/completions/gv.fish
Normal file
4
share/completions/gv.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
complete -c gv -x -a "(__fish_complete_suffix .ps)"
|
||||
complete -c gv -x -a "(__fish_complete_suffix .ps.gz)"
|
||||
complete -c gv -x -a "(__fish_complete_suffix .eps)"
|
||||
complete -c gv -x -a "(__fish_complete_suffix .pdf)"
|
||||
5
share/completions/htop.fish
Normal file
5
share/completions/htop.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
# Completions for top
|
||||
complete -c htop -s d --description "Update interval" -x
|
||||
complete -c htop -s u --description "Monitor effective UID" -x -a "(__fish_complete_users)"
|
||||
complete -c htop -l sort-key -d 'Sort column' -xa "(htop --sort-key '')"
|
||||
|
||||
2
share/completions/ifdown.fish
Normal file
2
share/completions/ifdown.fish
Normal file
@@ -0,0 +1,2 @@
|
||||
complete -x -c ifdown -a "(__fish_print_interfaces)" --description "Network interface"
|
||||
complete -c ifdown -l force --description "force"
|
||||
2
share/completions/ifup.fish
Normal file
2
share/completions/ifup.fish
Normal file
@@ -0,0 +1,2 @@
|
||||
complete -x -c ifup -a "(__fish_print_interfaces)" --description "Network interface"
|
||||
complete -c ifup -l force --description "force"
|
||||
18
share/completions/invoke-rc.d.fish
Normal file
18
share/completions/invoke-rc.d.fish
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
function __fish_invoke_rcd_has_service
|
||||
set tokens (commandline -opc)
|
||||
if [ (count $tokens) -eq 2 ]
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
complete -f -c invoke-rc.d -n 'not __fish_invoke_rcd_has_service' -a '(__fish_print_debian_services)'
|
||||
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'start' -d 'Start the service'
|
||||
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'stop' -d 'Stop the service'
|
||||
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'restart' -d 'Restart the service'
|
||||
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'reload' -d 'Reload Configuration'
|
||||
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'force-reload' -d 'Force reloading configuration'
|
||||
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'status' -d 'Print the status of the service'
|
||||
|
||||
@@ -1,30 +1,6 @@
|
||||
# Completions for the kill command
|
||||
__fish_make_completion_signals
|
||||
|
||||
set -l signals
|
||||
|
||||
if kill -L ^/dev/null >/dev/null
|
||||
|
||||
# Debian and some related systems use 'kill -L' to write out a numbered list
|
||||
# of signals. Use this to complete on both number _and_ on signal name.
|
||||
|
||||
complete -c kill -s L --description "List codes and names of available signals"
|
||||
|
||||
set signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ //' | sgrep -E '^[^ ]+')
|
||||
|
||||
else
|
||||
|
||||
# Posix systems print out the name of a signal using 'kill -l
|
||||
# SIGNUM', so we use this instead.
|
||||
|
||||
complete -c kill -s l --description "List names of available signals"
|
||||
|
||||
for i in (seq 31)
|
||||
set signals $signals $i" "(kill -l $i)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for i in $signals
|
||||
for i in $__kill_signals
|
||||
set number (echo $i | cut -d " " -f 1)
|
||||
set name (echo $i | cut -d " " -f 2)
|
||||
complete -c kill -o $number -d $name
|
||||
@@ -33,6 +9,5 @@ for i in $signals
|
||||
complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
|
||||
end
|
||||
|
||||
|
||||
complete -c kill -xa '(__fish_complete_pids)'
|
||||
|
||||
|
||||
20
share/completions/killall.fish
Normal file
20
share/completions/killall.fish
Normal file
@@ -0,0 +1,20 @@
|
||||
__fish_make_completion_signals
|
||||
|
||||
for i in $__kill_signals
|
||||
set number (echo $i | cut -d " " -f 1)
|
||||
set name (echo $i | cut -d " " -f 2)
|
||||
complete -c killall -o $number -d $name
|
||||
complete -c killall -o $name -d $name
|
||||
complete -c killall -o s -x -a \"$number\tSend\ $name\ signal\"
|
||||
complete -c killall -o s -x -a \"$name\tSend\ $name\ signal\"
|
||||
end
|
||||
|
||||
complete -c killall -xa '(__fish_complete_proc)'
|
||||
complete -c killall -s e -l exact -d 'Require an exact match for very long names'
|
||||
complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
|
||||
complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
|
||||
complete -c killall -s i -l interactive -d 'Interactively ask for confirmation before killing'
|
||||
complete -c killall -s u -l user -d 'Kill only processes the specified user owns. Command names are optional'
|
||||
complete -c killall -s w -l wait -d 'Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state'
|
||||
|
||||
|
||||
7
share/completions/latexmk.fish
Normal file
7
share/completions/latexmk.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
complete -c latexmk -x -a "(__fish_complete_suffix (commandline -ct) .tex '(La)TeX file')"
|
||||
complete -c latexmk -o dvi -d "Make dvi"
|
||||
complete -c latexmk -o ps -d "Make ps dvi->ps"
|
||||
complete -c latexmk -o pdf -d "Make pdf"
|
||||
complete -c latexmk -o pdfps -d "Make pdf dvi->ps->pdf"
|
||||
complete -c latexmk -o pdfdvi -d "Make pdf dvi->pdf"
|
||||
|
||||
18
share/completions/ln.fish
Normal file
18
share/completions/ln.fish
Normal file
@@ -0,0 +1,18 @@
|
||||
# completions for ln
|
||||
# Author: SanskritFritz (gmail)
|
||||
|
||||
complete -c ln -f -s s -l symbolic -d 'make symbolic links instead of hard links'
|
||||
complete -c ln -f -l backup=CONTROL -d 'make a backup of each existing destination file'
|
||||
complete -c ln -f -s b -d 'like --backup but does not accept an argument'
|
||||
complete -c ln -f -s d -l directory -d 'allow the superuser to attempt to hard link directories'
|
||||
complete -c ln -f -s f -l force -d 'remove existing destination files'
|
||||
complete -c ln -f -s i -l interactive -d 'prompt whether to remove destinations'
|
||||
complete -c ln -f -s L -l logical -d 'make hard links to symbolic link references'
|
||||
complete -c ln -f -s n -l no-dereference -d 'treat destination that is a symlink to a directory as if it were a normal file'
|
||||
complete -c ln -f -s P -l physical -d 'make hard links directly to symbolic links'
|
||||
complete -c ln -f -s S -l suffix=SUFFIX -d 'override the usual backup suffix'
|
||||
complete -c ln -f -s t -l target-directory=DIRECTORY -d 'specify the DIRECTORY in which to create the links'
|
||||
complete -c ln -f -s T -l no-target-directory -d 'treat LINK_NAME as a normal file'
|
||||
complete -c ln -f -s v -l verbose -d 'print name of each linked file'
|
||||
complete -c ln -f -l help -d 'display this help and exit'
|
||||
complete -c ln -f -l version -d 'output version information and exit'
|
||||
2
share/completions/lualatex.fish
Normal file
2
share/completions/lualatex.fish
Normal file
@@ -0,0 +1,2 @@
|
||||
__fish_complete_tex lualatex
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user