mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 04:51:15 -03:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab162c6c25 | ||
|
|
5ed912bebc | ||
|
|
ec43090c16 | ||
|
|
80759ee03f | ||
|
|
816f473ac9 | ||
|
|
d59d3b4463 | ||
|
|
8784b78d84 | ||
|
|
5005c67d76 | ||
|
|
63732a99e9 | ||
|
|
04b7da336d | ||
|
|
5f69f2bb0c | ||
|
|
fb62a35921 | ||
|
|
08787c7674 | ||
|
|
79de45eed5 | ||
|
|
9bc9e1c08d | ||
|
|
3acdeb87a4 | ||
|
|
9959e53985 | ||
|
|
4edb71325f | ||
|
|
310768e8d2 | ||
|
|
dc90e460fe | ||
|
|
d20c14b4bb | ||
|
|
981f5782d8 | ||
|
|
c2021b6225 | ||
|
|
9de4dbdd03 | ||
|
|
1a84a44cc2 | ||
|
|
80a9fc2fce | ||
|
|
8aac7e82c0 | ||
|
|
49e300d0ca | ||
|
|
136e99de62 | ||
|
|
c41986a63f | ||
|
|
bedf8ea55e | ||
|
|
d8f1c0abcd | ||
|
|
13a85ee3f1 | ||
|
|
fab18bae80 | ||
|
|
6e24b26e2c | ||
|
|
7fb44d4d5f | ||
|
|
44f85d04f9 | ||
|
|
bd71f0a096 |
23
INSTALL
23
INSTALL
@@ -32,17 +32,22 @@ separate build directories or any other fancy configure options.
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
If you have downloaded the darcs repository of fish, you need to run
|
||||
the autoconf command first. Then use the following commands to compile
|
||||
fish:
|
||||
Always begin by uninstalling any previous fish versions. This is done
|
||||
by running the command 'make uninstall' in the source directory of
|
||||
your previous fish installation.
|
||||
|
||||
% ./configure
|
||||
% make # Compile fish
|
||||
% make install # Install fish
|
||||
% echo /usr/local/bin/fish >>/etc/shells # Add fish to list of shells
|
||||
Next, if you have downloaded a fresh copy of the darcs repository of
|
||||
fish, you need to run the 'autoconf' command.
|
||||
|
||||
If you wish to use fish as your default shell, use the following
|
||||
command:
|
||||
Then, use following commands to compile fish:
|
||||
|
||||
./configure
|
||||
make # Compile fish
|
||||
make install # Install fish
|
||||
echo /usr/local/bin/fish >>/etc/shells # Add fish to list of shells
|
||||
|
||||
Finally, if you wish to use fish as your default shell, use the
|
||||
following command:
|
||||
|
||||
% chsh -s /usr/local/bin/fish
|
||||
|
||||
|
||||
19
Makefile.in
19
Makefile.in
@@ -1,4 +1,4 @@
|
||||
#
|
||||
|
||||
# Copyright (C) 2005-2006 Axel Liljencrantz
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -312,7 +312,7 @@ debug:
|
||||
# User documentation, describing the features of the fish shell.
|
||||
#
|
||||
|
||||
user_doc: $(HDR_FILES) Doxyfile.user user_doc.head.html $(CMD_DOC_SRC) $(BUILTIN_DOC_SRC)
|
||||
user_doc: doc_src/index.hdr doc_src/design.hdr doc_src/license.hdr doc_src/faq.hdr Doxyfile.user user_doc.head.html $(CMD_DOC_SRC) $(BUILTIN_DOC_SRC)
|
||||
$(MAKE) doc.h # Depend on the sources (*.hdr) and manually make the intermediate as needed
|
||||
doxygen Doxyfile.user
|
||||
touch user_doc
|
||||
@@ -365,8 +365,8 @@ xsel-0.9.6/xsel: xsel-0.9.6
|
||||
|
||||
doc_src/commands.hdr:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC)
|
||||
rm -f commands.tmp;
|
||||
echo "/** \page commands Commands" >>commands.tmp;
|
||||
echo "Fish ships with a large number of builtin commands, shellscript functions and external commandss. These are all described below. " >>commands.tmp;
|
||||
echo "/** \page commands Commands, functions and builtins bundled with fish" >>commands.tmp;
|
||||
echo "Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below. " >>commands.tmp;
|
||||
for i in `printf "%s\n" $(BUILTIN_DOC_SRC) $(CMD_DOC_SRC)|sort`; do \
|
||||
echo "<hr>" >>commands.tmp; \
|
||||
cat $$i >>commands.tmp; \
|
||||
@@ -393,8 +393,7 @@ doc.h:$(HDR_FILES)
|
||||
for i in $(HDR_FILES); do\
|
||||
sed <$$i >>doc.tmp -n \
|
||||
-e 's,.*\\page *\([^ ]*\) *\(.*\)$$,- <a href="'`basename $$i .hdr`'.html" name="toc-'`basename $$i .hdr`'">\2</a>,p' \
|
||||
-e 's,.*\\section *\([^ ]*\) *\(.*\)$$, - <a href="'`basename $$i .hdr`'.html#\1" name="toc-'`basename $$i .hdr`'">\2</a>,p' \
|
||||
# -e 's,.*\\subsection *\([^ ]*\) *\(.*\)$$, - <a href="'`basename $$i .hdr`'.html#\1" name="toc-'`basename $$i .hdr`'">\2</a>,p'; \
|
||||
-e 's,.*\\section *\([^ ]*\) *\(.*\)$$, - <a href="'`basename $$i .hdr`'.html#\1" name="toc-'`basename $$i .hdr`'">\2</a>,p'; \
|
||||
done
|
||||
cat $(HDR_FILES) >>doc.tmp;
|
||||
mv doc.tmp doc.h
|
||||
@@ -413,7 +412,13 @@ doc.h:$(HDR_FILES)
|
||||
echo "*/" >>$@
|
||||
|
||||
%: %.in Makefile
|
||||
sed <$@.in >$@ -e "s,@sysconfdir\@,$(sysconfdir),g" -e "s,@datadir\@,$(datadir),g" -e "s,@docdir\@,$(docdir),g" -e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" -e "s,@prefix\@,$(prefix),g" -e "s,@optbindirs\@,$(optbindirs),g"
|
||||
sed <$@.in >$@ \
|
||||
-e "s,@sysconfdir\@,$(sysconfdir),g" \
|
||||
-e "s,@datadir\@,$(datadir),g" \
|
||||
-e "s,@docdir\@,$(docdir),g" \
|
||||
-e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" \
|
||||
-e "s,@prefix\@,$(prefix),g" \
|
||||
-e "s,@optbindirs\@,$(optbindirs),g"
|
||||
#-e "s,@\@,$(),"
|
||||
|
||||
|
||||
|
||||
1
common.c
1
common.c
@@ -749,7 +749,6 @@ wchar_t *escape( const wchar_t *in,
|
||||
case L'*':
|
||||
case L'|':
|
||||
case L';':
|
||||
case L':':
|
||||
case L'\'':
|
||||
case L'"':
|
||||
case L'%':
|
||||
|
||||
15
common.h
15
common.h
@@ -72,7 +72,7 @@ extern wchar_t *program_name;
|
||||
This macro is used to check that an input argument is not null. It
|
||||
is a bit lika a non-fatal form of assert. Instead of exit-ing on
|
||||
failiure, the current function is ended at once. The second
|
||||
parameter is the exit status of the current function on failiure.
|
||||
parameter is the return value of the current function on failiure.
|
||||
*/
|
||||
#define CHECK( arg, retval ) \
|
||||
if( !(arg) ) \
|
||||
@@ -88,7 +88,7 @@ extern wchar_t *program_name;
|
||||
}
|
||||
|
||||
/**
|
||||
Exit program at once, leaving an error message about running out of memory
|
||||
Exit program at once, leaving an error message about running out of memory.
|
||||
*/
|
||||
#define DIE_MEM() \
|
||||
{ \
|
||||
@@ -100,7 +100,8 @@ extern wchar_t *program_name;
|
||||
}
|
||||
|
||||
/**
|
||||
Cause fish to crash. This should only be usd for debugging.
|
||||
Cause fish to crash. This should only be used for debugging. If
|
||||
this function is ever called in shipped code, this is a bug.
|
||||
*/
|
||||
#define CRASH() \
|
||||
{ \
|
||||
@@ -109,7 +110,8 @@ extern wchar_t *program_name;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if signals are blocked
|
||||
Check if signals are blocked. If so, print an error message and
|
||||
return from the function performing this check.
|
||||
*/
|
||||
#define CHECK_BLOCK( retval ) \
|
||||
if( signal_is_blocked() ) \
|
||||
@@ -120,7 +122,7 @@ extern wchar_t *program_name;
|
||||
L"If you can reproduce it, please send a bug report to %s.", \
|
||||
__func__, \
|
||||
PACKAGE_BUGREPORT ); \
|
||||
return retval; \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +131,8 @@ extern wchar_t *program_name;
|
||||
#define _(wstr) wgettext(wstr)
|
||||
|
||||
/**
|
||||
Noop, used to tell xgettext that a string should be translated, even though it is not directly sent to wgettext.
|
||||
Noop, used to tell xgettext that a string should be translated,
|
||||
even though it is not directly sent to wgettext.
|
||||
*/
|
||||
#define N_(wstr) wstr
|
||||
|
||||
|
||||
32
complete.c
32
complete.c
@@ -1748,24 +1748,22 @@ static int complete_param( wchar_t *cmd_orig,
|
||||
|
||||
if( wcsncmp( str, (wchar_t *)whole_opt->buff, wcslen(str) )==0)
|
||||
{
|
||||
int has_arg=0;
|
||||
int req_arg=0;
|
||||
|
||||
/*
|
||||
If the option requires arguments, add
|
||||
option with an appended '=' . If the
|
||||
option does not accept arguments, add
|
||||
option. If option accepts but does not
|
||||
require arguments, add both.
|
||||
If the switch has an _optional_
|
||||
argument, it needs to be specified using
|
||||
'=', otherwise we complete without the
|
||||
'=' since quite a few programs don't
|
||||
support it.
|
||||
|
||||
*/
|
||||
|
||||
if( o->old_mode || !(o->result_mode & NO_COMMON ) )
|
||||
{
|
||||
al_push( comp_out,
|
||||
wcsdupcat2( &((wchar_t *)whole_opt->buff)[wcslen(str)],
|
||||
COMPLETE_SEP_STR,
|
||||
C_(o->desc),
|
||||
(void *)0) );
|
||||
}
|
||||
has_arg = !!wcslen( o->comp );
|
||||
req_arg = (o->result_mode & NO_COMMON );
|
||||
|
||||
if( !o->old_mode && ( wcslen(o->comp) || (o->result_mode & NO_COMMON ) ) )
|
||||
if( !o->old_mode && ( has_arg && !req_arg ) )
|
||||
{
|
||||
al_push( comp_out,
|
||||
wcsdupcat2( &((wchar_t *)whole_opt->buff)[wcslen(str)],
|
||||
@@ -1774,6 +1772,12 @@ static int complete_param( wchar_t *cmd_orig,
|
||||
C_(o->desc),
|
||||
(void *)0) );
|
||||
}
|
||||
|
||||
al_push( comp_out,
|
||||
wcsdupcat2( &((wchar_t *)whole_opt->buff)[wcslen(str)],
|
||||
COMPLETE_SEP_STR,
|
||||
C_(o->desc),
|
||||
(void *)0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +66,6 @@
|
||||
*/
|
||||
#define PROG_COMPLETE_SEP L'\t'
|
||||
|
||||
/**
|
||||
Terminator for completions sent to the fish_pager
|
||||
*/
|
||||
#define COMPLETE_TERMINATOR L'\006'
|
||||
|
||||
/**
|
||||
|
||||
Add a completion.
|
||||
|
||||
26
configure.ac
26
configure.ac
@@ -9,7 +9,7 @@
|
||||
# configure the build process.
|
||||
#
|
||||
|
||||
AC_INIT(fish,1.22.0,fish-users@lists.sf.net)
|
||||
AC_INIT(fish,1.22.1,fish-users@lists.sf.net)
|
||||
|
||||
|
||||
#
|
||||
@@ -147,6 +147,29 @@ AC_PROG_INSTALL
|
||||
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
|
||||
|
||||
|
||||
if test "$SEQ_FALLBACK"; then
|
||||
|
||||
#
|
||||
# We already have seq. Check if the seq version is installed by an
|
||||
# earlier fish version. If it is, we'll replace it.
|
||||
#
|
||||
|
||||
file=`which seq`
|
||||
if test -f "$file"; then
|
||||
|
||||
AC_MSG_CHECKING([if seq comes from a previous fish version])
|
||||
shebang=`grep "\(^#!/.*/fish\|^#!/usr/bin/env fish\)" $file`
|
||||
|
||||
if test "$shebang"; then
|
||||
AC_SUBST( SEQ_FALLBACK, seq )
|
||||
AC_MSG_RESULT(yes, replace it)
|
||||
else
|
||||
AC_MSG_RESULT(no, keep it)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Optionally drop xsel command
|
||||
#
|
||||
@@ -399,6 +422,7 @@ AC_SEARCH_LIBS( gettext, intl,,)
|
||||
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( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
|
||||
|
||||
|
||||
#
|
||||
|
||||
121
create_wajig_completions.py
Executable file
121
create_wajig_completions.py
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- python -*-
|
||||
|
||||
# Program to generate fish completion function for wajig.
|
||||
# It runs 'wajig command' and analyzes the output to build a
|
||||
# completion file which it writes to stdout.
|
||||
# To use the result, direct stdout to
|
||||
# ~/.fish.d/completions/wajig.fish.
|
||||
|
||||
# Author Reuben Thomas, from Don Rozenberg's bash_completion.py and
|
||||
# fish's apt-get.fish.
|
||||
|
||||
import os
|
||||
import re
|
||||
import pprint
|
||||
pp = pprint.PrettyPrinter()
|
||||
|
||||
def escape_quotes(s):
|
||||
return re.sub('\'', '\\\'', s)
|
||||
|
||||
# Run wajig command
|
||||
f = os.popen('wajig commands', 'r')
|
||||
|
||||
lines = f.readlines()
|
||||
|
||||
option_patt = r'^-([a-z]*)\|--([a-z]*) +([^ ].*)'
|
||||
option_patt_r = re.compile(option_patt)
|
||||
|
||||
command_patt = r'^([a-z-]*) +([^ ].*)'
|
||||
command_patt_r = re.compile(command_patt)
|
||||
|
||||
os_str = []
|
||||
os_str.append('')
|
||||
ol_str = []
|
||||
ol_str.append('')
|
||||
oh_str = []
|
||||
oh_str.append('')
|
||||
o_i = 0
|
||||
|
||||
c_str = []
|
||||
c_str.append('')
|
||||
ch_str = []
|
||||
ch_str.append('')
|
||||
c_i = 0
|
||||
|
||||
for l in lines:
|
||||
l = l.strip()
|
||||
if l == '' or l.find(':') > -1 or l.find('Run') == 0:
|
||||
continue
|
||||
if l.find('-') == 0:
|
||||
mo = option_patt_r.search(l)
|
||||
if mo == None:
|
||||
continue
|
||||
os_str[o_i] = mo.group(1)
|
||||
os_str.append('')
|
||||
ol_str[o_i] = mo.group(2)
|
||||
ol_str.append('')
|
||||
oh_str[o_i] = escape_quotes(mo.group(3))
|
||||
oh_str.append('')
|
||||
o_i += 1
|
||||
else:
|
||||
mo = command_patt_r.search(l)
|
||||
if mo == None:
|
||||
continue
|
||||
c_str[c_i] = mo.group(1)
|
||||
c_str.append('')
|
||||
ch_str[c_i] = escape_quotes(mo.group(2))
|
||||
ch_str.append('')
|
||||
c_i += 1
|
||||
|
||||
# For debugging, print the commands and options.
|
||||
#print
|
||||
#pp.pprint(c_str)
|
||||
|
||||
#print
|
||||
#pp.pprint(os_str)
|
||||
#print
|
||||
#pp.pprint(ol_str)
|
||||
|
||||
part1 = '''function __fish_wajig_no_subcommand -d (N_ 'Test if wajig has yet to be given the subcommand')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i'''
|
||||
|
||||
part2 = '''
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function __fish_wajig_use_package -d (N_ 'Test if wajig command should have packages as potential completion')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i contains bug build build-depend changelog dependents describe detail hold install installr installrs installs list list-files news package purge purge-depend readme recursive recommended reconfigure reinstall remove remove-depend repackage show showinstall showremove showupgrade size sizes source suggested unhold upgrade versions whatis
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
complete -c wajig -n '__fish_wajig_use_package' -a '(__fish_print_packages)' -d (N_ 'Package')'''
|
||||
|
||||
wajig = part1
|
||||
|
||||
#add the commands.
|
||||
for i in range(0, len(c_str) - 1):
|
||||
wajig = "%s %s" % (wajig, c_str[i])
|
||||
|
||||
#add part2
|
||||
wajig = "%s%s" % (wajig, part2)
|
||||
|
||||
#add the options.
|
||||
wajig = "%s%s" % (wajig, os_str[0].lstrip())
|
||||
for i in range(1, len(os_str) - 1):
|
||||
wajig = "%s\ncomplete -c apt-get -s %s -l %s -d (N_ '%s')" % (wajig, os_str[i], ol_str[i], oh_str[i])
|
||||
|
||||
#add the commands.
|
||||
for i in range(0, len(c_str) - 1):
|
||||
wajig = "%s\ncomplete -f -n '__fish_wajig_no_subcommand' -c wajig -a '%s' -d(N_ '%s')" % (wajig, c_str[i], ch_str[i])
|
||||
|
||||
#print it all
|
||||
print wajig
|
||||
@@ -10,6 +10,10 @@ status (as set by the last previous command) is 0.
|
||||
|
||||
The and command does not change the current exit status.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
variable.
|
||||
|
||||
\subsection and-example Example
|
||||
|
||||
The following code runs the \c make command to build a program, if the
|
||||
|
||||
@@ -39,7 +39,7 @@ or updated
|
||||
- \c -b or \c --current-buffer select the entire buffer (default)
|
||||
- \c -j or \c --current-job select the current job
|
||||
- \c -p or \c --current-process select the current process
|
||||
- \c -t or \c --current_token select the current token.
|
||||
- \c -t or \c --current-token select the current token.
|
||||
|
||||
The following switch changes the way \c commandline prints the current
|
||||
commandline buffer
|
||||
|
||||
@@ -5,7 +5,9 @@ fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]]
|
||||
|
||||
\subsection fish-description Description
|
||||
|
||||
A commandline shell written mainly with interactive use in mind. The full manual is available <a href='index.html'>in html</a> by using the <a href='#help'>help</a> command from inside fish.
|
||||
A commandline shell written mainly with interactive use in mind. The
|
||||
full manual is available <a href='index.html'>in html</a> by using the
|
||||
<a href='#help'>help</a> command from inside fish.
|
||||
|
||||
- <code>-c</code> or <code>--command=COMMANDS</code> evaluate the specified commands instead of reading from the commandline
|
||||
- <code>-d</code> or <code>--debug-level=DEBUG_LEVEL</code> specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
|
||||
@@ -16,3 +18,6 @@ A commandline shell written mainly with interactive use in mind. The full manual
|
||||
- <code>-p</code> or <code>--profile=PROFILE_FILE</code> when fish exits, output timing information on all executed commands to the specified file
|
||||
- <code>-v</code> or <code>--version</code> display version and exit
|
||||
|
||||
The fish exit status is generally the exit status of the last
|
||||
foreground command. If fish is exiting because of a parse error, the
|
||||
exit status is 127.
|
||||
|
||||
@@ -4,10 +4,20 @@
|
||||
<tt>if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end</tt>
|
||||
|
||||
\subsection if-description Description
|
||||
<tt>if</tt> will execute the command CONDITION. If the condition's exit
|
||||
status is 0, the commands COMMANDS_TRUE will execute. If it is not 0 and
|
||||
<tt>else</tt> is given, COMMANDS_FALSE will be executed. Hint: use
|
||||
<a href="#begin"><tt>begin; ...; end</tt></a> for complex conditions.
|
||||
|
||||
<tt>if</tt> will execute the command CONDITION. If the condition's
|
||||
exit status is 0, the commands COMMANDS_TRUE will execute. If the
|
||||
exit status is not 0 and <tt>else</tt> is given, COMMANDS_FALSE will
|
||||
be executed.
|
||||
|
||||
In order to use the exit status of mutiple commands as the condition
|
||||
of an if block, use <a href="#begin"><tt>begin; ...; end</tt></a> and
|
||||
the short circut commands <a href="commands.html#and">and</a> and <a
|
||||
href="commands.html#or">or</a>.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
variable.
|
||||
|
||||
\subsection if-example Example
|
||||
|
||||
|
||||
@@ -262,7 +262,26 @@ the example above, these are simply passed on to the ls command. For
|
||||
more information on functions, see the documentation for the <a
|
||||
href='commands.html#function'>function</a> builtin.
|
||||
|
||||
\subsubsection Autoloading functions
|
||||
\subsubsection syntax-function-wrappers Defining wrapper functions
|
||||
|
||||
One of the most common used for functions is to slightly alter the
|
||||
behaviour of an already existing command. For example, one might want
|
||||
to redefine the \c ls command to display colors. The switch for
|
||||
turning on colors on GNU systems is \c '--color=auto'. A wrapper
|
||||
around \c ls might look like this:
|
||||
|
||||
<pre>function ls
|
||||
ls --color=auto $argv
|
||||
end
|
||||
</pre>
|
||||
|
||||
There are a few important things that need to be noted about wrapper
|
||||
functions:
|
||||
|
||||
- Wrappers should always take care to add the $argv variable to the list of parameters to the wrapped command. This makes sure that if the user specifies any additional parameters to the function, they are passed on to the underlying command.
|
||||
- If the wrapped command is not the first command to be called by the wrapper, it is necessary to prefix the call to the command with the word 'command' in order to tell fish that the function should not call itself, but rather a command with the same name. Failing to do so will cause infinite recursion bugs.
|
||||
|
||||
\subsubsection syntax-function-autoloading Autoloading functions
|
||||
|
||||
Functions can be defined on the commandline or in a configuration
|
||||
file, but they can also be automatically loaded. This method of
|
||||
@@ -293,6 +312,25 @@ definition for the specified function and nothing else, otherwise it
|
||||
is possible that autoloading a function files requires that the
|
||||
function already be loaded, i.e. a circular dependency.
|
||||
|
||||
\subsection syntax-conditional Conditional execution of code
|
||||
|
||||
There are four fish builtins that let you execute commands only if a
|
||||
specific criterion is met. These builtins are
|
||||
<a href="commands.html#if">if</a>,
|
||||
<a href="commands.html#switch">switch</a>,
|
||||
<a href="commands.html#and">and</a> and
|
||||
<a href="commands.html#or">or</a>.
|
||||
|
||||
The \c switch command is used to execute one of possibly many blocks
|
||||
of commands depending on the value of a string. See the documentation
|
||||
for <a href="commands.html#switch">switch</a> for more information.
|
||||
|
||||
The other conditionals use the <a href='#variables-status'>exit
|
||||
status</a> of a command to decide if a command or a block of commands
|
||||
should be executed. See the documentation for
|
||||
<a href="commands.html#if">if</a>, <a href="commands.html#and">and</a>
|
||||
and <a href="commands.html#or">or</a> for more information.
|
||||
|
||||
\subsection syntax-words Some common words
|
||||
|
||||
This is a short explanation of some of the commonly used words in fish.
|
||||
@@ -300,7 +338,7 @@ This is a short explanation of some of the commonly used words in fish.
|
||||
- argument, a parameter given to a command
|
||||
- builtin, a command that is implemented in the shell. Builtins are commands that are so closely tied to the shell that it is impossible to implement them as external commands.
|
||||
- command, a program that the shell can run.
|
||||
- function, a block of commands and arguments that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
||||
- function, a block of commands that can be called as if they where a single command. By using functions, it is possible to string together multiple smaller commands into one more advanced command.
|
||||
- job, a running pipeline or command
|
||||
- pipeline, a set of commands stringed together so that the output of one command is the input of the next command
|
||||
- redirection, a operation that changes one of the input/output streams associated with a job
|
||||
@@ -326,13 +364,13 @@ shell. By tapping the tab key, the user asks \c fish to guess the rest
|
||||
of the command or parameter that the user is currently typing. If \c
|
||||
fish can only find one possible completion, \c fish will write it
|
||||
out. If there is more than one completion, \c fish will write out the
|
||||
longest common prefix that all completions have in common. If all
|
||||
completions differ on the first character, a list of all possible
|
||||
completions is printed. The list features descriptions of the
|
||||
completions and if the list doesn't fit the screen, it is scrollable
|
||||
by using the arrow keys, the page up/page down keys or the space
|
||||
bar. Press any other key will exit the list and insert the pressed key
|
||||
into the command line.
|
||||
longest prefix that all completions have in common. If the completions
|
||||
differ on the first character, a list of all possible completions is
|
||||
printed. The list features descriptions of the completions and if the
|
||||
list doesn't fit the screen, it is scrollable by using the arrow keys,
|
||||
the page up/page down keys, the tab key or the space bar. Pressing any
|
||||
other key will exit the list and insert the pressed key into the
|
||||
command line.
|
||||
|
||||
These are the general purpose tab completions that \c fish provides:
|
||||
|
||||
@@ -351,14 +389,14 @@ manual pages as completions.
|
||||
- The 'make' program uses all targets in the Makefile in
|
||||
the current directory as completions.
|
||||
- The 'mount' command uses all mount points specified in fstab as completions.
|
||||
- The 'ssh' command uses all hosts in that are stored
|
||||
- The 'ssh' command uses all hosts that are stored
|
||||
in the known_hosts file as completions. (see the ssh documentation for more information)
|
||||
- The 'su' command uses all users on the system as completions.
|
||||
- The \c apt-get, \c rpm and \c yum commands use all installed packages as completions.
|
||||
|
||||
\subsection completion-own Writing your own completions
|
||||
|
||||
Specifying your own completions is not complicated. To specify a
|
||||
Specifying your own completions is not difficult. To specify a
|
||||
completion, use the \c complete command. \c complete takes
|
||||
as a parameter the name of the command to specify a completion
|
||||
for. For example, to add a completion for the program \c myprog, one
|
||||
@@ -430,10 +468,14 @@ If a star (*) or a question mark (?) is present in the parameter, \c
|
||||
fish attempts to match the given parameter to any files in such a
|
||||
way that:
|
||||
|
||||
- '?' can match any character except '/'.
|
||||
- '?' can match any single character except '/'.
|
||||
- '*' can match any string of characters not containing '/'. This includes matching an empty string.
|
||||
- '**' matches any string of characters. This includes matching an empty string. The string may include the '/' character but does not need to.
|
||||
|
||||
File names beginning with a dot are not considered when wildcarding
|
||||
unless a dot is specifically given as the first character of the file
|
||||
name.
|
||||
|
||||
Examples:
|
||||
|
||||
<code>a*</code> matches any files beginning with an 'a' in the current directory.
|
||||
@@ -812,11 +854,11 @@ the string __FISH or __fish. These should be ignored by the user.
|
||||
\subsection variables-status The status variable
|
||||
|
||||
Whenever a process exits, an exit status is returned to the program
|
||||
that started it. This exit status is an integer number, which tells
|
||||
the calling application how the execution of the command went. In
|
||||
general, a zero exit status means that the command executed without
|
||||
problem, but a non-zero exit status means there was some form of
|
||||
problem.
|
||||
that started it (usually the shell). This exit status is an integer
|
||||
number, which tells the calling application how the execution of the
|
||||
command went. In general, a zero exit status means that the command
|
||||
executed without problem, but a non-zero exit status means there was
|
||||
some form of problem.
|
||||
|
||||
Fish stores the exit status of the last process in the last job to
|
||||
exit in the \c status variable.
|
||||
@@ -827,7 +869,7 @@ variable may also be set to a specific value:
|
||||
- 1 is the generally the exit status from fish builtins if they where supplied with invalid arguments
|
||||
- 125 means an unknown error occured while trying to execute the command
|
||||
- 126 means that the command was not executed because none of the wildcards in the command produced any matches
|
||||
- 127 means that no command with the given name could be located
|
||||
- 127 means that no function, builtin or command with the given name could be located
|
||||
|
||||
\subsection variables-color Variables for changing highlighting colors
|
||||
|
||||
@@ -893,61 +935,10 @@ code duplication, and to avoid the confusion of subtly differing
|
||||
versions of the same command, \c fish only implements builtins for
|
||||
actions which cannot be performed by a regular command.
|
||||
|
||||
\section bundle Commands bundled with fish
|
||||
|
||||
The following commands are distributed with fish. Many of them are
|
||||
builtins or shellscript functions, and can only be used inside fish.
|
||||
|
||||
- <a href="commands.html#source">.</a>, read and execute the commands in a file
|
||||
- <a href="commands.html#and">and</a>, execute command if previous command suceeded
|
||||
- <a href="commands.html#bg">bg</a>, set a command to the background
|
||||
- <a href="commands.html#begin">begin</a>, execute a block of commands
|
||||
- <a href="commands.html#bind">bind</a>, change keyboard bindings
|
||||
- <a href="commands.html#break">break</a>, stop the execution of a loop
|
||||
- <a href="commands.html#block">block</a>, Temporarily block delivery of events
|
||||
- <a href="commands.html#builtin">builtin</a>, execute a builtin command
|
||||
- <a href="commands.html#case">case</a>, conditionally execute a block of commands
|
||||
- <a href="commands.html#cd">cd</a>, change the current directory
|
||||
- <a href="commands.html#command">command</a>, execute an external program
|
||||
- <a href="commands.html#commandline">commandline</a>, set or get the contents of the commandline buffer
|
||||
- <a href="commands.html#complete">complete</a>, add and remove completions
|
||||
- <a href="commands.html#continue">continue</a>, skip the rest of the current lap of a loop
|
||||
- <a href="commands.html#count">count</a>, count the number of arguments
|
||||
- <a href="commands.html#dirh">dirh</a>, view the directory history
|
||||
- <a href="commands.html#dirs">dirs</a>, view the directory stack
|
||||
- <a href="commands.html#end">end</a>, end a block of commands
|
||||
- <a href="commands.html#else">else</a>, conditionally execute a block of commands
|
||||
- <a href="commands.html#eval">eval</a>, evaluate a string as a command
|
||||
- <a href="commands.html#exec">exec</a>, replace the current process image with a new command
|
||||
- <a href="commands.html#exit">exit</a>, causes \c fish to quit
|
||||
- <a href="commands.html#fg">fg</a>, set a command to the foreground
|
||||
- <a href="commands.html#fishd">fishd</a>, the universal variable daemon
|
||||
- <a href="commands.html#for">for</a>, perform a block of commands once for every element in a list
|
||||
- <a href="commands.html#function">function</a>, define a new function
|
||||
- <a href="commands.html#functions">functions</a>, print or erase functions
|
||||
- <a href="commands.html#help">help</a>, show the fish documentation
|
||||
- <a href="commands.html#if">if</a>, conditionally execute a block of commands
|
||||
- <a href="commands.html#jobs">jobs</a>, print the currently running jobs
|
||||
- <a href="commands.html#mimedb">mimedb</a>, view mimedata about a file
|
||||
- <a href="commands.html#nextd">nextd</a>, move forward in the directory history
|
||||
- <a href="commands.html#not">not</a>, negates the exit status of any command
|
||||
- <a href="commands.html#or">or</a>, execute a command if previous command failed
|
||||
- <a href="commands.html#popd">popd</a>, move to the topmost directory on the directory stack
|
||||
- <a href="commands.html#prevd">prevd</a>, move backwards in the direcotry stack
|
||||
- <a href="commands.html#pushd">pushd</a>, push the surrent directory onto the directory stack
|
||||
- <a href="commands.html#random">random</a>, calculate a pseudo-random number
|
||||
- <a href="commands.html#return">return</a>, return from a function
|
||||
- <a href="commands.html#read">read</a>, read from a stream into an environment variable
|
||||
- <a href="commands.html#set">set</a>, set environment variables
|
||||
- <a href="commands.html#set_color">set_color</a>, change the terminal colors
|
||||
- <a href="commands.html#switch">switch</a>, conditionally execute a block of commands
|
||||
- <a href="commands.html#tokenize">tokenize</a>, split a string up into multiple tokens
|
||||
- <a href="commands.html#ulimit">ulimit</a>, set or get the shells resurce usage limits
|
||||
- <a href="commands.html#umask">umask</a>, set or get the file creation mask
|
||||
- <a href="commands.html#while">while</a>, perform a block of commands while a condition is met
|
||||
|
||||
For more information about these commands, use the <code>--help</code>
|
||||
option of the command to display a longer explanation.
|
||||
For a list of all builtins, functions and commands shipped with fish,
|
||||
see the <a href="#toc-commands">table of contents</a>. The
|
||||
documentation is also available by using the <code>--help</code>
|
||||
switch of the command.
|
||||
|
||||
\section editor Command Line editor
|
||||
|
||||
@@ -1308,7 +1299,7 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
|
||||
- Check keybinding commands for output - if nothing has happened, don't repaint to reduce flicker
|
||||
- wait shellscript
|
||||
- Support for the screen clipboard
|
||||
|
||||
- Files begining with '-' should not be colored red if a '--' argument has been given
|
||||
|
||||
\subsection todo-possible Possible features
|
||||
|
||||
@@ -1344,18 +1335,22 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
|
||||
- Try to remove more malloc calls to reduce memory usage. The time_t arrays used by the autoloader sound like a good candidate.
|
||||
- The code validator should warn about unknown commands.
|
||||
- The large number of interned strings means that autounloading frees less memory than it should. Completion strings should probably be either refcounted or not shared at all.
|
||||
- Auto-newlines
|
||||
- Completions for uncompressing archives, like unrar could look into the compressed file and allow you to select what files to extract
|
||||
|
||||
|
||||
\subsection bugs Known bugs
|
||||
\subsection bugs Known bugs and issues
|
||||
|
||||
- Completion for gcc -\#\#\# option doesn't work.
|
||||
- Suspending and then resuming pipelines containing a builtin is broken. How should this be handled?
|
||||
- screen handling code can't handle tabs in input.
|
||||
|
||||
- The completion pager doesn't work if stderr is redirected.
|
||||
- Can't complete directories as commands unless there is a slash
|
||||
- ls should use dircolors
|
||||
- Doxygen called when it shouldn't?
|
||||
- Delete-word is broken on the commandline 'sudo update-alternatives --config x-'
|
||||
|
||||
If you think you have found a bug not described here, please send a
|
||||
report to <a href="mailto:axel@liljencrantz.se"> axel@liljencrantz.se
|
||||
</a>.
|
||||
report to <a href="mailto:fish-users@lists.sf.net">fish-users@lists.sf.net</a>.
|
||||
|
||||
|
||||
\subsection issues Known issues
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** \page license Licenses
|
||||
|
||||
Fish Copyright (C) 2005 Axel Liljencrantz. Fish is released under the
|
||||
GNU General Public License, version 2. The license agreement is
|
||||
Fish Copyright (C) 2005-2006 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
|
||||
|
||||
@@ -10,6 +10,10 @@ status (as set by the last previous command) is not 0.
|
||||
|
||||
The or command does not change the current exit status.
|
||||
|
||||
The exit status of the last foreground command to exit can always be
|
||||
accessed using the <a href="index.html#variables-status">$status</a>
|
||||
variable.
|
||||
|
||||
\subsection or-example Example
|
||||
|
||||
The following code runs the \c make command to build a program, if the
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
\subsection prevd-synopsis Synopsis
|
||||
<tt>prevd [-l | --list] [pos]</tt>
|
||||
|
||||
\subsection prevd-description Description <tt>prevd</tt> moves
|
||||
backwards <tt>pos</tt> positions in the history of visited
|
||||
directories; if the beginning of the history has been hit, a warning
|
||||
is printed. If the <code>-l</code> or <code>--list</code> flag is
|
||||
specified, the current history is also displayed.
|
||||
\subsection prevd-description Description
|
||||
|
||||
<tt>prevd</tt> moves backwards <tt>pos</tt> positions in the history
|
||||
of visited directories; if the beginning of the history has been hit,
|
||||
a warning is printed. If the <code>-l</code> or <code>--list</code>
|
||||
flag is specified, the current history is also displayed.
|
||||
|
||||
5
event.c
5
event.c
@@ -444,7 +444,8 @@ static void event_fire_internal( event_t *event )
|
||||
for( i=0; i<al_get_count( fire ); i++ )
|
||||
{
|
||||
event_t *criterion = (event_t *)al_get( fire, i );
|
||||
|
||||
int prev_status;
|
||||
|
||||
/*
|
||||
Check if this event has been removed, if so, dont fire it
|
||||
*/
|
||||
@@ -476,11 +477,13 @@ static void event_fire_internal( event_t *event )
|
||||
they are marked as non-interactive
|
||||
*/
|
||||
proc_push_interactive(0);
|
||||
prev_status = proc_get_last_status();
|
||||
parser_push_block( EVENT );
|
||||
current_block->param1.event = event;
|
||||
eval( (wchar_t *)b->buff, 0, TOP );
|
||||
parser_pop_block();
|
||||
proc_pop_interactive();
|
||||
proc_set_last_status( prev_status );
|
||||
}
|
||||
|
||||
if( b )
|
||||
|
||||
2
exec.c
2
exec.c
@@ -704,7 +704,7 @@ void exec( job_t *j )
|
||||
|
||||
if( input_redirect &&
|
||||
(input_redirect->io_mode == IO_BUFFER) &&
|
||||
input_redirect->param3.is_input )
|
||||
input_redirect->is_input )
|
||||
{
|
||||
/*
|
||||
Input redirection - create a new gobetween process to take
|
||||
|
||||
@@ -503,7 +503,8 @@ static void history_populate_from_mmap( history_mode_t *m )
|
||||
if( (i_orig=hash_get( ¤t_mode->session_item, i ) ) )
|
||||
{
|
||||
/*
|
||||
This item comes from this session. Insert the original item at the end of the item list.
|
||||
This item comes from this session. Insert the
|
||||
original item at the end of the item list.
|
||||
*/
|
||||
al_push( &session_item_list, i_orig );
|
||||
}
|
||||
@@ -608,7 +609,8 @@ static void history_save_mode( void *n, history_mode_t *m )
|
||||
wchar_t *tmp_name;
|
||||
|
||||
/*
|
||||
First check if there are any new entries to save. If not, thenm we can just return
|
||||
First check if there are any new entries to save. If not, then
|
||||
we can just return
|
||||
*/
|
||||
for( i=0; i<al_get_count(&m->item); i++ )
|
||||
{
|
||||
@@ -628,7 +630,8 @@ static void history_save_mode( void *n, history_mode_t *m )
|
||||
signal_block();
|
||||
|
||||
/*
|
||||
Set up on_disk variable to describe the current contents of the history file
|
||||
Set up on_disk variable to describe the current contents of the
|
||||
history file
|
||||
*/
|
||||
on_disk = history_create_mode( m->name );
|
||||
history_load( on_disk );
|
||||
|
||||
2
intern.c
2
intern.c
@@ -31,6 +31,8 @@ static hash_table_t *intern_static_table=0;
|
||||
const wchar_t *intern( const wchar_t *in )
|
||||
{
|
||||
const wchar_t *res=0;
|
||||
|
||||
// debug( 0, L"intern %ls", in );
|
||||
|
||||
if( !in )
|
||||
return 0;
|
||||
|
||||
16
io.c
16
io.c
@@ -53,9 +53,8 @@ Utilities for io redirection.
|
||||
|
||||
void io_buffer_read( io_data_t *d )
|
||||
{
|
||||
|
||||
exec_close(d->param1.pipe_fd[1] );
|
||||
|
||||
|
||||
if( d->io_mode == IO_BUFFER )
|
||||
{
|
||||
/* if( fcntl( d->param1.pipe_fd[0], F_SETFL, 0 ) )
|
||||
@@ -108,7 +107,7 @@ io_data_t *io_buffer_create( int is_input )
|
||||
buffer_redirect->io_mode=IO_BUFFER;
|
||||
buffer_redirect->next=0;
|
||||
buffer_redirect->param2.out_buffer= malloc( sizeof(buffer_t));
|
||||
buffer_redirect->param3.is_input = is_input;
|
||||
buffer_redirect->is_input = is_input;
|
||||
b_init( buffer_redirect->param2.out_buffer );
|
||||
buffer_redirect->fd=is_input?0:1;
|
||||
|
||||
@@ -135,7 +134,16 @@ io_data_t *io_buffer_create( int is_input )
|
||||
|
||||
void io_buffer_destroy( io_data_t *io_buffer )
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
If this is an input buffer, then io_read_buffer will not have
|
||||
been called, and we need to close the output fd as well.
|
||||
*/
|
||||
if( io_buffer->is_input )
|
||||
{
|
||||
exec_close(io_buffer->param1.pipe_fd[1] );
|
||||
}
|
||||
|
||||
exec_close( io_buffer->param1.pipe_fd[0] );
|
||||
|
||||
/*
|
||||
|
||||
11
io.h
11
io.h
@@ -45,16 +45,7 @@ typedef struct io_data
|
||||
} param2
|
||||
;
|
||||
|
||||
union
|
||||
{
|
||||
/**
|
||||
This will be non-zero if this is a buffer of input, not
|
||||
output
|
||||
*/
|
||||
int is_input;
|
||||
}
|
||||
param3;
|
||||
|
||||
int is_input;
|
||||
|
||||
/** Pointer to the next IO redirection */
|
||||
struct io_data *next;
|
||||
|
||||
24
main.c
24
main.c
@@ -73,17 +73,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
static int read_init()
|
||||
{
|
||||
char cwd[4096];
|
||||
wchar_t *wcwd;
|
||||
|
||||
wchar_t cwd[4096];
|
||||
wchar_t *config_dir;
|
||||
wchar_t *config_dir_escaped;
|
||||
void *context;
|
||||
string_buffer_t *eval_buff;
|
||||
|
||||
if( !getcwd( cwd, 4096 ) )
|
||||
if( !wgetcwd( cwd, 4096 ) )
|
||||
{
|
||||
wperror( L"getcwd" );
|
||||
wperror( L"wgetcwd" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -103,20 +101,17 @@ static int read_init()
|
||||
halloc_free( context );
|
||||
free( config_dir_escaped );
|
||||
|
||||
if( chdir( cwd ) == -1 )
|
||||
if( wchdir( cwd ) == -1 )
|
||||
{
|
||||
/*
|
||||
If we can't change back to previos directory, we go to
|
||||
~. Should be a sane default behavior.
|
||||
*/
|
||||
eval( L"builtin cd", 0, TOP );
|
||||
}
|
||||
|
||||
wcwd = str2wcs( cwd );
|
||||
if( wcwd )
|
||||
}
|
||||
else
|
||||
{
|
||||
env_set( L"PWD", wcwd, ENV_EXPORT );
|
||||
free( wcwd );
|
||||
env_set( L"PWD", cwd, ENV_EXPORT );
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -290,6 +285,7 @@ int main( int argc, char **argv )
|
||||
is_interactive_session=1;
|
||||
program_name=L"fish";
|
||||
|
||||
|
||||
my_optind = fish_parse_opt( argc, argv, &cmd );
|
||||
|
||||
/*
|
||||
@@ -382,7 +378,6 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, getpid(), res );
|
||||
|
||||
|
||||
history_destroy();
|
||||
proc_destroy();
|
||||
@@ -399,6 +394,5 @@ int main( int argc, char **argv )
|
||||
|
||||
intern_free_all();
|
||||
|
||||
|
||||
return res;
|
||||
return res?STATUS_UNKNOWN_COMMAND:proc_get_last_status();
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ int parse_util_unload( const wchar_t *cmd,
|
||||
{
|
||||
if( on_load )
|
||||
{
|
||||
on_load( (wchar_t *)val );
|
||||
on_load( cmd );
|
||||
}
|
||||
free( val );
|
||||
}
|
||||
|
||||
36
parser.c
36
parser.c
@@ -1669,6 +1669,7 @@ static void parse_job_argument_list( process_t *p,
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
static void print_block_stack( block_t *b )
|
||||
{
|
||||
@@ -1931,16 +1932,31 @@ static int parse_job( process_t *p,
|
||||
int nxt_forbidden=0;
|
||||
wchar_t *forbid;
|
||||
|
||||
if( current_block->type == FUNCTION_CALL )
|
||||
int is_function_call=0;
|
||||
|
||||
/*
|
||||
This is a bit fragile. It is a test to see if we are
|
||||
inside of function call, but not inside a block in that
|
||||
function call. If, in the future, the rules for what
|
||||
block scopes are pushed on function invocation changes,
|
||||
then this check will break.
|
||||
*/
|
||||
if( ( current_block->type == TOP ) &&
|
||||
( current_block->outer ) &&
|
||||
( current_block->outer->type == FUNCTION_CALL ) )
|
||||
is_function_call = 1;
|
||||
|
||||
/*
|
||||
If we are directly in a function, and this is the first
|
||||
command of the block, then the function we are executing
|
||||
may not be called, since that would mean an infinite
|
||||
recursion.
|
||||
*/
|
||||
if( is_function_call && !current_block->had_command )
|
||||
{
|
||||
forbid = (wchar_t *)(al_get_count( forbidden_function)?al_peek( forbidden_function ):0);
|
||||
nxt_forbidden = forbid && (wcscmp( forbid, nxt) == 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
Make feeble attempt to avoid infinite recursion. Will at
|
||||
least catch some accidental infinite recursion calls.
|
||||
*/
|
||||
|
||||
if( !nxt_forbidden && function_exists( nxt ) )
|
||||
{
|
||||
@@ -2198,6 +2214,14 @@ static int parse_job( process_t *p,
|
||||
}
|
||||
}
|
||||
|
||||
if( !error_code )
|
||||
{
|
||||
if( !is_new_block )
|
||||
{
|
||||
current_block->had_command = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( error_code )
|
||||
{
|
||||
/*
|
||||
|
||||
5
parser.h
5
parser.h
@@ -47,7 +47,8 @@ typedef struct block
|
||||
int type; /**< Type of block. Can be one of WHILE, FOR, IF and FUNCTION */
|
||||
int skip; /**< Whether execution of the commands in this block should be skipped */
|
||||
int tok_pos; /**< The start index of the block */
|
||||
|
||||
int had_command; /**< Set to non-zero once a command has been executed in this block */
|
||||
|
||||
/**
|
||||
Status for the current loop block. Can be any of the values from the loop_status enum.
|
||||
*/
|
||||
@@ -210,7 +211,7 @@ int eval_args( const wchar_t *line,
|
||||
array_list_t *output );
|
||||
|
||||
/**
|
||||
Sets the current error
|
||||
Sets the current evaluation error. This function should only be used by libraries that are called by
|
||||
|
||||
\param ec The new error code
|
||||
\param p The character offset at which the error occured
|
||||
|
||||
160
proc.c
160
proc.c
@@ -189,9 +189,8 @@ void proc_destroy()
|
||||
|
||||
void proc_set_last_status( int s )
|
||||
{
|
||||
|
||||
last_status = s;
|
||||
// fwprintf( stderr, L"Set last status to %d\n", s );
|
||||
// debug( 0, L"Set last status to %d\n", s );
|
||||
}
|
||||
|
||||
int proc_get_last_status()
|
||||
@@ -312,6 +311,8 @@ static void mark_process_status( job_t *j,
|
||||
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")) );
|
||||
|
||||
if (WIFSTOPPED (status))
|
||||
{
|
||||
p->stopped = 1;
|
||||
@@ -319,6 +320,7 @@ static void mark_process_status( job_t *j,
|
||||
else
|
||||
{
|
||||
p->completed = 1;
|
||||
|
||||
|
||||
if (( !WIFEXITED( status ) ) &&
|
||||
(! WIFSIGNALED( status )) )
|
||||
@@ -848,6 +850,70 @@ static void read_try( job_t *j )
|
||||
}
|
||||
|
||||
|
||||
static int terminal_give_to_job( job_t *j, int cont )
|
||||
{
|
||||
|
||||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1,
|
||||
_( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( cont )
|
||||
{
|
||||
if( tcsetattr (0, TCSADRAIN, &j->tmodes))
|
||||
{
|
||||
debug( 1,
|
||||
_( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetattr" );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
REturns contol of the terminal
|
||||
*/
|
||||
static int terminal_return_from_job( job_t *j)
|
||||
{
|
||||
|
||||
if( tcsetpgrp (0, getpid()) )
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Save jobs terminal modes.
|
||||
*/
|
||||
if( tcgetattr (0, &j->tmodes) )
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcgetattr" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Restore the shell's terminal modes.
|
||||
*/
|
||||
if( tcsetattr (0, TCSADRAIN, &shell_modes))
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetattr" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void job_continue (job_t *j, int cont)
|
||||
{
|
||||
/*
|
||||
@@ -858,9 +924,12 @@ void job_continue (job_t *j, int cont)
|
||||
first_job = j;
|
||||
job_set_flag( j, JOB_NOTIFIED, 0 );
|
||||
|
||||
debug( 3,
|
||||
L"Continue job %d (%ls), %ls, %ls",
|
||||
CHECK_BLOCK();
|
||||
|
||||
debug( 4,
|
||||
L"Continue job %d, gid %d (%ls), %ls, %ls",
|
||||
j->job_id,
|
||||
j->pgid,
|
||||
j->command,
|
||||
job_is_completed( j )?L"COMPLETED":L"UNCOMPLETED",
|
||||
is_interactive?L"INTERACTIVE":L"NON-INTERACTIVE" );
|
||||
@@ -870,30 +939,17 @@ void job_continue (job_t *j, int cont)
|
||||
if( job_get_flag( j, JOB_TERMINAL ) && job_get_flag( j, JOB_FOREGROUND ) )
|
||||
{
|
||||
/* Put the job into the foreground. */
|
||||
signal_block();
|
||||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1,
|
||||
_( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return;
|
||||
}
|
||||
int ok;
|
||||
|
||||
signal_block();
|
||||
|
||||
ok = terminal_give_to_job( j, cont );
|
||||
|
||||
if( cont )
|
||||
{
|
||||
if( tcsetattr (0, TCSADRAIN, &j->tmodes))
|
||||
{
|
||||
debug( 1,
|
||||
_( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetattr" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
signal_unblock();
|
||||
|
||||
if( !ok )
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -967,10 +1023,27 @@ void job_continue (job_t *j, int cont)
|
||||
short-lived jobs.
|
||||
*/
|
||||
int status;
|
||||
// debug( 1, L"waitpid" );
|
||||
pid_t pid = waitpid(-1, &status, WUNTRACED );
|
||||
if( pid > 0 )
|
||||
{
|
||||
handle_child_status( pid, status );
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
This probably means we got a
|
||||
signal. A signal might mean that the
|
||||
terminal emulator sent us a hup
|
||||
signal to tell is to close. If so,
|
||||
we should exit.
|
||||
*/
|
||||
if( reader_exit_forced() )
|
||||
{
|
||||
quit = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1007,34 +1080,17 @@ void job_continue (job_t *j, int cont)
|
||||
*/
|
||||
if( job_get_flag( j, JOB_TERMINAL ) && job_get_flag( j, JOB_FOREGROUND ) )
|
||||
{
|
||||
int ok;
|
||||
|
||||
signal_block();
|
||||
if( tcsetpgrp (0, getpid()) )
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return;
|
||||
}
|
||||
|
||||
ok = terminal_return_from_job( j );
|
||||
|
||||
/*
|
||||
Save jobs terminal modes.
|
||||
*/
|
||||
if( tcgetattr (0, &j->tmodes) )
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcgetattr" );
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Restore the shell's terminal modes.
|
||||
*/
|
||||
if( tcsetattr (0, TCSADRAIN, &shell_modes))
|
||||
{
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetattr" );
|
||||
return;
|
||||
}
|
||||
signal_unblock();
|
||||
|
||||
if( !ok )
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
156
reader.c
156
reader.c
@@ -275,10 +275,6 @@ static pid_t original_pid;
|
||||
*/
|
||||
static int interrupted=0;
|
||||
|
||||
/**
|
||||
Original terminal mode when fish was started
|
||||
*/
|
||||
static struct termios old_modes;
|
||||
|
||||
/*
|
||||
Prototypes for a bunch of functions defined later on.
|
||||
@@ -303,8 +299,6 @@ static int exit_forced;
|
||||
*/
|
||||
static void term_donate()
|
||||
{
|
||||
tcgetattr(0,&old_modes); /* get the current terminal modes */
|
||||
|
||||
set_color(FISH_COLOR_NORMAL, FISH_COLOR_NORMAL);
|
||||
|
||||
while( 1 )
|
||||
@@ -348,12 +342,6 @@ static void term_steal()
|
||||
|
||||
common_handle_winch(0 );
|
||||
|
||||
if( tcsetattr(0,TCSANOW,&old_modes))/* return to previous mode */
|
||||
{
|
||||
wperror(L"tcsetattr");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int reader_exit_forced()
|
||||
@@ -682,40 +670,6 @@ static void remove_backward()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Insert the character into the command line buffer and print it to
|
||||
the screen using syntax highlighting, etc.
|
||||
*/
|
||||
static int insert_char( int c )
|
||||
{
|
||||
|
||||
if( !check_size() )
|
||||
return 0;
|
||||
|
||||
/* Insert space for extra character at the right position */
|
||||
if( data->buff_pos < data->buff_len )
|
||||
{
|
||||
memmove( &data->buff[data->buff_pos+1],
|
||||
&data->buff[data->buff_pos],
|
||||
sizeof(wchar_t)*(data->buff_len-data->buff_pos) );
|
||||
}
|
||||
/* Set character */
|
||||
data->buff[data->buff_pos]=c;
|
||||
|
||||
/* Update lengths, etc */
|
||||
data->buff_pos++;
|
||||
data->buff_len++;
|
||||
data->buff[data->buff_len]='\0';
|
||||
|
||||
/* Syntax highlight */
|
||||
|
||||
reader_super_highlight_me_plenty( data->buff_pos-1,
|
||||
0 );
|
||||
|
||||
repaint();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Insert the characters of the string into the command line buffer
|
||||
@@ -744,17 +698,33 @@ static int insert_str(wchar_t *str)
|
||||
data->buff_pos += len;
|
||||
data->buff[data->buff_len]='\0';
|
||||
|
||||
/* Syntax highlight */
|
||||
|
||||
/*
|
||||
Syntax highlight
|
||||
*/
|
||||
reader_super_highlight_me_plenty( data->buff_pos-1,
|
||||
0 );
|
||||
|
||||
/* repaint */
|
||||
|
||||
repaint();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Insert the character into the command line buffer and print it to
|
||||
the screen using syntax highlighting, etc.
|
||||
*/
|
||||
static int insert_char( int c )
|
||||
{
|
||||
wchar_t str[]=
|
||||
{
|
||||
0, 0
|
||||
}
|
||||
;
|
||||
str[0] = c;
|
||||
return insert_str( str );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Calculate the length of the common prefix substring of two strings.
|
||||
*/
|
||||
@@ -769,10 +739,11 @@ static int comp_len( wchar_t *a, wchar_t *b )
|
||||
}
|
||||
|
||||
/**
|
||||
Find the outermost quoting style of current token. Returns 0 if token is not quoted.
|
||||
Find the outermost quoting style of current token. Returns 0 if
|
||||
token is not quoted.
|
||||
|
||||
*/
|
||||
static wchar_t get_quote( wchar_t *cmd, int l )
|
||||
static wchar_t get_quote( wchar_t *cmd, int len )
|
||||
{
|
||||
int i=0;
|
||||
wchar_t res=0;
|
||||
@@ -795,7 +766,7 @@ static wchar_t get_quote( wchar_t *cmd, int l )
|
||||
{
|
||||
const wchar_t *end = quote_end( &cmd[i] );
|
||||
//fwprintf( stderr, L"Jump %d\n", end-cmd );
|
||||
if(( end == 0 ) || (!*end) || (end-cmd > l))
|
||||
if(( end == 0 ) || (!*end) || (end-cmd > len))
|
||||
{
|
||||
res = cmd[i];
|
||||
break;
|
||||
@@ -956,13 +927,18 @@ static void completion_insert( wchar_t *val, int is_complete )
|
||||
|
||||
if( insert_str( replaced ) )
|
||||
{
|
||||
|
||||
if( is_complete ) /* Print trailing space since this is the only completion */
|
||||
/*
|
||||
Print trailing space since this is the only completion
|
||||
*/
|
||||
if( is_complete )
|
||||
{
|
||||
|
||||
if( (quote) &&
|
||||
(data->buff[data->buff_pos] != quote ) ) /* This is a quoted parameter, first print a quote */
|
||||
(data->buff[data->buff_pos] != quote ) )
|
||||
{
|
||||
/*
|
||||
This is a quoted parameter, first print a quote
|
||||
*/
|
||||
insert_char( quote );
|
||||
}
|
||||
insert_char( L' ' );
|
||||
@@ -973,8 +949,13 @@ static void completion_insert( wchar_t *val, int is_complete )
|
||||
}
|
||||
|
||||
/**
|
||||
Run the fish_pager command to display the completion list, and
|
||||
insert the result into the backbuffer.
|
||||
Run the fish_pager command to display the completion list. If the
|
||||
fish_pager outputs any text, it is inserted into the input
|
||||
backbuffer.
|
||||
|
||||
\param prefix the string to display before every completion.
|
||||
\param is_quoted should be set if the argument is quoted. This will change the display style.
|
||||
\param comp the list of completions to display
|
||||
*/
|
||||
|
||||
static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
|
||||
@@ -984,7 +965,7 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
|
||||
string_buffer_t msg;
|
||||
wchar_t * prefix_esc;
|
||||
char *foo;
|
||||
|
||||
|
||||
if( !prefix || (wcslen(prefix)==0))
|
||||
prefix_esc = wcsdup(L"\"\"");
|
||||
else
|
||||
@@ -1045,7 +1026,6 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
|
||||
|
||||
io_buffer_destroy( out);
|
||||
io_buffer_destroy( in);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1217,7 +1197,6 @@ static void reader_interactive_init()
|
||||
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
|
||||
{
|
||||
wperror(L"tcsetattr");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1918,6 +1897,34 @@ static int read_i()
|
||||
|
||||
repaint();
|
||||
}
|
||||
else
|
||||
{
|
||||
pid_t my_pid = getpid();
|
||||
for( j = first_job; j; j=j->next )
|
||||
{
|
||||
if( ! job_is_completed( j ) )
|
||||
{
|
||||
if( j->pgid != my_pid )
|
||||
{
|
||||
killpg( j->pgid, SIGHUP );
|
||||
}
|
||||
else
|
||||
{
|
||||
process_t *p;
|
||||
for( p = j->first_process; p; p=p->next )
|
||||
{
|
||||
if( ! p->completed )
|
||||
{
|
||||
if( p->pid )
|
||||
{
|
||||
kill( p->pid, SIGHUP );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1984,12 +1991,15 @@ wchar_t *reader_readline()
|
||||
reader_super_highlight_me_plenty( data->buff_pos, 0 );
|
||||
repaint();
|
||||
|
||||
/* get the current terminal modes. These will be restored when the function returns. */
|
||||
/*
|
||||
get the current terminal modes. These will be restored when the
|
||||
function returns.
|
||||
*/
|
||||
tcgetattr(0,&old_modes);
|
||||
if( tcsetattr(0,TCSANOW,&shell_modes)) /* set the new modes */
|
||||
/* set the new modes */
|
||||
if( tcsetattr(0,TCSANOW,&shell_modes))
|
||||
{
|
||||
wperror(L"tcsetattr");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while( !finished && !data->end_loop)
|
||||
@@ -2004,6 +2014,7 @@ wchar_t *reader_readline()
|
||||
while( 1 )
|
||||
{
|
||||
c=input_readch();
|
||||
|
||||
|
||||
if( ( (!wchar_private(c))) && (c>31) && (c != 127) )
|
||||
{
|
||||
@@ -2059,8 +2070,11 @@ wchar_t *reader_readline()
|
||||
/* go to beginning of line*/
|
||||
case R_BEGINNING_OF_LINE:
|
||||
{
|
||||
while( data->buff_pos>0 && data->buff[data->buff_pos-1] != L'\n' )
|
||||
while( ( data->buff_pos>0 ) &&
|
||||
( data->buff[data->buff_pos-1] != L'\n' ) )
|
||||
{
|
||||
data->buff_pos--;
|
||||
}
|
||||
|
||||
repaint();
|
||||
break;
|
||||
@@ -2068,8 +2082,11 @@ wchar_t *reader_readline()
|
||||
|
||||
case R_END_OF_LINE:
|
||||
{
|
||||
while( data->buff[data->buff_pos] && data->buff[data->buff_pos] != L'\n' )
|
||||
while( data->buff[data->buff_pos] &&
|
||||
data->buff[data->buff_pos] != L'\n' )
|
||||
{
|
||||
data->buff_pos++;
|
||||
}
|
||||
|
||||
repaint();
|
||||
break;
|
||||
@@ -2365,7 +2382,9 @@ wchar_t *reader_readline()
|
||||
}
|
||||
|
||||
/*
|
||||
Result must be some combination including an error. The error message will already be printed, all we need to do is repaint
|
||||
Result must be some combination including an
|
||||
error. The error message will already be
|
||||
printed, all we need to do is repaint
|
||||
*/
|
||||
default:
|
||||
{
|
||||
@@ -2518,7 +2537,7 @@ wchar_t *reader_readline()
|
||||
/* Other, if a normal character, we add it to the command */
|
||||
default:
|
||||
{
|
||||
if( (!wchar_private(c)) && (( (c>31) || (c=L'\n'))&& (c != 127)) )
|
||||
if( (!wchar_private(c)) && (( (c>31) || (c==L'\n'))&& (c != 127)) )
|
||||
{
|
||||
insert_char( c );
|
||||
}
|
||||
@@ -2558,7 +2577,6 @@ wchar_t *reader_readline()
|
||||
if( tcsetattr(0,TCSANOW,&old_modes)) /* return to previous mode */
|
||||
{
|
||||
wperror(L"tcsetattr");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
set_color( FISH_COLOR_RESET, FISH_COLOR_RESET );
|
||||
|
||||
13
screen.c
13
screen.c
@@ -80,6 +80,14 @@ static int try_sequence( char *seq, wchar_t *str )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int next_tab_stop( int in )
|
||||
{
|
||||
if( init_tabs <= 0 )
|
||||
init_tabs = 8;
|
||||
|
||||
return ( (in/init_tabs)+1 )*init_tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
Calculate the width of the specified prompt. Does some clever magic
|
||||
to detect common escape sequences that may be embeded in a prompt,
|
||||
@@ -184,10 +192,7 @@ static int calc_prompt_width( wchar_t *prompt )
|
||||
/*
|
||||
Assume tab stops every 8 characters if undefined
|
||||
*/
|
||||
if( init_tabs <= 0 )
|
||||
init_tabs = 8;
|
||||
|
||||
res=( (res/init_tabs)+1 )*init_tabs;
|
||||
res = next_tab_stop( res );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -217,3 +217,25 @@ complete $add_opt -l dry-run -d (N_ "Don't actually take the action")
|
||||
complete $add_opt -s q -l quiet -d (N_ "Suppress informational output")
|
||||
|
||||
|
||||
set -l optimize_opt -c darcs -n 'contains optimize (commandline -poc)'
|
||||
complete $optimize_opt -l checkpoint -d (N_ "Create a checkpoint file")
|
||||
complete $optimize_opt -l compress -d (N_ "Create compressed patches")
|
||||
complete $optimize_opt -l dont-compress -d (N_ "Don't create compressed patches")
|
||||
complete $optimize_opt -l uncompress -d (N_ "Uncompress patches")
|
||||
complete $optimize_opt -s t -l tag -r -d (N_ "Name of version to checkpoint")
|
||||
complete $optimize_opt -l modernize-patches -d (N_ "Rewrite all patches in current darcs format")
|
||||
complete $optimize_opt -l reorder-patches -d (N_ "Reorder the patches in the repository")
|
||||
complete $optimize_opt -l sibling -r -d (N_ "Specify a sibling directory")
|
||||
complete $optimize_opt -l relink -d (N_ "Relink random internal data to a sibling")
|
||||
complete $optimize_opt -l relink-pristine -d (N_ "Relink pristine tree (not recommended)")
|
||||
complete $optimize_opt -l posthook -r -d (N_ "Specify command to run after this darcs command.")
|
||||
complete $optimize_opt -l no-posthook -d (N_ "Do not run posthook command.B")
|
||||
complete $optimize_opt -l prompt-posthook -d (N_ "Prompt before running posthook. [DEFAULT]")
|
||||
complete $optimize_opt -l run-posthook -d (N_ "Run posthook command without prompting.")
|
||||
|
||||
set -l setpref_opt -c darcs -n 'contains setpref (commandline -poc)'
|
||||
complete $setpref_opt -l posthook -r -d (N_ "Specify command to run after this darcs command.")
|
||||
complete $setpref_opt -l no-posthook -d (N_ "Do not run posthook command.B")
|
||||
complete $setpref_opt -l prompt-posthook -d (N_ "Prompt before running posthook. [DEFAULT]")
|
||||
complete $setpref_opt -l run-posthook -d (N_ "Run posthook command without prompting.")
|
||||
|
||||
|
||||
3
share/completions/dvipdf.fish
Normal file
3
share/completions/dvipdf.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
complete -c dvipdf -x -a "(
|
||||
__fish_complete_suffix (commandline -ct) .dvi 'DVI file'
|
||||
)"
|
||||
3
share/completions/dvipdfm.fish
Normal file
3
share/completions/dvipdfm.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
complete -c dvipdfm -x -a "(
|
||||
__fish_complete_suffix (commandline -ct) .dvi 'DVI file'
|
||||
)"
|
||||
25
share/completions/eix-sync.fish
Normal file
25
share/completions/eix-sync.fish
Normal file
@@ -0,0 +1,25 @@
|
||||
# Completions for the eix tool's eix-sync command
|
||||
# http://dev.croup.de/proj/eix and http://sourceforge.net/projects/eix/
|
||||
|
||||
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
||||
|
||||
##########
|
||||
# EIX-SYNC
|
||||
complete -c eix-sync -s i -d "Ignore all previous options"
|
||||
complete -c eix-sync -s d -d "Only show differences to the previously saved database and exit"
|
||||
complete -c eix-sync -s s -xua '(__fish_print_users)@(__fish_print_hostnames):' -d "Sync via rsync from the given SERVER"
|
||||
complete -c eix-sync -s c -xua '(__fish_print_users)@(__fish_print_hostnames):' -d "Sync via rsync *to* the given CLIENT"
|
||||
complete -c eix-sync -s U -d "Do not touch the database and omit the hooks after update-eix. (Implies -R)"
|
||||
complete -c eix-sync -s u -d "Update database only and show differences"
|
||||
complete -c eix-sync -s g -d "Do not call gensync (and the !commands in /etc/eix-sync.conf)"
|
||||
complete -c eix-sync -s @ -d "Do not execute the hooks of /etc/eix-sync.conf"
|
||||
complete -c eix-sync -s S -d "Do not execute the hooks after emerge --sync (@@ entries)"
|
||||
complete -c eix-sync -s m -d "Run emerge --metadata instead of emerge --sync"
|
||||
complete -c eix-sync -s t -d "Use temporary file to save the current database"
|
||||
complete -c eix-sync -s v -d "Don't suppress output of update-eix and emerge"
|
||||
complete -c eix-sync -s q -d "Be quiet (close stdout)"
|
||||
complete -c eix-sync -s w -d "Run emerge-webrsync instead of emerge --sync"
|
||||
complete -c eix-sync -s r -d "Really recreate the dep-cache (rm -rf /var/cache/edb/dep/*) (default)"
|
||||
complete -c eix-sync -s R -d "Do not really recreate the dep-cache"
|
||||
complete -c eix-sync -s h -d "Show a short help text and exit"
|
||||
##########
|
||||
64
share/completions/eix.fish
Normal file
64
share/completions/eix.fish
Normal file
@@ -0,0 +1,64 @@
|
||||
# Completions for the eix tool
|
||||
# http://dev.croup.de/proj/eix and http://sourceforge.net/projects/eix/
|
||||
|
||||
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
||||
|
||||
##########
|
||||
# EIX
|
||||
#####
|
||||
# Global options
|
||||
###
|
||||
# exclusive options
|
||||
complete -c eix -s h -l help -d "Show a help screen and exit"
|
||||
complete -c eix -s V -l version -d "Show version and exit"
|
||||
complete -c eix -l dump -d "Dump variables to stdout"
|
||||
complete -c eix -l dump-defaults -d "Dump default values of variables to stdout"
|
||||
###
|
||||
# special options
|
||||
complete -c eix -s t -l test-non-matching -d "Print non-matching entries first"
|
||||
complete -c eix -s Q -l quick -d "Don't read unguessable slots of installed packages (toggle)"
|
||||
complete -c eix -l care -d "Always read slots of installed packages"
|
||||
###
|
||||
# ootput options
|
||||
complete -c eix -s q -l quiet -d "(no) output (toggle)"
|
||||
complete -c eix -s n -l nocolor -d "Don't use ANSI color codes"
|
||||
complete -c eix -s F -l force-color -d "Force colorful output"
|
||||
complete -c eix -s c -l compact -d "Compact search results (toggle)"
|
||||
complete -c eix -s v -l verbose -d "Verbose search results (toggle)"
|
||||
complete -c eix -s x -l versionsort -d "Sort output by slots/versions (toggle)"
|
||||
complete -c eix -s l -l versionlines -d "Print available versions line-by-line (toggle)"
|
||||
complete -c eix -l format -d "Format string for normal output"
|
||||
complete -c eix -l format-compact -d "Format string for compact output"
|
||||
complete -c eix -l format-verbose -d "Format string for verbose output"
|
||||
#####
|
||||
# Local options
|
||||
###
|
||||
# Miscellaneous
|
||||
complete -c eix -s I -l installed -d "Next expression only matches installed packages"
|
||||
complete -c eix -s i -l multi-installed -d "Match packages installed in several versions"
|
||||
complete -c eix -s d -l dup-packages -d "Match duplicated packages"
|
||||
complete -c eix -s D -l dup-versions -d "Match packages with duplicated versions"
|
||||
complete -c eix -s 1 -l slotted -d "Match packages with a nontrivial slot"
|
||||
complete -c eix -s 2 -l slots -d "Match packages with two different slots"
|
||||
complete -c eix -s u -l update -d "Match packages without best slotted version"
|
||||
complete -c eix -s o -l overlay -d "Match packages from overlays"
|
||||
complete -c eix -s T -l test-obsolete -d "Match packages with obsolete entries"
|
||||
complete -c eix -s '!' -l not -d "Invert the expression (toggle)"
|
||||
complete -c eix -s '|' -l pipe -d "Use input from pipe of emerge -pv"
|
||||
###
|
||||
# Search Fields
|
||||
complete -c eix -s S -l description -d "Search the description field"
|
||||
complete -c eix -s A -l category-name -d "Search the category and name fields"
|
||||
complete -c eix -s C -l category -d "Search the category field"
|
||||
complete -c eix -s s -l name -d "Search the name field (default)"
|
||||
complete -c eix -s H -l homepage -d "Search the homepage field"
|
||||
complete -c eix -s L -l license -d "Search the license field"
|
||||
complete -c eix -s P -l provides -d "Search the provides field"
|
||||
###
|
||||
# Type of Pattern
|
||||
complete -c eix -s r -l regex -d "Pattern is a regexp (default)"
|
||||
complete -c eix -s e -l exact -d "Pattern is the exact string"
|
||||
complete -c eix -s p -l pattern -d "Pattern is a wildcards-pattern"
|
||||
complete -c eix -s f -l fuzzy -d "Use fuzzy-search with the given max. levenshtein-distance (default: 2)"
|
||||
#####
|
||||
##########
|
||||
@@ -1,68 +1,84 @@
|
||||
#Completions for emerge
|
||||
# Completions for emerge
|
||||
|
||||
function __fish_emerge_use_package -d (N_ 'Test if emerge command should have packages as potential completion')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i -a --ask -p --pretend --oneshot -O --nodeps -f --fetchonly
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_emerge_manipulate_package -d (N_ 'Tests if emerge command should have package as potential completion for removal')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i -u --update -C --unmerge -P --prune
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
||||
|
||||
function __fish_emerge_print_installed_pkgs -d (N_ 'Prints completions for installed packages on the system from /var/db/pkg')
|
||||
if test -d /var/db/pkg
|
||||
find /var/db/pkg/ -type d | cut -d'/' -f6 | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
|
||||
return
|
||||
end
|
||||
if test -d /var/db/pkg
|
||||
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
complete -f -c emerge -n '__fish_emerge_use_package' -a '(__fish_print_packages)' -d (N_ 'Package')
|
||||
complete -f -c emerge -n '__fish_emerge_manipulate_package' -a '(__fish_emerge_print_installed_pkgs)' -d (N_ 'Package')
|
||||
complete -c emerge -s h -l help -d (N_ "Display help and exit")
|
||||
complete -c emerge -s c -l clean -d (N_ "Cleans the system by removing outdated packages")
|
||||
complete -c emerge -l depclean -d (N_ "Cleans the system by removing packages that are not associated with explicitly merged packages")
|
||||
complete -c emerge -l info -d (N_ "Displays important portage variables that will be exported to ebuild.sh when performing merges")
|
||||
complete -c emerge -l metadata -d (N_ "Causes portage to process all the metacache files as is normally done on the tail end of an rsync update using emerge --sync")
|
||||
complete -c emerge -s P -l prune -d (N_ "Removes all but the most recently installed version of a package from your system")
|
||||
complete -c emerge -l regen -d (N_ "Causes portage to check and update the dependency cache of all ebuilds in the portage tree")
|
||||
complete -c emerge -s s -l search -d (N_ "Searches for matches of the supplied string in the current local portage tree")
|
||||
complete -c emerge -s C -l unmerge -d (N_ "Removes all matching packages completely from your system")
|
||||
complete -c emerge -s a -l ask -d (N_ "Before performing the merge, display what ebuilds and tbz2s will be installed, in the same format as when using --pretend")
|
||||
complete -c emerge -s b -l buildpkg -d (N_ "Tell emerge to build binary packages for all ebuilds processed in addition to actually merging the packages")
|
||||
complete -c emerge -s B -l buildpkgonly -d (N_ "Creates a binary package, but does not merge it to the system")
|
||||
complete -c emerge -s l -l changelog -d (N_ "When pretending, also display the ChangeLog entries for packages that will be upgraded")
|
||||
complete -c emerge -l columns -d (N_ "Display the pretend output in a tabular form")
|
||||
complete -c emerge -s d -l debug -d (N_ "Tell emerge to run the ebuild command in --debug mode")
|
||||
complete -c emerge -s D -l deep -d (N_ "When used in conjunction with --update, this flag forces emerge to consider the entire dependency tree of packages, instead of checking only the immediate dependencies of the packages")
|
||||
complete -c emerge -s e -l emptytree -d (N_ "Virtually tweaks the tree of installed packages to contain nothing")
|
||||
complete -c emerge -s f -l fetchonly -d (N_ "Instead of doing any package building, just perform fetches for all packages (main package as well as all dependencies)")
|
||||
complete -c emerge -l fetch-all-uri -d (N_ "Same as --fetchonly except that all package files, including those not required to build the package, will be processed")
|
||||
complete -c emerge -s g -l getbinpkg -d (N_ "Using the server and location defined in PORTAGE_BINHOST, portage will download the information from each binary file there and it will use that information to help build the dependency list")
|
||||
complete -c emerge -s G -l getbinpkgonly -d (N_ "This option is identical to -g, except it will not use ANY information from the local machine")
|
||||
complete -c emerge -s N -l newuse -d (N_ "Tells emerge to include installed packages where USE flags have changed since installation")
|
||||
complete -c emerge -l noconfmem -d (N_ "Merge files in CONFIG_PROTECT to the live fs instead of silently dropping them")
|
||||
complete -c emerge -s O -l nodeps -d (N_ "Merge specified packages, but don't merge any dependencies")
|
||||
complete -c emerge -s n -l noreplace -d (N_ "Skip the packages specified on the command-line that have already been installed")
|
||||
complete -c emerge -l nospinner -d (N_ "Disables the spinner regardless of terminal type")
|
||||
complete -c emerge -l oneshot -d (N_ "Emerge as normal, but don't add packages to the world profile")
|
||||
complete -c emerge -s o -l onlydeps -d (N_ "Only merge (or pretend to merge) the dependencies of the specified packages, not the packages themselves")
|
||||
complete -c emerge -s p -l pretend -d (N_ "Do not merge, display what ebuilds and tbz2s would have been installed")
|
||||
complete -c emerge -s q -l quiet -d (N_ "Reduced output from portage's displays")
|
||||
complete -c emerge -l resume -d (N_ "Resumes the last merge operation")
|
||||
complete -c emerge -s S -l searchdesc -d (N_ "Matches the search string against the description field as well the package's name")
|
||||
complete -c emerge -l skipfirst -d (N_ "Remove the first package in the resume list so that a merge may continue in the presence of an uncorrectable or inconsequential error")
|
||||
complete -c emerge -s t -l tree -d (N_ "Shows the dependency tree using indentation for dependencies")
|
||||
complete -c emerge -s u -l update -d (N_ "Updates packages to the best version available")
|
||||
complete -c emerge -s k -l usepkg -d (N_ "Tell emerge to use binary packages (from $PKGDIR) if they are available, thus possibly avoiding some time-consuming compiles")
|
||||
complete -c emerge -s K -l usepkgonly -d (N_ "Like --usepkg, except this only allows the use of binary packages, and it will abort the emerge if the package is not available at the time of dependency calculation")
|
||||
complete -c emerge -s v -l verbose -d (N_ "Increased or expanded display of content in portage's displays")
|
||||
complete -c emerge -s V -l version -d (N_ "Displays the currently installed version of portage along with other information useful for quick reference on a system")
|
||||
function __fish_emerge_print_all_pkgs -d (N_ 'Prints completions for all available packages on the system from /usr/portage')
|
||||
if test -d /usr/portage
|
||||
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_emerge_use_installed_package -d (N_ 'Tests if emerge command should have an installed package as potential completion')
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i -u --update -C --unmerge -P --prune --config
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
#########################
|
||||
# Actions
|
||||
complete -c emerge -n '__fish_emerge_use_installed_package' -xua 'system\t"'(_ "All base system packages")'" world\t"'(_ "All packages in world")'" (__fish_emerge_print_installed_pkgs)\t"'(_ "Installed package")'"'
|
||||
complete -c emerge -n 'not __fish_emerge_use_installed_package' -xua 'system\t"'(_ "All base system packages")'" world\t"'(_ "All packages in world")'" (__fish_emerge_print_all_pkgs)\t"'(_ "Package")'"'
|
||||
complete -c emerge -l sync -d "Synchronize the portage tree"
|
||||
complete -c emerge -l info -d "Get informations to include in bug reports"
|
||||
complete -c emerge -s V -l version -d "Displays the version number of emerge"
|
||||
complete -c emerge -s h -l help -xa '""\t"'(_ "Usage overview of emerge")'" system\t"'(_ "Help on subject system")'" config\t"'(_ "Help on subject config")'" sync\t"'(_ "Help on subject sync")'"' -d "Displays help information for emerge"
|
||||
complete -c emerge -s c -l clean -d "Remove packages that will not affect the functionality of the system"
|
||||
complete -c emerge -l config -d "Run package specific actions needed to be executed after the emerge process"
|
||||
complete -c emerge -l depclean -d "WARNING: Delete all packages that are neither deps nor in world"
|
||||
complete -c emerge -l metadata -d "Process all meta-cache files"
|
||||
complete -c emerge -s P -l prune -d "WARNING: Remove all but the latest version of package"
|
||||
complete -c emerge -l regen -d "Check and update the dependency cache"
|
||||
complete -c emerge -l resume -d "Resume the last merge operation"
|
||||
complete -c emerge -s s -l search -d "Search for matches in the portage tree"
|
||||
complete -c emerge -s S -l searchdesc -d "Search for matches in package names and descriptions"
|
||||
complete -c emerge -s C -l unmerge -d "WARNING: Remove the given package"
|
||||
complete -c emerge -s u -l update -d "Update the given package"
|
||||
# END Actions
|
||||
#########################
|
||||
|
||||
#########################
|
||||
# Options
|
||||
complete -c emerge -l alphabetical -d "Sort flag lists alphabetically"
|
||||
complete -c emerge -s a -l ask -d "Prompt the user before peforming the merge"
|
||||
complete -c emerge -s b -l buildpkg -d "Build a binary package additionally"
|
||||
complete -c emerge -s B -l buildpkgonly -d "Only build a binary package"
|
||||
complete -c emerge -s l -l changelog -d "Show changelog of package. Use with --pretend"
|
||||
complete -c emerge -l color -xa 'y\t"'(_ "Use colors in output")'" n\t"'(_ "Don't use colors in output")'"' -d "Toggle colorized output"
|
||||
complete -c emerge -l colums -d "Align output. Use with --pretend"
|
||||
complete -c emerge -s d -l debug -d "Run in debug mode"
|
||||
complete -c emerge -s D -l deep -d "Consider the whole dependency tree"
|
||||
complete -c emerge -s e -l emptytree -d "Reinstall all world packages"
|
||||
complete -c emerge -s f -l fetchonly -d "Only download the packages but don't install them"
|
||||
complete -c emerge -s F -l fetch-all-uri -d "Same as --fetchonly and grab all potential files"
|
||||
complete -c emerge -s g -l getbinpkg -d "Download infos from each binary package. Implies -k"
|
||||
complete -c emerge -s G -l getbinpkgonly -d "As -g but don't use local infos"
|
||||
complete -c emerge -l ignore-default-opts -d "Ignore EMERGE_DEFAULT_OPTS"
|
||||
complete -c emerge -s N -l newuse -d "Include installed packages with changed USE flags"
|
||||
complete -c emerge -l noconfmem -d "Disregard merge records"
|
||||
complete -c emerge -s O -l nodeps -d "Don't merge dependencies"
|
||||
complete -c emerge -s n -l noreplace -d "Skip already installed packages"
|
||||
complete -c emerge -l nospinner -d "Disable the spinner"
|
||||
complete -c emerge -s 1 -l oneshot -d "Don't add packages to world"
|
||||
complete -c emerge -s o -l onlydeps -d "Only merge dependencies"
|
||||
complete -c emerge -s p -l pretend -d "Display what would be done without doing it"
|
||||
complete -c emerge -s q -l quit -d "Use a condensed output"
|
||||
complete -c emerge -l skipfirst -d "Remove the first package in the resume list. Use with --resume"
|
||||
complete -c emerge -s t -l tree -d "Show the dependency tree"
|
||||
complete -c emerge -s k -l usepkg -d "Use binary package if available"
|
||||
complete -c emerge -s K -l usepkgonly -d "Only use binary packages"
|
||||
complete -c emerge -s v -l verbose -d "Run in verbose mode"
|
||||
complete -c emerge -l with-bdeps -xa 'y\t"'(_ "Pull in build time dependencies")'" n\t"'(_ "Don't pull in build time dependencies")'"' -d "Toggle build time dependencies"
|
||||
# END Options
|
||||
#########################
|
||||
|
||||
|
||||
104
share/completions/equery.fish
Normal file
104
share/completions/equery.fish
Normal file
@@ -0,0 +1,104 @@
|
||||
# Completions for Gentoo's equery tool
|
||||
|
||||
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
||||
|
||||
function __fish_equery_print_installed_pkgs -d (N_ 'Prints completions for installed packages on the system from /var/db/pkg')
|
||||
if test -d /var/db/pkg
|
||||
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_equery_print_all_pkgs -d (N_ 'Prints completions for all available packages on the system from /usr/portage')
|
||||
if test -d /usr/portage
|
||||
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_equery_print_all_categories -d (N_ 'Prints completions for all available categories on the system from /usr/portage')
|
||||
if test -d /usr/portage
|
||||
find /usr/portage/ -maxdepth 1 -type d | cut -d'/' -f4 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
#########################################################################
|
||||
# Global Opts
|
||||
complete -c equery -s q -l quit -d "causes minimal output to be emitted"
|
||||
complete -c equery -s C -l nocolor -d "turns off colours"
|
||||
complete -c equery -s h -l help -d "displays a help summary"
|
||||
complete -c equery -s V -l version -d "displays the equery version"
|
||||
complete -c equery -s N -l no-pipe -d "turns off pipe detection"
|
||||
# END Global Opts
|
||||
#########################################################################
|
||||
|
||||
#########################################################################
|
||||
# Subcommands
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'belongs\t"'(_ "list all packages owning file(s)")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'check\t"'(_ "check MD5sums and timestamps of package")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'depends\t"'(_ "list all packages depending on specified package")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'depgraph\t"'(_ "display a dependency tree for package")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'files\t"'(_ "list files owned by package")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'hasuse\t"'(_ "list all packages with specified useflag")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'list\t"'(_ "list all packages matching pattern")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'size\t"'(_ "print size of files contained in package")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'uses\t"'(_ "display USE flags for package")'"'
|
||||
complete -c equery -n '__fish_use_subcommand' -xa 'which\t"'(_ "print full path to ebuild for package")'"'
|
||||
# END Subcommands
|
||||
#########################################################################
|
||||
|
||||
#########################################################################
|
||||
# Local opts
|
||||
# belongs
|
||||
complete -c equery -n '__fish_seen_subcommand_from belongs' -s c -l category -xa '(__fish_equery_print_all_categories)' -d "only search in given category"
|
||||
complete -c equery -n '__fish_seen_subcommand_from belongs' -s f -l full-regex -d "supplied query is a regex"
|
||||
complete -c equery -n '__fish_seen_subcommand_from belongs' -s e -l earlyout -d "stop when first match found"
|
||||
|
||||
# depends
|
||||
complete -c equery -n '__fish_seen_subcommand_from depends' -s a -l all-packages -d "search in all available packages (slow)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from depends' -s d -l direct -d "search direct dependencies only (default)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from depends' -s D -l indirect -d "search indirect dependencies (very slow)"
|
||||
|
||||
# depgraph
|
||||
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s U -l no-useflags -d "do not show USE flags"
|
||||
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s l -l linear -d "do not use fancy formatting"
|
||||
|
||||
# files
|
||||
complete -c equery -n '__fish_seen_subcommand_from files' -l timestamp -d "output the timestamp of each file"
|
||||
complete -c equery -n '__fish_seen_subcommand_from files' -l md5sum -d "output the md5sum of each file"
|
||||
complete -c equery -n '__fish_seen_subcommand_from files' -l type -d "output the type of each file"
|
||||
complete -c equery -n '__fish_seen_subcommand_from files' -l filter -xa "dir obj sym dev fifo path conf cmd doc man info" -d "filter output based on files type or path (comma separated list)"
|
||||
|
||||
# hasuse
|
||||
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s i -l installed -d "search installed packages (default)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s I -l exclude-installed -d "do not search installed packages"
|
||||
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s p -l portage-tree -d "also search in portage tree (/usr/portage)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s o -l overlay-tree -d "also search in overlay tree (/usr/local/portage)"
|
||||
|
||||
# list
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s i -l installed -d "search installed packages (default)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s I -l exclude-installed -d "do not search installed packages"
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s p -l portage-tree -d "also search in portage tree (/usr/portage)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s o -l overlay-tree -d "also search in overlay tree (/usr/local/portage)"
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s f -l full-regex -d "query is a regular expression"
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s e -l exact-name -d "list only those packages that exactly match"
|
||||
complete -c equery -n '__fish_seen_subcommand_from list' -s d -l duplicates -d "only list installed duplicate packages"
|
||||
|
||||
# size
|
||||
complete -c equery -n '__fish_seen_subcommand_from size' -s b -l bytes -d "report size in bytes"
|
||||
|
||||
# uses
|
||||
complete -c equery -n '__fish_seen_subcommand_from uses' -s a -l all -d "include non-installed packages"
|
||||
# END Local opts
|
||||
#########################################################################
|
||||
|
||||
#########################################################################
|
||||
# Arguments
|
||||
# Commands applied to a package which doesn't need to be installed
|
||||
complete -c equery -n '__fish_seen_subcommand_from depends depgraph hasuse which' -xa '(__fish_equery_print_all_pkgs)'
|
||||
|
||||
# Commands applied to a package which has to be installed
|
||||
complete -c equery -n '__fish_seen_subcommand_from check files uses size' -xa '(__fish_equery_print_installed_pkgs)'
|
||||
# END Arguments
|
||||
#########################################################################
|
||||
3
share/completions/ps2pdf.fish
Normal file
3
share/completions/ps2pdf.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
complete -c ps2pdf -x -a "(
|
||||
__fish_complete_suffix (commandline -ct) .ps 'PostScript file'
|
||||
)"
|
||||
@@ -1,3 +1,7 @@
|
||||
|
||||
# Peek inside of archives and list all files
|
||||
complete -c tar -a "(__fish_complete_tar)"
|
||||
|
||||
complete -c tar -s A -l catenate -d (N_ "Append archive to archive")
|
||||
complete -c tar -l concatenate -d (N_ "Append archive to archive")
|
||||
complete -c tar -s c -l create -d (N_ "Create archive")
|
||||
|
||||
15
share/completions/unrar.fish
Normal file
15
share/completions/unrar.fish
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
# Peek inside of archives and list all files
|
||||
complete -c unrar -a "(__fish_complete_unrar)"
|
||||
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a e -d (N_ "Extract files to current directory")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a l -d (N_ "List archive" )
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a lt -d (N_ "List archive (technical)" )
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a lb -d (N_ "List archive (bare)" )
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a p -d (N_ "Print file to stdout")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a t -d (N_ "Test archive files")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a v -d (N_ "Verbosely list archive")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a vt -d (N_ "Verbosely list archive (technical)")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a vb -d (N_ "Verbosely list archive (bare)")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a x -d (N_ "Extract files with full path")
|
||||
|
||||
17
share/completions/update-eix-remote.fish
Normal file
17
share/completions/update-eix-remote.fish
Normal file
@@ -0,0 +1,17 @@
|
||||
# Completions for the eix tool's update-eix-remote command
|
||||
# http://dev.croup.de/proj/eix and http://sourceforge.net/projects/eix/
|
||||
|
||||
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
||||
|
||||
##########
|
||||
# UPDATE-EIX-REMOTE
|
||||
#####
|
||||
# Options
|
||||
complete -c update-eix-remote -s q -d "Be quiet"
|
||||
complete -c update-eix-remote -s v -d "Be verbose (default)"
|
||||
complete -c update-eix-remote -s u -xua '(__fish_print_users)' -d "Call wget as the given USER"
|
||||
complete -c update-eix-remote -s o -d "Use the given PATH as $OVERLAYPARENT"
|
||||
#####
|
||||
# Subcommands
|
||||
complete -c update-eix-remote -xa 'update\t"'(_ "Fetch the eix-caches of some layman overlays into a temporary file resp. into FILE and add them to the eix database")'" fetch\t"'(_ "Only fetch the overlays into FILE")'" add\t"'(_ "Only add the overlays from FILE to the eix database")'" remove\t"'(_ "Remove all temporarily added virtual overlays from the eix database")'"'
|
||||
##########
|
||||
17
share/completions/update-eix.fish
Normal file
17
share/completions/update-eix.fish
Normal file
@@ -0,0 +1,17 @@
|
||||
# Completions for the eix tool's update-eix command
|
||||
# http://dev.croup.de/proj/eix and http://sourceforge.net/projects/eix/
|
||||
|
||||
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
||||
|
||||
##########
|
||||
# UPDATE-EIX
|
||||
complete -c update-eix -s h -l help -d "Show a short help screen"
|
||||
complete -c update-eix -s V -l version -d "Show version string"
|
||||
complete -c update-eix -l dump -d "Show eixrc-variables"
|
||||
complete -c update-eix -l dump-defaults -d "Show default eixrc-variables"
|
||||
complete -c update-eix -s q -l quiet -d "Produce no output"
|
||||
complete -c update-eix -s o -l output -d "Output to the given file"
|
||||
complete -c update-eix -s x -l exclude-overlay -d "Exclude the given overlay from the update-process"
|
||||
complete -c update-eix -s a -l add-overlay -d "Add the given overlay to the update-process"
|
||||
complete -c update-eix -s m -l override-method -d "Override cache method for a specified overlay"
|
||||
##########
|
||||
@@ -75,8 +75,9 @@ if not set -q fish_greeting
|
||||
set -U fish_greeting $line1\n$line2
|
||||
end
|
||||
|
||||
echo $fish_greeting
|
||||
|
||||
if test "$fish_greeting"
|
||||
echo $fish_greeting
|
||||
end
|
||||
|
||||
#
|
||||
# Set exit message
|
||||
@@ -95,7 +96,7 @@ end
|
||||
# by including them when found.
|
||||
#
|
||||
|
||||
for i in ~/$config_dir/fish/fish_inputrc @sysconfdir@/fish/fish_inputrc ~/.inputrc /etc/inputrc
|
||||
for i in $configdir/fish/fish_inputrc @sysconfdir@/fish/fish_inputrc ~/.inputrc /etc/inputrc
|
||||
if test -f $i
|
||||
set -xg INPUTRC $i
|
||||
break
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
# Test if we are using GNU ls
|
||||
|
||||
function __fish_complete_ls -d "Compleletions for ls and it's aliases"
|
||||
function __fish_complete_ls -d "Compleletions for ls and its aliases"
|
||||
|
||||
set -l is_gnu
|
||||
command ls --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
|
||||
@@ -44,8 +44,13 @@ function __fish_complete_ls -d "Compleletions for ls and it's aliases"
|
||||
|
||||
if test -n "$is_gnu"
|
||||
|
||||
# GNU specific features
|
||||
# GNU specific ls switches
|
||||
|
||||
complete $cmds -l hide -d (N_ "Do not list implied entries matching specified shell pattern") -r
|
||||
complete $cmds -l lcontext -d (N_ "Display security context")
|
||||
complete $cmds -l context -s Z -d (N_ "Display security context so it fits on most displays")
|
||||
complete $cmds -l scontext -d (N_ "Display only security context and file name")
|
||||
|
||||
complete $cmds -l author -d (N_ "Print author")
|
||||
complete $cmds -l blocksize -x -d (N_ "Set block size")
|
||||
complete $cmds -s B -l ignore-backups -d (N_ "Ignore files ending with ~")
|
||||
|
||||
35
share/functions/__fish_complete_tar.fish
Normal file
35
share/functions/__fish_complete_tar.fish
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
function __fish_complete_tar -d "Peek inside of archives and list all files"
|
||||
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
|
||||
case '*.tar.bz' '*.tar.bz2' '*.tbz' '*.tbz2'
|
||||
if test -f $i
|
||||
set -l file_list (tar -jt <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
|
||||
case '*.tar.gz' '*.tgz'
|
||||
if test -f $i
|
||||
set -l file_list (tar -it <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
|
||||
case '*.tar'
|
||||
if test -f $i
|
||||
set -l file_list (tar -t <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
21
share/functions/__fish_complete_unrar.fish
Normal file
21
share/functions/__fish_complete_unrar.fish
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
function __fish_complete_unrar -d "Peek inside of archives and list all files"
|
||||
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
|
||||
case '*.rar'
|
||||
if test -f $i
|
||||
set -l file_list (unrar vb $i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
function __fish_use_subcommand -d "Test if a non-switch argument has been given in the current commandline"
|
||||
set -l -- cmd (commandline -poc)
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
|
||||
22
share/functions/alias.fish
Normal file
22
share/functions/alias.fish
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
function alias -d (_ "Legacy function for creating shellscript functions using an alias-like syntax")
|
||||
set -l name
|
||||
set -l body
|
||||
switch (count $argv)
|
||||
|
||||
case 1
|
||||
set -l tmp (echo $argv|sed -e "s/\([^=]\)=/\1\n/")
|
||||
set name $tmp[1]
|
||||
set body $tmp[2]
|
||||
|
||||
case 2
|
||||
set name $argv[1]
|
||||
set body $argv[2]
|
||||
|
||||
case \*
|
||||
printf ( _ "%s: Expected one or two arguments, got %d") alias (count $argv)
|
||||
return 1
|
||||
end
|
||||
|
||||
eval "function $name; $body \$argv; end"
|
||||
end
|
||||
@@ -9,7 +9,7 @@ function delete-or-exit
|
||||
if test (commandline)
|
||||
commandline -f delete-char
|
||||
else
|
||||
exit
|
||||
exit 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -75,17 +75,15 @@ function help -d (N_ "Show help for the fish shell")
|
||||
case ""
|
||||
set fish_help_page index.html
|
||||
case "."
|
||||
set fish_help_page "builtins.html\#source"
|
||||
set fish_help_page "commands.html\#source"
|
||||
case difference
|
||||
set fish_help_page difference.html
|
||||
case globbing
|
||||
set fish_help_page "index.html\#expand"
|
||||
case (builtin -n)
|
||||
set fish_help_page "builtins.html\#$fish_help_item"
|
||||
|
||||
# This command substitution should locate all commands with
|
||||
# documentation. It's a bit of a hack, since it relies on the
|
||||
# Doxygen markup format to never change...
|
||||
# Doxygen markup format to never change.
|
||||
|
||||
case (sed -n < $__fish_help_dir/commands.html -e "s/.*<h2><a class=\"anchor\" name=\"\([^\"]*\)\">.*/\1/p")
|
||||
set fish_help_page "commands.html\#$fish_help_item"
|
||||
|
||||
2
signal.c
2
signal.c
@@ -459,7 +459,7 @@ static void handle_hup( int sig, siginfo_t *info, void *context )
|
||||
e.type=EVENT_SIGNAL;
|
||||
e.param1.signal = SIGHUP;
|
||||
e.function_name=0;
|
||||
|
||||
|
||||
if( event_get( &e, 0 ) )
|
||||
{
|
||||
default_handler( sig, 0, 0 );
|
||||
|
||||
@@ -6,13 +6,25 @@
|
||||
Override the default doxygen stylesheet to make the difference between different header levels larger
|
||||
-->
|
||||
<style type='text/css'>
|
||||
H2
|
||||
H1
|
||||
{
|
||||
font-size: 180%;
|
||||
}
|
||||
H2
|
||||
{
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
H3
|
||||
{
|
||||
padding-left:2%;
|
||||
padding-left:10%;
|
||||
font-size: 120%;
|
||||
}
|
||||
H4
|
||||
{
|
||||
padding-left:10%;
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
font-size: 90%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -305,7 +305,12 @@ static void get_desc( wchar_t *fn, string_buffer_t *sb, int is_cmd )
|
||||
const wchar_t *desc;
|
||||
|
||||
struct stat buf;
|
||||
off_t sz;
|
||||
|
||||
/*
|
||||
This is a long long, not an off_t since we really need to know
|
||||
exactly how large it is when using *printf() to output it.
|
||||
*/
|
||||
long long sz;
|
||||
wchar_t *sz_name[]=
|
||||
{
|
||||
L"kB", L"MB", L"GB", L"TB", L"PB", L"EB", L"ZB", L"YB", 0
|
||||
@@ -326,7 +331,7 @@ static void get_desc( wchar_t *fn, string_buffer_t *sb, int is_cmd )
|
||||
}
|
||||
else
|
||||
{
|
||||
sz = buf.st_size;
|
||||
sz = (long long)buf.st_size;
|
||||
}
|
||||
|
||||
desc = complete_get_desc( fn );
|
||||
|
||||
Reference in New Issue
Block a user