Compare commits

..

172 Commits

Author SHA1 Message Date
ridiculousfish
71bff26607 Merge remote-tracking branch 'upstream/master' 2012-04-18 13:21:03 -07:00
Jan Kanis
23bc10dfe6 Add stddef.h to util.c, so ptrdiff_t is defined in all environments 2012-01-31 01:38:20 +01:00
Jan Kanis
8ae00697c9 Merge branch 'merge-requests/14' 2012-01-25 01:21:14 +01:00
Jan Kanis
b0c6d891e9 reviewed merge reqest 14:
* fixed some whitespace inconsistencies
* changed variable handling in __fish_complete_subcommand_root
2012-01-25 01:14:47 +01:00
Jan Kanis
548164cd5e do not escape 'commandline' output without the -o flag 2012-01-25 00:11:00 +01:00
ridiculousfish
f12fd3707e Added a missing header for ptrdiff_t 2012-01-15 15:23:05 -08:00
ridiculousfish
8b407a32ff Fix to use proper type to compute difference between two pointers, which fixes a crash when fish is compiled LP64 2011-12-26 21:08:45 -08:00
Jan Kanis
344b9bdba3 Merge branch 'master' into merge-requests/14 2011-12-17 14:19:29 +01:00
Jan Kanis
834ea94eb9 update aptitude completions, patch by Dániel Ugra, closes Launchpad bug 238282 2011-09-25 01:24:34 +02:00
Jan Kanis
a060cc5893 uniq doesn't filter duplicates that aren't consecutive, use sort -u 2011-09-23 21:59:50 +02:00
gonchar
7ef0b3b821 *wvdial completion fixed 2011-09-23 18:40:14 +04:00
gonchar
39a2fd1717 * git rm and git status options are added
* ssh subcomand completion
* __fish_complete_subcommand now can skip variable number of tokens
2011-09-23 14:51:14 +04:00
gonchar
c66ec4df3d * __fish_complete_subcommand_root now passes arguments to
__fish_complete_subcommand

* sudo:
  - now can be completed bu group and user (-u and -g keys).
  - subcommand completion is fixed

* __fish_complete_proc.fish is added to complete killall command with
  list of running processes

* __fish_complete_tex.fish is updated with common options

* __fish_make_completion_signals.fish is added to make a list of kill
  signals for kill and killall

* completions:
 - minor filetype completions are added for djview, xpdf, mupdf, gv,
   xdvi
 - adduser is copmleted by user and group
 - dlocate and dpkg are completed by packages
 - find: -executable options is added
 - htop: options
 - funced and funcsave are completed by function names
 - ifdown and ifup are copmleted by interfaces
 - kill and killall: options, signals and processes
 - latexmk, ln, nm: options
 - lualatex and xelatex copmletions
 - sudo: -u and -g options
 - wvdial: presets
2011-09-23 12:24:21 +04:00
Jan Kanis
c25c48f763 Merge commit 'refs/merge-requests/13' of git://gitorious.org/fish-shell/fish-shell into merge-requests/13 2011-09-21 16:31:40 +02:00
Jan Kanis
5105d8d87e fixed bug where case-insensitive completion of /path\ with\ spaces/ doesn't reposition the cursor correctly 2011-09-21 15:40:45 +02:00
Mark A. Miller
35af336ff6 Fix an old, old reference to a long-gone fish function for gem.fish 2011-08-13 23:50:54 -05:00
Grissiom
157ca12d4b Merge commit 'refs/merge-requests/12' of git://gitorious.org/fish-shell/fish-shell into merge-requests/12 2011-07-28 10:06:19 +08:00
Adam Cozzette
e9d1a54983 fix: Fish may hang in Linux virtual console
I find that if I have a config.fish consisting of the following two
lines

status --job-control full
. empty.fish

where empty.fish is just an empty file in ~/.config/fish,  Fish will
hang when I attempt to log in on a virtual console (e.g. tty1). If I run
Fish within X11 or with either of those lines commented out,
everything's fine. I think the second line can be any command that cause
Fish to perform a fork().

The fix is pretty simple and just involves replacing getpid() with
getpgrp() in terminal_return_from_job in proc.c. See below for the
detailed explanation. I'm certainly no expert so I would appreciate it
if anyone else can confirm that my fix looks ok.

Here's what causes the bug as far as I can tell:

1. When I login on a virtual console,  /bin/login calls Fish. When Fish
begins executing its process group and the process group controlling the
terminal are both the pid of the /bin/login process.

2. The ". empty.fish" line causes Fish to fork a new process. The new
process creates a new process group and takes control of the terminal
under the name of that process group.

3. When the child process finishes,  the parent prcoess attempts to take
back control of the terminal by setting its controlling process group id
to be its pid.

4. Now there is a mismatch between the process group id of the Fish
shell (= the pid of the /bin/login process) and the process group id
controlling the terminal (= the pid of the Fish shell).
reader_interactive_init detects the mismatch and it thinks that it
doesn't have control of the terminal,  so it hangs as it waits for
control.

My fix just solves the problem in step 3 by having the parent process
correctly reassign control of the terminal to its process group.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2011-07-28 09:50:39 +08:00
Chris Nilsson
c8981c048f Merge commit 'refs/merge-requests/10' of git://gitorious.org/fish-shell/fish-shell into merge-requests/10 2011-07-10 16:32:44 +10:00
Andreas Raster
1ae44c6b3c still didn't work correctly, there were delimiters missing in the conditional as well 2011-06-24 02:45:05 +02:00
Andreas Raster
b2887477e3 last commits fix now also applied in the 'else' clause 2011-06-21 23:17:03 +02:00
Andreas Raster
8e2db29c9a fixed an issue when trying to complete something like 'cd /mnt/windows7/Program\ Files\ \('
fish would always spew a huge error message all over my terminal complaining about
some kind of tokenizer error, this patch fixed that
2011-06-21 17:02:49 +02:00
Shaun Reich
d38de7365a Change git-symbolic-ref to git symbolic-ref.
On my system at least (fedora 15), git-symbolic-ref is an invalid
command. Not sure if it's a BIC change from git itself, a distribution
thing, or a mistake on my end. Either way, no harm in using the
extended version. Now I get git branch status (yay).
2011-06-19 14:14:40 -04:00
Jakukyo Friel
cde6067cae minor changes on user doc 2011-02-20 02:58:11 +08:00
Christopher Nilsson
2583638f4b Merge commit 'refs/merge-requests/8' of git://gitorious.org/fish-shell/fish-shell into merge_request_8 2011-01-11 23:22:27 +11:00
Dylan Smith
11360b018f mimedb: Search all the defaults.list files rather than just the first.
The first defaults.list file found should not override all the other ones,
it just needs to be searched first.

E.g. For me (cat ~/.local/share/applications/defaults.list) returns
[Default Applications]
text/html=chromium-browser.desktop

So this should be used for text/html mimetypes, but the other defaults.list
files should be searched for other mimetypes.

I had to refactor get_filename so that it can return all the filenames, so
I changed it to append_filenames that appends all the filenames to a list
and provided a wrapper function called get_filename.
2010-12-02 23:55:45 +08:00
Grissiom
bdfc62184d fish_indent: indent "case" with the same level as "swith" 2010-12-02 23:42:48 +08:00
Grissiom
74f06d550a fish_indent: don't indent commands after a pipe
commands after a pipe tend to be at the same line of previous command.
So don't indent them.
2010-12-02 23:42:24 +08:00
James Bowlin
46986ad4c2 Use eix instead of emerge when possible
On Gentoo the eix program is MUCH faster than emerge for listing package
names.  I've left the emerge code in as a 2nd choice because not every
Gentoo system has eix installed (although they should).  Also,  the
emerge code didn't seem to produce any output on my system.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-12-02 01:33:56 +08:00
Dylan Smith
6a5d6471c5 mimedb: Search for exact mime type match in search_ini. 2010-12-02 01:19:56 +08:00
Dylan Smith
cf0850edfd mimedb: Add seperator between directory and filename in file_exists.
get_filename tried to work around this with hardcoded strings that end with
a '/', but would fail to work properly for environment variables
XDG_DATA_HOME or XDG_DATA_DIRS that don't do the same.
2010-12-02 01:16:29 +08:00
Dylan Smith
fd4ac87382 funcsave: Fixed error and help handling.
Renamed references to the previous command name of save_function to
funcsave, and returned an error after printing the help text when no
arguments are specified.
2010-12-02 01:13:51 +08:00
Dylan Smith
164144f126 default_key_bindings: Added mappings for ctrl-arrow keys.
On debian and ubuntu these control sequences are output while using
gnome-terminal and xterm.
2010-12-02 01:13:04 +08:00
Dylan Smith
f2ad4a2e8e Makefile: test for xsel directory before trying to clean it.
This avoids the users seeing ignored errors for make -C  clean.
2010-12-02 01:12:34 +08:00
Grissiom
df23913bb8 fish_indent: only output fd number when have to
The original patch is own by Dylan. I just did some cleaning and
reformating.
2010-12-01 13:05:10 +08:00
Dylan Smith
4ccf26fbcc builtin: count should not accept options, not even help
It is documented this way, but the common builtin_run function was
checking for -h or --help before even calling the builtin_count. Without
this functions like funced can't use count to check the number of
arguments before checking for -h or --help.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-26 19:00:18 +08:00
Dylan Smith
081e277fe4 builtin: read's --shell long option should require an argument
The short option -s doesn't need it and it won't be used.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-25 19:09:31 +08:00
Christopher Nilsson
dcecab384a Merge commit 'refs/merge-requests/6' of git://gitorious.org/fish-shell/fish-shell into merge_req_6 2010-11-24 22:34:29 +11:00
James Vega
4f9b07e979 Allow fish_greeting to be NULL or an array
Treat fish_greeting as a whole when show up the greeting messages. And
the user may want to set fish_greeting to an null value or an array.
This requires that the variable be quoted when used as an argument for
switch in __fish_config_interactive.

Signed-off-by: James Vega <jamessan@debian.org>
[modified the commit message]
Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-24 00:49:15 +08:00
Grissiom
9b97c55546 add test case for 364d3dbbf8 2010-11-24 00:35:56 +08:00
Dylan Smith
364d3dbbf8 exec: Don't format status returned directly from builtin function
The builtin function returns the raw status, which is not the same as
the integer return by waitpid. Therefore, the WIF macros shouldn't be
used for checking or obtaining the status.

This bug can be seen by executing (eval false). The builtin eval
function returns 1, but proc_format_status misinterprets it as a signal
by checking WIFSIGNALED, so adds 128 to the status to return 129.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-24 00:27:16 +08:00
James Vega
9f3a4d1640 Fix some spelling mistakes
Fix spelling mistakes in various bits of the documentation.

Signed-off-by: James Vega <jamessan@debian.org>
Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-23 23:50:49 +08:00
Dylan Smith
5fca92994f help.fish: Fix the sed expression to find anchors with id or name
Previously the expression only searched for anchors with a name
attribute, but doxygen 1.7.1 is producing anchors with the id attribute
instead. The sed expression allows both cases for compatibility.

I also used single quotes for the sed expression to avoid escaping
double quotes.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-23 23:37:09 +08:00
Grissiom
fefd17fe5e add test case for 6b243fbc 2010-11-23 23:05:21 +08:00
Dylan Smith
6b243fbcd3 eval: (eval false) should return an error status
This also caused (isatty < /dev/null) to return 0 since it uses eval,
and (ls | cat) to output using the classify indicator style since it
uses isatty. This is how I found the bug.

Reviewed-by: Grissiom <chaos.proton@gmail.com>
2010-11-22 19:36:42 +08:00
Dylan Smith
82f8c3834e Makefile: Provide PACKAGE_TARNAME for autoconf default docdir
docdir was previously being set to "${prefix}/share/doc/${PACKAGE_NAME}"
when it wasn't explicitely set on configuration using --docdir. Without
this appearing in the Makefile, some files silently get silently
installed directly into ${prefix}/share/doc instead within a fish
subdirectory.

I also added datarootdir to fix an autoconf warning,  since autoconf
normally would use it for the directory paths (e.g. docdir =
${datarootdir}/doc/${PACKAGE_TARNAME}). The autoconf generated configure
script has a hack to fix this, but states: "FIXME: This hack should be
removed a few years after 2.60."
2010-11-22 19:05:06 +08:00
Grissiom
e0ba91db31 Revert "use is_interactive instead of isatty to test whether we are in interactive mode"
This reverts commit ceba377ab8.
2010-11-22 08:43:21 +08:00
Grissiom
fa148bf59f break long lines 2010-11-22 08:42:57 +08:00
Christopher Nilsson
1b0ce33669 Merged changes from codemonkey and grissiom branches
Conflicts:
	kill.c
	seq.in
2010-11-12 02:07:14 +11:00
David Frascone
0cf2a1eb33 Fixed negative indices in the seq command 2010-11-05 09:34:42 -06:00
David Frascone
8a46a8ecb2 This change allows for customizing of the clipboard buffer, by supplying
a command to accept the "copy".  So, you add your clipboard buffer command
to an environment variable, and custom commands will be used for the copy
program.  Very useful when your OS is not naitively supported by fish.
2010-11-05 09:32:05 -06:00
David Frascone
4f0221bc4f Modify getopt string to force posix compliance. I forgot why I
needed this -- but -- some options were not working right.
2010-11-05 09:29:10 -06:00
David Frascone
ce08bb2ad2 The grep on the commands would sometimes output errors, causing noise and
breaking scripts.
2010-11-05 09:26:26 -06:00
David Frascone
93f797326e Optimized the result of the xsel check, so that it is cached.
It is called very often, and causes a significant performace hit.  The
availability of xsel is not likely to change during the invocation of
the shell.
2010-11-05 09:22:28 -06:00
Grissiom
ceba377ab8 use is_interactive instead of isatty to test whether we are in interactive mode 2010-10-13 04:30:23 +08:00
Grissiom
b9b6e867df check allocated memory when setting SHLVL 2010-10-08 09:38:06 +08:00
Grissiom
f47caefdb9 fix a memory allocation bug in commit 1e27024d75 2010-10-08 09:01:25 +08:00
James Buren
41ae7bccc2 silences some warnings outputted by gcc with -Wall and -Wextra 2010-10-08 08:43:57 +08:00
Grissiom
1e27024d75 accumulate SHLVL env variable at startup 2010-10-08 08:35:22 +08:00
Grissiom
6654fff377 fix null reference when erase TERM env
Way to reproduce:

> set -e TERM
fish: function contains_internal called with null value for argument a.
fish: This is a bug. If you can reproduce it,  please send a bug report
to fish-users@lists.sf.net.
fish: Backtrace:
/home/grissiom/sysroot/bin/fish(show_stackframe+0x1a) [0x43519a]
/home/grissiom/sysroot/bin/fish(contains_internal+0xce) [0x4373ee]
/home/grissiom/sysroot/bin/fish(reader_write_title+0x59) [0x424179]
/home/grissiom/sysroot/bin/fish() [0x4242d5]
/home/grissiom/sysroot/bin/fish(reader_readline+0x54) [0x425974]
/home/grissiom/sysroot/bin/fish(reader_read+0xba) [0x42742a]
/home/grissiom/sysroot/bin/fish(main+0x4be) [0x43b19e]
/lib64/libc.so.6(__libc_start_main+0xfd) [0x7fcbe0dcbb6d]
/home/grissiom/sysroot/bin/fish() [0x408c29]
2010-10-06 20:58:13 +08:00
Grissiom
89d999df72 some optimization on filling prompt_buff 2010-10-06 20:37:30 +08:00
Grissiom
a941d82be3 don't expand variables in no_exec mode
We couldn't know variables values unless execute commands, so disable
variable expansion in no_exec mode.
2010-10-06 11:37:59 +08:00
Grissiom
694cdf5ae1 update .gitignore 2010-10-05 21:14:43 +08:00
Grissiom
2bfe4afea2 add prof target 2010-10-05 02:23:18 +08:00
Grissiom
d559c3fe2e fix bug in build debug targe 2010-10-05 02:22:33 +08:00
Grissiom
27df727ca1 don't parse the options that should be passed to fish scripts
This commit makes fish_parse_opt stop at first non-option argument,
which expected as fish script name and pass the remaining argument to
that script. I also updated the test cases.
2010-10-03 11:46:26 +08:00
Grissiom
8910226d2f only count the last line of promt when caculate prompt width 2010-09-24 19:01:13 +08:00
Grissiom
04f58b1a31 ignore tmp staff in tests/ 2010-09-24 11:34:35 +08:00
Grissiom
1b9dd0c75f Merge remote branch 'origin/otherchirps-dev' 2010-09-19 14:12:30 +08:00
Grissiom
a7af415b6a call original grep in sgrep
functions/grep.fish will set the GREP_OPTIONS, which will ruin sgrep's
effort.
2010-09-19 13:56:30 +08:00
Grissiom
f8a5a59513 Revert "match the whole command for git completion"
This reverts commit d957d23d8f.
Use __fish_git_using_command to test commands and __fish_contains_opt to
test arguments.
2010-09-19 11:04:24 +08:00
Grissiom
ac3dfb3f96 don't complete file names for git checkout 2010-09-19 00:19:44 +08:00
Grissiom
d957d23d8f match the whole command for git completion 2010-09-19 00:17:53 +08:00
Grissiom
d049947801 event_fire( 0 ); => event_fire( NULL ); 2010-09-18 21:30:02 +08:00
Grissiom
21a10c3c74 use $() in Makefile var expansion 2010-09-18 21:29:05 +08:00
Grissiom
04951f8b34 reader_read( 0... => reader_read( STDIN_FILENO 2010-09-18 20:26:54 +08:00
Grissiom
c08bae6aeb configure xsel in configure phase
... and with the same arguments of fish
2010-09-18 14:31:18 +08:00
Grissiom
3aa107c4ae add XSEL_BIN var in configure.ac 2010-09-18 13:49:03 +08:00
Grissiom
e196091714 make clean should clean xsel and make distclean should delete it 2010-09-18 13:41:27 +08:00
Grissiom
d35d65cc40 use variables as xsel target 2010-09-18 13:27:34 +08:00
Grissiom
7f7b30959b don't make xsel in subshell 2010-09-18 13:14:59 +08:00
Grissiom
70322077d2 remove trialing spaces #2 2010-09-18 10:18:26 +08:00
Grissiom
f529b2e057 upgrade xsel to 1.2.0
xsel 1.0 begin to support UFT-8.
2010-09-18 10:14:14 +08:00
Grissiom
c6372a1b3f remove trailing spaces
This is done by `sed -i -e 's/[ \t]*$//' *.[c,h]`, which should not
introduce any functionality change.
2010-09-18 09:51:16 +08:00
Grissiom
41b8db063c add git submodule completion
Merged from http://github.com/weavejester/fish-git
2010-09-17 16:38:26 +08:00
Grissiom
1b16758d7e Fix cd prompt fail on the case that CDPATH have variables 2010-09-17 16:01:44 +08:00
Grissiom
51b5adc306 ignore ~ backup files 2010-09-16 13:32:18 +08:00
Grissiom
56f8993b8c ignore po/*.gmo 2010-09-16 13:31:49 +08:00
Ben Hoskings
8c4d1ca587 Added .gitignore. 2010-09-16 13:30:59 +08:00
Christopher Nilsson
ec8b3593f3 added '-c' option to the functions.txt docs. 2010-09-12 20:29:34 +10:00
Christopher Nilsson
5c9b42e260 'functions --copy': added sanity check on new function name.
Now matches function create behaviour, running the new function name through
wcsfuncname() and parser_keywords_is_reserved(), before allowing the copy.
2010-09-12 13:16:11 +10:00
Christopher Nilsson
7914c92824 replaced the functions '--rename' option with '--copy'.
Copying the function implementation was the main point. Actually removing the original isn't necessary, as that
functionality already exists (functions -e).
2010-09-09 23:48:18 +10:00
Christopher Nilsson
208be0f4d4 Adding '--rename' option to 'functions' builtin.
Aim is to allow an existing function to be renamed, allowing some basic function chaining.

Example:

> function foo
     echo Hello
  end
> foo
Hello
> functions --rename foo bar
> foo
fish: Unknown command 'foo'
> bar
Hello
> functions --rename fish_prompt old_prompt
> function fish_prompt
      printf "{Boo!}%s" (old_prompt)
  end
{Boo!}>

Note in the last case, the new fish_prompt is calling its old definition.
2010-09-08 03:31:05 +10:00
Ben Hoskings
7cfac5bb59 Fix an fprintf() type warning in set_color.c by using "%s". 2010-04-09 16:05:19 -07:00
Ben Hoskings
1bd09bfd40 Fix casting warnings in screen.c / s_update() by casting al_get() twice to convert type and then size, instead of both at once. 2010-04-09 16:05:18 -07:00
Ben Hoskings
517751f2a3 Declare write_loop() in print_help.c to fix warning (it's declared in common.h, but including that file here breaks things badly). 2010-04-09 16:05:18 -07:00
Ben Hoskings
006952c571 Fixed incompatible pointer warning in env_universal_common.c / iconv() call. 2010-04-09 16:05:18 -07:00
Ben Hoskings
7a8b7201a1 Write formatted duration to ENV_DURATION after commands that run for > 1s wall time. 2010-04-09 15:56:32 -07:00
Ben Hoskings
1157e4d7b2 Allow newlines in fish_prompt, by joining prompt_list with newlines instead of nothing in exec_prompt(). 2010-04-09 15:56:15 -07:00
Ben Hoskings
6b8e7b16f6 Reduced timeout in select_try() from 5s to 10ms. 2010-04-09 15:56:09 -07:00
axel
1eb089d722 Bump version number
darcs-hash:20090308144106-ac50b-e64db4a3009f99b3c1d206bba1781775faef671c.gz
2009-03-09 00:41:06 +10:00
axel
e50d0c18b0 Update todo list
darcs-hash:20090308142007-ac50b-22e9cc31212ff9647f75426327cdf5aff2d30f79.gz
2009-03-09 00:20:07 +10:00
axel
810d5f9548 Fix interactive job in background busy wait bug, reported by Randall D. Wald
darcs-hash:20090301021441-ac50b-a9488a9e55f545c3b8bd52aa0fb00b2b967974a8.gz
2009-03-01 12:14:41 +10:00
James Vega
e0c317dfd4 Prevent potential infinite loop
Ignore-this: 24edfe9248e1b667fcf4d8e151dd50f2

darcs-hash:20090224183601-35ec8-5e86d44c77af33376bd80485689d60c761ff17c6.gz
2009-02-25 04:36:01 +10:00
axel
d5320fb9f9 Update copyright info, minor layout changes to section about licenses in fish
darcs-hash:20090222224540-ac50b-69c4f8dd027e4672b8d25f8240c1d5f625135ad1.gz
2009-02-23 08:45:40 +10:00
axel
14c84ffbcb Check return value of a few write calls and retry on EINTR, and fix a few other warnings, mostly by printing error messages before giving up.
darcs-hash:20090222202852-ac50b-b0e79142af5b7a99e55271d4001fa252d9684a1d.gz
2009-02-23 06:28:52 +10:00
axel
f71c6f3f0e Misc documentation updates
darcs-hash:20090222191714-ac50b-fdd090aafd60f71989ef5c63aac9f876dcad93eb.gz
2009-02-23 05:17:14 +10:00
axel
6dbb9e070d Hopefully make iconv detection work on OS X with non-gnu iconv implementation
darcs-hash:20090222191649-ac50b-4f7010fdbf662b71cb7c4c99d2ae6e00c7cccb83.gz
2009-02-23 05:16:49 +10:00
axel
47ae2a05ce Don't make complete builtin complain when used in non-interactive mode, as we can always launch a debug prompt. Who are we to question why?
darcs-hash:20090222162253-ac50b-bb3c9dc1d1fa33548a2ed7b3c7c4d21d527eba47.gz
2009-02-23 02:22:53 +10:00
axel
810262118a Fix read in noninteractive mode problems reported by James Reeves
darcs-hash:20090222162206-ac50b-c293945986f75103120606a64133b59fe82c02a6.gz
2009-02-23 02:22:06 +10:00
axel
f5be301a2f Handle exit status of processes terminated by signals
darcs-hash:20090221164656-ac50b-7bcbf6cb0bb8384560fbf9bf1059480cb4089def.gz
2009-02-22 02:46:56 +10:00
axel
b1357d11b2 Pressing Control-C (or otherwise changeing the command line content through the commandline builtin) should clear the search buffer.
darcs-hash:20090221154420-ac50b-52641fb6dd6e76aebc6244211e07c0861fb3eff0.gz
2009-02-22 01:44:20 +10:00
axel
5fc42fcaff prompt_pwd broken, this fix by James Reeves
darcs-hash:20090221104759-ac50b-35f7a896d3e62cd002605d47c090c7bec992317b.gz
2009-02-21 20:47:59 +10:00
axel
c1cf6a4071 Oops, I broke recursive wildcard completion
darcs-hash:20090221104330-ac50b-ab9d487d3fc77fab32d9c49045d23b3e9124e618.gz
2009-02-21 20:43:30 +10:00
axel
972f3e121e Document rename of save_function to func_save. Pointed out by Ovchinnikov George
darcs-hash:20090218202037-ac50b-0351e8564d3274cd4fb364c07b4a3260f8a45f20.gz
2009-02-19 06:20:37 +10:00
axel
0dd8ae4843 Added faw entry on history editing, written by Beni Cherniavsky
darcs-hash:20090216211940-ac50b-4175fb2ae8ec2f5a67ac3c6a33a48bc5ac35eea2.gz
2009-02-17 07:19:40 +10:00
axel
8a93b6f26d Make xdg-version of open handle multiple files.
darcs-hash:20090216211103-ac50b-f8268e8d50a84457bb49ac3d1e982cba09dbfec6.gz
2009-02-17 07:11:03 +10:00
axel
07717a3570 Add possibility to define greeting function, suggested by Chris Miller
darcs-hash:20090216210450-ac50b-9b4f7c5bf45afaf21d51e46ff8c2b11d171fcbf2.gz
2009-02-17 07:04:50 +10:00
Nick Pilon
79784d3e18 This patch fixes a problem where prompt_pwd was printing the full path twice under OS X and probably BSDs. (Which, needless to say, made for very long prompts) The problem was that (Free?)BSD sed and GNU sed handle ? differently. For BSD sed, ? is not special unless the -E flag is specified. The {0,1} syntax should work the same way in both.
darcs-hash:20080122180340-5b666-21f1cdb835cbfa458a0f3d7344370837db962388.gz
2008-01-23 04:03:40 +10:00
terceiro
c08c313c0a adds completion for Debian's invoke-rc.d command
Ignore-this: f9ff385e3c239cedfbc9850b06822bba

darcs-hash:20090204191757-69c1e-a55c2a720fd784c7be2534feacecd5e2ebdbeecd.gz
2009-02-05 05:17:57 +10:00
terceiro
dfd70057b3 function to put current git branch on the fish prompt
Ignore-this: 841402742571f399e012514315b8e4f0

darcs-hash:20090204190358-69c1e-2ebcf761a4e55bc049ff1d5bba272d722b2d4501.gz
2009-02-05 05:03:58 +10:00
terceiro
07dec5c3ed better git completion
Ignore-this: af7fede5c1ee1d92c89d2887cbe54c0b

darcs-hash:20090204185826-69c1e-f72e06ad575efee258b392afd17255166ac4a260.gz
2009-02-05 04:58:26 +10:00
axel
1ed5decf2c Fix warnings in FATAL_EXIT macro
darcs-hash:20090204224310-ac50b-111db6c8f5b74dad0a309441063d3d7e9bf8f55d.gz
2009-02-05 08:43:10 +10:00
Isaac Dupree
9b95dda6bf fix help for open
darcs-hash:20080605192305-6c1c4-ccf59a87bf7197b5d07a33d7aaeb31638aa0aa52.gz
2008-06-06 05:23:05 +10:00
axel
41015691db Make all fish that use universal variables binaries include iconv
darcs-hash:20090203002620-ac50b-6be533cd1bf7dd043d96547b2c2f3ab4cda30e10.gz
2009-02-03 10:26:20 +10:00
axel
7e1ac2d806 Actually escape the double-star recursive wildcard char when requested. This will make sure the syntax highlighting doesn't try to perform a recursive wildcard expansion when cheching command name existance, which killed performance
darcs-hash:20090202234751-ac50b-55dfd8b52f842826b02a69d6ab51c222108c30e3.gz
2009-02-03 09:47:51 +10:00
axel
35258bf1fb Make proper autoconf test for availability of posix nan function instead of fudging with the NAN macro.
darcs-hash:20090202232049-ac50b-0176955677ff39fdd05eeefa20dca883863c34e6.gz
2009-02-03 09:20:49 +10:00
axel
72025a6a38 Make fish avoid iterating through user list when completing file part of directory starting with tilde. Also add a timeout to the directory iteration, to protect against humongously large user databases.
darcs-hash:20090202224645-ac50b-353047a73e4d6f494f470fe2ea6c4a34b486d302.gz
2009-02-03 08:46:45 +10:00
axel
05341b055b ish's current hostname completion uses ~/.ssh/known_hosts as one of its sources of information, but ~/.ssh/config may also be useful. Gather all of the 'Host' declarations from ~/.ssh/config and filter out the ones with wildcards. Signed-off-by: James Vega <jamessan@debian.org>
darcs-hash:20090202210242-ac50b-cf50070ee33ab6113e32a4d997d464ac4b1faf24.gz
2009-02-03 07:02:42 +10:00
axel
9d7224d756 Add support for completing aliases in ssh. Written by David Bronke.
darcs-hash:20090201231805-ac50b-196d4c81981efe681677fe8ca7f1cc833a4734da.gz
2009-02-02 09:18:05 +10:00
axel
33ec8b45a0 Add effectv completions, written by Stefano Sabatini.
darcs-hash:20090201225558-ac50b-5704829043880d0264e3e3908d324a39857ada16.gz
2009-02-02 08:55:58 +10:00
axel
1dc49a4062 Fix color ls detection for BSD and OS X systems. Patch by Sven Axelsson.
darcs-hash:20090201222410-ac50b-e1e02244ae950c602d3b7e67fe567920c619024b.gz
2009-02-02 08:24:10 +10:00
axel
1123467991 Fix cd function to handle empty variables correctly. Patch by Sven Axelsson.
darcs-hash:20090201222058-ac50b-31a7ee2db9f68729c21ba153e1439cbeabff84ce.gz
2009-02-02 08:20:58 +10:00
axel
4f54da3795 Fix user completion so it can handle comments in the passwd file. Patch by Sven Axelsson.
darcs-hash:20090201221921-ac50b-ef0883afe4dc68b43c1c705d49b6b5505dbf1e73.gz
2009-02-02 08:19:21 +10:00
axel
c8de3d24c8 Add netcat completions, written by James Stanley
darcs-hash:20090201160411-ac50b-43c34e2a73477cde40f15887a810a7b365ec81c4.gz
2009-02-02 02:04:11 +10:00
axel
31439ffb52 Better warning message when trying to exit with jobs running. PAtch and suggestion from Josef Spillner.
darcs-hash:20090201151601-ac50b-64bf24877419a9087f37eda2486232dfdabea9d2.gz
2009-02-02 01:16:01 +10:00
axel
9111b85437 Fixed bug with configure.ac in autotools shipped with F10. This fix comes from James Reeves.
darcs-hash:20090201140928-ac50b-952a8ba0596e3cf4f4a4a94f226fd04ec607075f.gz
2009-02-02 00:09:28 +10:00
axel
c6427c5a47 Add mimedb infinite loop bug fix from James Reeves
darcs-hash:20090201133734-ac50b-96fb4735af616094ea57ba02266188f8a7038a0c.gz
2009-02-01 23:37:34 +10:00
axel
36c3bd4e8d Switch from ARG_MAX to getting value from sysconf, glibc no longer defines the latter. This was reported from Peter Alfredsen Matthew Wesley, among other people.
darcs-hash:20090201132329-ac50b-5b9d54731c2ea2da3868fd492e68628b7684bb76.gz
2009-02-01 23:23:29 +10:00
axel
dad549afd1 Fix slightly wrong LD_FLAG in Makefile
darcs-hash:20090201125628-ac50b-3e68d7165a6c19558c7c8d7189cb75d71b4a9875.gz
2009-02-01 22:56:28 +10:00
Ori Avtalion
e73c2be216 Add missing commas, letters and \c in the documentation
darcs-hash:20080210210053-57fc3-f7e03b3fca9dff8bdc02256dfb78478b68945015.gz
2008-02-11 07:00:53 +10:00
axel
b0d324f1a7 Fix dumb error causing fish not to compile...
darcs-hash:20080204230945-ac50b-a95529cf19c473f62b6104ae138cf8b8abcbd2ec.gz
2008-02-05 09:09:45 +10:00
axel
d7396ac59f Fix bug causing flood of error messages in terminal when trying to highlight an invalid command, reported by Denilson F. de Sa.
darcs-hash:20080204230905-ac50b-0829b69835347e5875656ae735181b724f10de2a.gz
2008-02-05 09:09:05 +10:00
liljencrantz
3f439e9cd3 Add quilt completions, written by Stefano Sabatini.
darcs-hash:20080123000021-75c98-b27ae979720c55ec2219f451c50e87e79fa38cd6.gz
2008-01-23 10:00:21 +10:00
liljencrantz
0b722864c0 Make string handling a bit more solid be making sure sb_printf returns a null terminated string even on failiure.
darcs-hash:20080120022045-75c98-a47aff63ce7278148ccf027d6ee3ff93b35ee350.gz
2008-01-20 12:20:45 +10:00
liljencrantz
75e26f0f94 Add completions for various user and group adding commands. Skip addgroup, since manual page was actually for adduser, most switches weren't applicable and I was too lazy to guess which ones.
darcs-hash:20080120020816-75c98-f937df6cb6789868a1385bfc3eb48f5ddefb3c43.gz
2008-01-20 12:08:16 +10:00
liljencrantz
8cacb33347 Add completions for m4
darcs-hash:20080119150149-75c98-d8e5060ef78c6103d51e453ee4d5265f0981c4af.gz
2008-01-20 01:01:49 +10:00
liljencrantz
bf7d62fd91 Add completions for badblocks
darcs-hash:20080119145849-75c98-657a11bc69fbf625b01f84f1f6638e0d4b767228.gz
2008-01-20 00:58:49 +10:00
liljencrantz
4ac31e637d Add completions for Battle of Wesnoth
darcs-hash:20080119145414-75c98-6d8f856062ea44cf5de56bb014765a65ac26706b.gz
2008-01-20 00:54:14 +10:00
liljencrantz
0ad64ad2e4 Improve documentaion for bind builtin, clarify how to specify key sequences.
darcs-hash:20080119003820-75c98-b1f9360ddab9206a1cdf77b94ce28e9978badb53.gz
2008-01-19 10:38:20 +10:00
liljencrantz
523096e5d8 Add simple git completions by Diggory Hardy
darcs-hash:20080118160327-75c98-33e4e011de409944143aecf4f7e7aa8995687c75.gz
2008-01-19 02:03:27 +10:00
liljencrantz
0de629e009 Fix spelling in docs and add a help page for the funced builtin. These changes where suggested by Emanuele Rusconi.
darcs-hash:20080118155413-75c98-eadff877b3af3c3271b098903f80a45082111424.gz
2008-01-19 01:54:13 +10:00
liljencrantz
1f6fa1208e Search for command-not-found in PATH on startup, since older implementations place it there
darcs-hash:20080115122953-75c98-05ef8cb650a942c59dfa35aa63b25ccd49614dde.gz
2008-01-15 22:29:53 +10:00
liljencrantz
b86856b454 In prompt_pwd, if a directory name starts with a dot, include first two characters. This patch was written by Denilson F. de Sá
darcs-hash:20080116223621-75c98-46f96c9f25d5e32cd10148d35713622e6eac50d7.gz
2008-01-17 08:36:21 +10:00
liljencrantz
6598320534 Remove useless stray argument in function call
darcs-hash:20080116222628-75c98-a307fbeacdd815edcedea05930dc8b4bb064acb3.gz
2008-01-17 08:26:28 +10:00
liljencrantz
0a66dc4a31 Correct completions for the function builtin
darcs-hash:20080116222602-75c98-c1a48b4a04fe71b25c5e004a282341148a95ab6d.gz
2008-01-17 08:26:02 +10:00
liljencrantz
88a2b622df Add more documentation on events
darcs-hash:20080116222531-75c98-ef30dabc492d7883dbb620c40ef95152469057a3.gz
2008-01-17 08:25:31 +10:00
liljencrantz
e10f75483f Fix minor bug, PWD was incorrectly set on startup
darcs-hash:20080116220738-75c98-2b7c886629857540efee8f1cab9da0aa9ed8f76d.gz
2008-01-17 08:07:38 +10:00
liljencrantz
1a66fc4c5d Drop vim feature of only completing text and gzip files
darcs-hash:20080116180249-75c98-2fdff83afcb286c7cc06d3ed66089c9cc02eca20.gz
2008-01-17 04:02:49 +10:00
liljencrantz
905b792de7 Improve code comment
darcs-hash:20080116010601-75c98-fc7e940543424479bf1016cec26af619f177f5fd.gz
2008-01-16 11:06:01 +10:00
liljencrantz
804f5ab334 Add an extra input validation check
darcs-hash:20080116010548-75c98-e6f198bb1eb5a456ce830c42f061428a9c6f755d.gz
2008-01-16 11:05:48 +10:00
liljencrantz
f974c7c416 Improve error messages on failed execve calls a bit more
darcs-hash:20080116010454-75c98-883050bf00f10bdb205724d7d273f10e6f0a1065.gz
2008-01-16 11:04:54 +10:00
liljencrantz
f3b6b74568 Oops. Made a minor but important typo in previous cleanup patch. :-(
darcs-hash:20080115004050-75c98-3f7f733cca054d8685ec5df68d6467057ea5be53.gz
2008-01-15 10:40:50 +10:00
liljencrantz
ab94a397c3 Drop minor typo, add a few code comments
darcs-hash:20080114225828-75c98-f67f17d7f3148b0bcc74ea53536d52da80667e55.gz
2008-01-15 08:58:28 +10:00
liljencrantz
537ab32dd9 Add support for the Ubuntu 'command-no-found' handler, which suggests a package to install in order to get a command.
darcs-hash:20080114223124-75c98-ab1658d54086394cf13f3a6210543c0b790362c4.gz
2008-01-15 08:31:24 +10:00
liljencrantz
a2660cfb76 Handle case insensitive completions of variables better
darcs-hash:20080114010032-75c98-6e570c2b095baeb2ed2ee4d09e32f4e7d6ae47de.gz
2008-01-14 11:00:32 +10:00
liljencrantz
3743a5758b The max size of the string buffer was too small. Push it up a bit.
darcs-hash:20080114005745-75c98-1bcad5c5e81d4257eb7e96e860f8c667f9ba3267.gz
2008-01-14 10:57:45 +10:00
James Vega
e510d10c77 Fixed various spelling errors.
darcs-hash:20080113200151-35ec8-c587f020aec07a5e613068677bd3dd4f5c6189ac.gz
2008-01-14 06:01:51 +10:00
liljencrantz
f5540ff958 Add canse insensitive tilde completion
darcs-hash:20080113193221-75c98-169804fe128001f73eaee6fab28bfb99dca7c93e.gz
2008-01-14 05:32:21 +10:00
liljencrantz
c2b28063e1 Improve Doxygen documentation generation a bit
darcs-hash:20080113164924-75c98-d9762465de42750728ac6cb9364f4739a29ae376.gz
2008-01-14 02:49:24 +10:00
liljencrantz
8d2564291d Make sure fish_indent handles io erros
darcs-hash:20080113164905-75c98-b090ce79fb50a260874951525218cac65a097a6d.gz
2008-01-14 02:49:05 +10:00
liljencrantz
87db9517e9 Add lots of new code comments.
darcs-hash:20080113164747-75c98-9d0cefd27be7aef7ba60772616d9da7e6bb52912.gz
2008-01-14 02:47:47 +10:00
281 changed files with 9020 additions and 7061 deletions

33
.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
*.o
*~
Doxyfile.help
Makefile
autom4te.cache/
command_list.txt
config.h
config.h.in
config.log
config.status
configure
doc.h
doc_src/commands.hdr
doc_src/index.hdr
etc/config.fish
po/*.gmo
fish
fish.spec
fish_indent
fish_pager
fish_tests
fishd
mimedb
seq
set_color
share/config.fish
share/man/
toc.txt
user_doc/
xsel-1.2.0/
tests/*tmp.*
tests/foo.txt

3
CHANGELOG Normal file
View File

@@ -0,0 +1,3 @@
24-01-2012 Jan Kanis
* Added a changelog file
* removed unescaping if the 'commandline' builtin is called without the -o (tokenise) flag

View File

@@ -53,16 +53,6 @@ CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
# This tag can be used to specify the encoding used in the generated output.
# The encoding is not always determined by the language that is chosen,
# but also whether or not the output is meant for Windows or non-Windows users.
# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
# forces the Windows encoding (this is the default for the Windows binary),
# whereas setting the tag to NO uses a Unix-style encoding (the default for
# all platforms other than Windows).
USE_WINDOWS_ENCODING = NO
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
@@ -444,7 +434,8 @@ RECURSIVE = NO
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE =
EXCLUDE = print_help.c xdgmimealias.c xdgmimealias.h xdgmime.c xdgmimeglob.c xdgmimeglob.h xdgmime.h xdgmimeint.c xdgmimeint.h xdgmimemagic.c xdgmimemagic.h xdgmimeparent.c xdgmimeparent.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
@@ -1112,22 +1103,6 @@ DOT_PATH =
DOTFILE_DIRS =
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
# this value, doxygen will try to truncate the graph, so that it fits within
# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_WIDTH = 750
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
# this value, doxygen will try to truncate the graph, so that it fits within
# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_HEIGHT = 1024
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes that

View File

@@ -31,6 +31,8 @@
# hallucinations.
#
# Used by docdir
PACKAGE_TARNAME = @PACKAGE_TARNAME@
#
# Programs
@@ -46,6 +48,7 @@ INSTALL:=@INSTALL@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
@@ -60,7 +63,7 @@ optbindirs = @optbindirs@
#
MACROS = -DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\"
CFLAGS = @CFLAGS@ $(MACROS)
CFLAGS = @CFLAGS@ $(MACROS) $(EXTRA_CFLAGS)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LIBS@ @LDFLAGS@
LDFLAGS_FISH = ${LDFLAGS} @LIBS_FISH@ @LDFLAGS_FISH@
@@ -245,7 +248,7 @@ FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
#
SIMPLE_PROGRAMS := fish set_color mimedb fish_pager fishd fish_indent
PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL@ @SEQ_FALLBACK@
PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL_BIN@ @SEQ_FALLBACK@
#
@@ -264,6 +267,13 @@ TRANSLATIONS_SRC := $(wildcard po/*.po)
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
#
# Extra util
#
XSEL := @XSEL@
XSEL_BIN := @XSEL_BIN@
#
# Make everything needed for installing fish
#
@@ -292,9 +302,12 @@ Makefile: Makefile.in configure
#
debug:
$(MAKE) fish CFLAGS="@CFLAGS@ $(MACROS) -O0 -Wno-unused -Werror -g"
$(MAKE) all EXTRA_CFLAGS="-O0 -Wno-unused -Werror -g"
.PHONY: debug
prof:
$(MAKE) all EXTRA_CFLAGS="-pg" LDFLAGS="-pg"
.PHONY: prof
#
# User documentation, describing the features of the fish shell.
@@ -342,11 +355,8 @@ test: $(PROGRAMS) fish_tests
# Build the xsel program, which is maintained in its own tarball
#
xsel-0.9.6:
tar -xf xsel-0.9.6.tar
xsel-0.9.6/xsel: xsel-0.9.6
cd xsel-0.9.6; ./configure && make || echo "Failed to build xsel - either add the required dependencies or use './configure --without-xsel' to disable it."
$(XSEL_BIN):
$(MAKE) -C $(XSEL) || echo "Failed to build xsel - either add the required dependencies or use './configure --without-xsel' to disable it."
#
@@ -749,7 +759,7 @@ fish_indent: $(FISH_INDENT_OBJS)
#
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o $(LDFLAGS_FISH) -o $@
#
@@ -857,6 +867,7 @@ distclean: clean
rm -f fish.spec Doxyfile.help
rm -f etc/config.fish seq share/config.fish
rm -f config.status config.log config.h Makefile
rm -rf $(XSEL)
.PHONY: distclean
@@ -875,8 +886,8 @@ clean:
rm -f fish-@PACKAGE_VERSION@.tar.bz2
rm -rf doc;
rm -rf fish-@PACKAGE_VERSION@
rm -rf xsel-0.9.6/
rm -f $(TRANSLATIONS)
test ! -d "$(XSEL)" || make -C $(XSEL) clean
.PHONY: clean

160
builtin.c
View File

@@ -407,6 +407,9 @@ static void builtin_missing_argument( const wchar_t *cmd, const wchar_t *opt )
#include "builtin_ulimit.c"
#include "builtin_jobs.c"
/**
List all current key bindings
*/
static void builtin_bind_list()
{
array_list_t lst;
@@ -442,6 +445,13 @@ static void builtin_bind_list()
al_destroy( &lst );
}
/**
Print terminfo key binding names to string buffer used for standard output.
\param all if set, all terminfo key binding names will be
printed. If not set, only ones that are defined for this terminal
are printed.
*/
static void builtin_bind_key_names( int all )
{
array_list_t lst;
@@ -460,6 +470,10 @@ static void builtin_bind_key_names( int all )
al_destroy( &lst );
}
/**
Print all the special key binding functions to string buffer used for standard output.
*/
static void builtin_bind_function_names()
{
array_list_t lst;
@@ -478,6 +492,9 @@ static void builtin_bind_function_names()
al_destroy( &lst );
}
/**
Add specified key binding.
*/
static int builtin_bind_add( wchar_t *seq, wchar_t *cmd, int terminfo )
{
@@ -526,6 +543,12 @@ static int builtin_bind_add( wchar_t *seq, wchar_t *cmd, int terminfo )
}
/**
Erase specified key bindings
\param seq an array of all key bindings to erase
\param all if specified, _all_ key bindings will be erased
*/
static void builtin_bind_erase( wchar_t **seq, int all )
{
if( all )
@@ -579,7 +602,7 @@ static int builtin_bind( wchar_t **argv )
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -750,7 +773,7 @@ static int builtin_block( wchar_t **argv )
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -902,7 +925,7 @@ static int builtin_builtin( wchar_t **argv )
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -983,14 +1006,16 @@ static int builtin_builtin( wchar_t **argv )
return STATUS_BUILTIN_OK;
}
/**
Implementation of the builtin emit command, used to create events.
*/
static int builtin_emit( wchar_t **argv )
{
int argc=builtin_count_args( argv );
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -1061,7 +1086,7 @@ static int builtin_generic( wchar_t **argv )
int argc=builtin_count_args( argv );
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -1227,10 +1252,11 @@ static int builtin_functions( wchar_t **argv )
int show_hidden=0;
int res = STATUS_BUILTIN_OK;
int query = 0;
int copy = 0;
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -1257,6 +1283,10 @@ static int builtin_functions( wchar_t **argv )
L"query", no_argument, 0, 'q'
}
,
{
L"copy", no_argument, 0, 'c'
}
,
{
0, 0, 0, 0
}
@@ -1269,7 +1299,7 @@ static int builtin_functions( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
L"ed:nahq",
L"ed:nahqc",
long_options,
&opt_index );
if( opt == -1 )
@@ -1313,6 +1343,10 @@ static int builtin_functions( wchar_t **argv )
query = 1;
break;
case 'c':
copy = 1;
break;
case '?':
builtin_unknown_option( argv[0], argv[woptind-1] );
return STATUS_BUILTIN_ERROR;
@@ -1322,9 +1356,9 @@ static int builtin_functions( wchar_t **argv )
}
/*
Erase, desc, query and list are mutually exclusive
Erase, desc, query, copy and list are mutually exclusive
*/
if( (erase + (!!desc) + list + query) > 1 )
if( (erase + (!!desc) + list + query + copy) > 1 )
{
sb_printf( sb_err,
_( L"%ls: Invalid combination of options\n" ),
@@ -1409,6 +1443,61 @@ static int builtin_functions( wchar_t **argv )
al_destroy( &names );
return STATUS_BUILTIN_OK;
}
else if( copy )
{
wchar_t *current_func;
wchar_t *new_func;
if( argc-woptind != 2 )
{
sb_printf( sb_err,
_( L"%ls: Expected exactly two names (current function name, and new function name)\n" ),
argv[0] );
builtin_print_help ( argv[0], sb_err );
return STATUS_BUILTIN_ERROR;
}
current_func = argv[woptind];
new_func = argv[woptind+1];
if( !function_exists( current_func ) )
{
sb_printf( sb_err,
_( L"%ls: Function '%ls' does not exist\n" ),
argv[0],
current_func );
builtin_print_help( argv[0], sb_err );
return STATUS_BUILTIN_ERROR;
}
if( (wcsfuncname( new_func ) != 0) || parser_keywords_is_reserved( new_func ) )
{
sb_printf( sb_err,
_( L"%ls: Illegal function name '%ls'\n"),
argv[0],
new_func );
builtin_print_help( argv[0], sb_err );
return STATUS_BUILTIN_ERROR;
}
// keep things simple: don't allow existing names to be copy targets.
if( function_exists( new_func ) )
{
sb_printf( sb_err,
_( L"%ls: Function '%ls' already exists. Cannot create copy '%ls'\n" ),
argv[0],
new_func,
current_func );
builtin_print_help( argv[0], sb_err );
return STATUS_BUILTIN_ERROR;
}
if( function_copy( current_func, new_func ) )
return STATUS_BUILTIN_OK;
return STATUS_BUILTIN_ERROR;
}
for( i=woptind; i<argc; i++ )
{
@@ -1451,7 +1540,7 @@ static int builtin_function( wchar_t **argv )
parser_push_block( FUNCTION_DEF );
events=al_halloc( current_block );
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -1822,7 +1911,7 @@ static int builtin_random( wchar_t **argv )
woptind=0;
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -1945,7 +2034,7 @@ static int builtin_read( wchar_t **argv )
while( 1 )
{
const static struct woption
static const struct woption
long_options[] =
{
{
@@ -1981,7 +2070,7 @@ static int builtin_read( wchar_t **argv )
}
,
{
L"shell", required_argument, 0, 's'
L"shell", no_argument, 0, 's'
}
,
{
@@ -2133,6 +2222,8 @@ static int builtin_read( wchar_t **argv )
reader_set_buffer( commandline, wcslen( commandline ) );
proc_push_interactive( 1 );
event_fire_generic(L"fish_prompt");
line = reader_readline( );
proc_pop_interactive();
if( line )
@@ -2529,23 +2620,6 @@ static int builtin_exit( wchar_t **argv )
return ec;
}
/**
Helper function for builtin_cd, used for seting the current working
directory
*/
static int set_pwd( wchar_t *env)
{
wchar_t dir_path[4096];
wchar_t *res = wgetcwd( dir_path, 4096 );
if( !res )
{
builtin_wperror( L"wgetcwd" );
return STATUS_BUILTIN_OK;
}
env_set( env, dir_path, ENV_EXPORT | ENV_GLOBAL );
return 1;
}
/**
The cd builtin. Changes the current directory to the one specified
or to $HOME if none is specified. The directory can be relative to
@@ -2649,7 +2723,7 @@ static int builtin_cd( wchar_t **argv )
res = 1;
}
else if( !set_pwd(L"PWD") )
else if( !env_set_pwd() )
{
res=1;
sb_printf( sb_err, _( L"%ls: Could not set PWD variable\n" ), argv[0] );
@@ -2660,7 +2734,10 @@ static int builtin_cd( wchar_t **argv )
return res;
}
/**
Implementation of the builtin count command, used to count the
number of arguments sent to it.
*/
static int builtin_count( wchar_t ** argv )
{
int argc;
@@ -2669,6 +2746,10 @@ static int builtin_count( wchar_t ** argv )
return !(argc-1);
}
/**
Implementation of the builtin contains command, used to check if a
specified string is part of a list.
*/
static int builtin_contains( wchar_t ** argv )
{
int argc;
@@ -2832,7 +2913,7 @@ static int builtin_source( wchar_t ** argv )
sb_printf( sb_err,
_( L"%ls: Error while reading file '%ls'\n" ),
argv[0],
fn_intern == L"-" ? L"<stdin>" : fn_intern );
fn_intern == intern_static(L"-") ? L"<stdin>" : fn_intern );
}
else
{
@@ -3408,11 +3489,16 @@ static int builtin_break_continue( wchar_t **argv )
return STATUS_BUILTIN_OK;
}
/**
Implementation of the builtin count command, used to launch the
interactive debugger.
*/
static int builtin_breakpoint( wchar_t **argv )
{
parser_push_block( BREAKPOINT );
reader_read( 0, real_io );
reader_read( STDIN_FILENO, real_io );
parser_pop_block();
@@ -3573,7 +3659,7 @@ static int builtin_case( wchar_t **argv )
/**
Data about all the builtin commands in fish
*/
const static builtin_data_t builtin_data[]=
static const builtin_data_t builtin_data[]=
{
{
L"block", &builtin_block, N_( L"Temporarily block delivery of events" )
@@ -3785,7 +3871,7 @@ static int internal_help( wchar_t *cmd )
{
CHECK( cmd, 0 );
return contains( cmd, L"for", L"while", L"function",
L"if", L"end", L"switch" );
L"if", L"end", L"switch", L"count" );
}

View File

@@ -129,6 +129,7 @@ int builtin_exists( wchar_t *cmd );
of the builtin. The list is terminated by a
null pointer. This syntax resembles the syntax
for exec.
\param io the io redirections to perform on this builtin.
\return the exit status of the builtin command
*/

View File

@@ -52,7 +52,15 @@ enum
}
;
/**
Pointer to what the commandline builtin considers to be the current
contents of the command line buffer.
*/
static wchar_t *current_buffer=0;
/**
What the commandline builtin considers to be the current cursor
position.
*/
static int current_cursor_pos = -1;
/**
@@ -180,7 +188,7 @@ static void write_part( const wchar_t *begin,
}
else
{
wchar_t *buff, *esc;
wchar_t *buff;
if( cut_at_cursor )
{
@@ -188,14 +196,12 @@ static void write_part( const wchar_t *begin,
}
buff = wcsndup( begin, end-begin );
esc = unescape( buff, UNESCAPE_INCOMPLETE );
// debug( 0, L"woot2 %ls -> %ls", buff, esc );
sb_append( sb_out, esc );
sb_append( sb_out, buff );
sb_append( sb_out, L"\n" );
free( esc );
free( buff );
}
@@ -259,7 +265,7 @@ static int builtin_commandline( wchar_t **argv )
while( 1 )
{
const static struct woption
static const struct woption
long_options[] =
{
{

View File

@@ -28,7 +28,7 @@ Functions used for implementing the complete builtin.
/**
Internal storage for the builtin_get_temporary_buffer() function.
*/
const static wchar_t *temporary_buffer;
static const wchar_t *temporary_buffer;
/*
builtin_complete_* are a set of rather silly looping functions that
@@ -308,11 +308,6 @@ static int builtin_complete( wchar_t **argv )
static int recursion_level=0;
if( !is_interactive_session )
{
debug( 1, _(L"%ls: Command only available in interactive sessions"), argv[0] );
}
al_init( &cmd );
al_init( &path );
sb_init( &short_opt );
@@ -325,7 +320,7 @@ static int builtin_complete( wchar_t **argv )
while( res == 0 )
{
const static struct woption
static const struct woption
long_options[] =
{
{

View File

@@ -173,7 +173,7 @@ static int builtin_jobs( wchar_t **argv )
while( 1 )
{
const static struct woption
static const struct woption
long_options[] =
{
{

View File

@@ -417,7 +417,7 @@ static int builtin_set( wchar_t **argv )
/**
Variables used for parsing the argument list
*/
const static struct woption
static const struct woption
long_options[] =
{
{

View File

@@ -49,7 +49,7 @@ struct resource_t
/**
Array of resource_t structs, describing all known resource types.
*/
const static struct resource_t resource_arr[] =
static const struct resource_t resource_arr[] =
{
{
RLIMIT_CORE, L"Maximum size of core files created", L'c', 1024
@@ -266,7 +266,7 @@ static int builtin_ulimit( wchar_t ** argv )
while( 1 )
{
const static struct woption
static const struct woption
long_options[] =
{
{

View File

@@ -578,6 +578,36 @@ int read_blocked(int fd, void *buf, size_t count)
return res;
}
ssize_t write_loop(int fd, char *buff, size_t count)
{
ssize_t out=0;
ssize_t out_cum=0;
while( 1 )
{
out = write( fd,
&buff[out_cum],
count - out_cum );
if (out == -1)
{
if( errno != EAGAIN &&
errno != EINTR )
{
return -1;
}
} else
{
out_cum += out;
}
if( out_cum >= count )
{
break;
}
}
return out_cum;
}
void debug( int level, const wchar_t *msg, ... )
{
va_list va;
@@ -702,6 +732,11 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
sb_append_char( buff, L'\n' );
}
/**
Perform string escaping of a strinng by only quoting it. Assumes
the string has already been checked for characters that can not be
escaped this way.
*/
static wchar_t *escape_simple( const wchar_t *in )
{
wchar_t *out;
@@ -1800,3 +1835,25 @@ void sb_format_size( string_buffer_t *sb,
}
}
}
double timef()
{
int time_res;
struct timeval tv;
time_res = gettimeofday(&tv, 0);
if( time_res )
{
/*
Fixme: What on earth is the correct parameter value for NaN?
The man pages and the standard helpfully state that this
parameter is implementation defined. Gcc gives a warning if
a null pointer is used. But not even all mighty Google gives
a hint to what value should actually be returned.
*/
return nan("");
}
return (double)tv.tv_sec + 0.000001*tv.tv_usec;
}

View File

@@ -40,11 +40,12 @@
*/
#define BYTE_MAX 0xffu
/*
Escape special fish syntax characters liek the semicolon
/**
Escape special fish syntax characters like the semicolon
*/
#define UNESCAPE_SPECIAL 1
/*
/**
Allow incomplete escape sequences
*/
#define UNESCAPE_INCOMPLETE 2
@@ -110,9 +111,9 @@ extern wchar_t *program_name;
*/
#define FATAL_EXIT() \
{ \
char c; \
int exit_read_count;char exit_read_buff; \
show_stackframe(); \
read( 0, &c, 1 ); \
exit_read_count=read( 0, &exit_read_buff, 1 ); \
exit( 1 ); \
} \
@@ -155,10 +156,16 @@ extern wchar_t *program_name;
*/
#define N_(wstr) wstr
/**
Check if the specified stringelement is a part of the specified string list
*/
#define contains( str,... ) contains_internal( str, __VA_ARGS__, (void *)0 )
/**
Concatenate all the specified strings into a single newly allocated one
*/
#define wcsdupcat( str,... ) wcsdupcat_internal( str, __VA_ARGS__, (void *)0 )
/*
/**
Print a stack trace to stderr
*/
void show_stackframe();
@@ -324,6 +331,12 @@ __sentinel int contains_internal( const wchar_t *needle, ... );
*/
int read_blocked(int fd, void *buf, size_t count);
/**
Loop a write request while failiure is non-critical. Return -1 and set errno
in case of critical error.
*/
ssize_t write_loop(int fd, char *buff, size_t count);
/**
Issue a debug message with printf-style string formating and
@@ -440,5 +453,15 @@ void bugreport();
void sb_format_size( string_buffer_t *sb,
long long sz );
/**
Return the number of seconds from the UNIX epoch, with subsecond
precision. This function uses the gettimeofday function, and will
have the same precision as that function.
If an error occurs, NAN is returned.
*/
double timef();
#endif

View File

@@ -1,6 +1,6 @@
/** \file complete.c Functions related to tab-completion.
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
*/
#include "config.h"
@@ -58,7 +58,7 @@ These functions are used for storing and retrieving tab-completion data, as well
/**
Description for ~USER completion
*/
#define COMPLETE_USER_DESC _( L"Home for %s" )
#define COMPLETE_USER_DESC _( L"Home for %ls" )
/**
Description for short variables. The value is concatenated to this description
@@ -107,6 +107,14 @@ These functions are used for storing and retrieving tab-completion data, as well
#endif
/**
The maximum amount of time that we're willing to spend doing
username tilde completion. This special limit has been coded in
because user lookup can be extremely slow in cases of a humongous
LDAP database. (Google, I'm looking at you)
*/
#define MAX_USER_LOOKUP_TIME 0.2
/**
Struct describing a completion option entry.
@@ -1662,7 +1670,7 @@ static int complete_variable( const wchar_t *whole_var,
{
sb_append_substring( &comp, whole_var, start_offset );
sb_append( &comp, name );
flags = COMPLETE_NO_CASE;
flags = COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE;
}
value = expand_escape_variable( value_unescaped );
@@ -1724,61 +1732,11 @@ static int try_complete_variable( const wchar_t *cmd,
static int try_complete_user( const wchar_t *cmd,
array_list_t *comp )
{
const wchar_t *first_char=0;
const wchar_t *p;
int mode = 0;
int res = 0;
const wchar_t *first_char=cmd;
int res=0;
double start_time = timef();
for( p=cmd; *p; p++ )
{
switch( mode )
{
/*Between parameters*/
case 0:
switch( *p )
{
case L'\"':
mode=2;
p++;
first_char = p;
break;
case L' ':
case L'\t':
case L'\n':
case L'\r':
break;
default:
mode=1;
first_char = p;
}
break;
/*Inside non-quoted parameter*/
case 1:
switch( *p )
{
case L' ':
case L'\t':
case L'\n':
case L'\r':
mode = 0;
break;
}
break;
case 2:
switch( *p )
{
case L'\"':
if( *(p-1) != L'\\' )
mode =0;
break;
}
break;
}
}
if( mode != 0 )
{
if( *first_char ==L'~' )
if( *first_char ==L'~' && !wcschr(first_char, L'/'))
{
const wchar_t *user_name = first_char+1;
wchar_t *name_end = wcschr( user_name, L'~' );
@@ -1791,29 +1749,54 @@ static int try_complete_user( const wchar_t *cmd,
while((pw=getpwent()) != 0)
{
wchar_t *pw_name = str2wcs( pw->pw_name );
double current_time = timef();
wchar_t *pw_name;
if( current_time - start_time > 0.2 )
{
return 1;
}
pw_name = str2wcs( pw->pw_name );
if( pw_name )
{
if( wcsncmp( user_name, pw_name, name_len )==0 )
{
string_buffer_t desc;
string_buffer_t name;
sb_init( &name );
sb_printf( &name,
L"%ls/",
&pw_name[name_len] );
sb_init( &desc );
sb_printf( &desc,
COMPLETE_USER_DESC,
pw->pw_gecos );
pw_name );
completion_allocate( comp,
&pw_name[name_len],
(wchar_t *)desc.buff,
COMPLETE_NO_SPACE );
res=1;
sb_destroy( &desc );
}
else if( wcsncasecmp( user_name, pw_name, name_len )==0 )
{
string_buffer_t name;
string_buffer_t desc;
sb_init( &name );
sb_init( &desc );
sb_printf( &name,
L"~%ls",
pw_name );
sb_printf( &desc,
COMPLETE_USER_DESC,
pw_name );
completion_allocate( comp,
(wchar_t *)name.buff,
(wchar_t *)desc.buff,
0 );
COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE | COMPLETE_NO_SPACE );
res=1;
sb_destroy( &desc );
@@ -1826,9 +1809,9 @@ static int try_complete_user( const wchar_t *cmd,
endpwent();
}
}
}
return res;}
return res;
}

View File

@@ -94,6 +94,13 @@
*/
#define COMPLETE_AUTO_SPACE 8
/**
This completion should be inserted as-is, without escaping.
*/
#define COMPLETE_DONT_ESCAPE 16
typedef struct
{
@@ -163,7 +170,7 @@ typedef struct
\param comp A space separated list of completions which may contain subshells.
\param desc A description of the completion.
\param condition a command to be run to check it this completion should be used. If \c condition is empty, the completion is always used.
\param flags A set of completion flags
*/
void complete_add( const wchar_t *cmd,
int cmd_type,
@@ -242,7 +249,7 @@ void complete_load( const wchar_t *cmd, int reload );
Create a new completion entry
\param context The halloc context to use for allocating new memory
\pram comp The completion string
\param comp The completion string
\param desc The description of the completion
\param flags completion flags
*/

View File

@@ -9,29 +9,35 @@
# configure the build process.
#
AC_INIT(fish,1.23.0,fish-users@lists.sf.net)
AC_INIT(fish,1.23.1,fish-users@lists.sf.net)
#
# preserve configure arguments for xsel
#
conf_arg=$@
#
# List of output variables produced by this configure script
#
AC_SUBST( docdir )
AC_SUBST( HAVE_GETTEXT )
AC_SUBST( LDFLAGS_FISH )
AC_SUBST( LIBS_FISH )
AC_SUBST( LIBS_FISH_INDENT )
AC_SUBST( LIBS_FISH_PAGER )
AC_SUBST( LIBS_FISHD )
AC_SUBST( LIBS_MIMEDB )
AC_SUBST( LIBS_SET_COLOR )
AC_SUBST( localedir )
AC_SUBST( optbindirs )
AC_SUBST( prefix )
AC_SUBST( SEQ_FALLBACK )
AC_SUBST( XSEL )
AC_SUBST( XSEL_MAN )
AC_SUBST( XSEL_MAN_PATH )
AC_SUBST(docdir)
AC_SUBST(HAVE_GETTEXT)
AC_SUBST(LDFLAGS_FISH)
AC_SUBST(LIBS_FISH)
AC_SUBST(LIBS_FISH_INDENT)
AC_SUBST(LIBS_FISH_PAGER)
AC_SUBST(LIBS_FISHD)
AC_SUBST(LIBS_MIMEDB)
AC_SUBST(LIBS_SET_COLOR)
AC_SUBST(localedir)
AC_SUBST(optbindirs)
AC_SUBST(prefix)
AC_SUBST(SEQ_FALLBACK)
AC_SUBST(XSEL)
AC_SUBST(XSEL_MAN)
AC_SUBST(XSEL_BIN)
AC_SUBST(XSEL_MAN_PATH)
#
# If needed, run autoconf to regenerate the configure file
@@ -199,16 +205,18 @@ AC_ARG_WITH(
xsel,
AC_HELP_STRING(
[--without-xsel],
[do not build the xsel program needed for X clipboard integration]
[do not build the xsel program needed for X clipboard integration.
If build xsel, it will be configured with the same options as fish.]
),
[xsel=$withval],
[xsel=with_xsel]
)
if [[ "$xsel" = "with_xsel" ]]; then
XSEL=xsel-0.9.6/xsel
XSEL=xsel-1.2.0
XSEL_BIN=$XSEL/xsel
XSEL_MAN=xsel.1x
XSEL_MAN_PATH=xsel-0.9.6/xsel.1x
XSEL_MAN_PATH=$XSEL/xsel.1x
fi
@@ -505,6 +513,7 @@ LIBS=""
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
LIBS_SHARED=$LIBS
LIBS=$LIBS_COMMON
@@ -518,8 +527,10 @@ if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
# Check for libiconv_open if we can't find iconv_open. Silly OS X does
# weird macro magic for the sole purpose of amusing me.
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
LIBS_FISH=$LIBS
LIBS=$LIBS_COMMON
@@ -544,6 +555,7 @@ LIBS="$LIBS_SHARED"
if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
LIBS_FISH_PAGER=$LIBS
LIBS=$LIBS_COMMON
@@ -556,6 +568,7 @@ LIBS="$LIBS_SHARED"
if test x$local_gettext != xno; then
AC_SEARCH_LIBS( gettext, intl,,)
fi
AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
LIBS_FISHD=$LIBS
LIBS=$LIBS_COMMON
@@ -970,6 +983,12 @@ if test ! x$local_found_posix_switch = xyes; then
echo "Some fish features may be disabled."
fi
if [[ "$xsel" = "with_xsel" ]]; then
echo "Now configure xsel with $conf_arg"
rm -rf $XSEL
tar xf $XSEL.tar.gz
cd $XSEL && ./configure $conf_arg
fi
echo "fish is now configured."
echo "Use 'make' and 'make install' to build and install fish."

View File

@@ -17,7 +17,7 @@ variable.
\subsection and-example Example
The following code runs the \c make command to build a program, if the
build succceeds, the program is installed. If either step fails,
build succeeds, the program is installed. If either step fails,
<tt>make clean</tt> is run, which removes the files created by the
build process

View File

@@ -8,9 +8,15 @@
The <tt>bind</tt> builtin causes fish to add a key binding from the specified sequence.
SEQUENCE is the character sequence to bind to. Usually, one would use
fish escape sequences to express them. For example, Alt-w can be
written as <tt>\\ew</tt>, and Control-x can be written as
<tt>\\cx</tt>.
fish escape sequences to express them. For example, because pressing
the Alt key and another character sends that character prefixed with
an escape character, Alt-based key bindings can be written using the
\c \\e escape. For example, Alt-w can be written as
<tt>\\ew</tt>. Control character can be written in much the same way
using the \c \\c escape, for example Control-x can be written as
<tt>\\cx</tt>. Note that Alt-based key bindings are case sensitive and
Control base key bindings are not. This is not a design choice in
fish, it is simply how terminals work.
If SEQUENCE is the empty string, i.e. an empty set of quotes, this is
interpreted as the default keybinding. It will be used whenever no

View File

@@ -19,7 +19,7 @@ regular wildcard expansion using filenames.
Note that fish does not fall through on case statements. Though the
syntax may look a bit like C switch statements, it behaves more like
the case statementes of traditional shells.
the case statements of traditional shells.
Also note that command substitutions in a case statement will be
evaluated even if it's body is not taken. This may seem

View File

@@ -6,7 +6,7 @@
\subsection complete-description Description
For an introduction to how to specify completions, see the section <a
href='index.html#completions-own'>Writing your own completions</a> of
href='index.html#completion-own'>Writing your own completions</a> of
the fish manual.
- <tt>COMMAND</tt> is the name of the command for which to add a completion

View File

@@ -122,8 +122,8 @@ Examples:
- There should only be one type of input to the shell, lists of commands. Loops, conditionals and variable assignments are all performed through regular commands.
- The differences between builtin commands, shellscript functions and builtin commands should be made as small as possible. Builtins and shellscript functions should have exactly the same types of argument expansion as other commands, should be possible to use in any position in a pipeline, and should support any io redirection.
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping
- All blocks end with the \c end builtin
- Instead of forking when performing command substitution to provide a fake variable scope, all fish commands are performed from the same process, and fish instead supports true scoping.
- All blocks end with the \c end builtin.
\section disc The law of discoverability
@@ -147,7 +147,7 @@ until the next time she/he uses the same program.
Examples:
- Everything should be tab-completable, and every tab completion should have a description
- Everything should be tab-completable, and every tab completion should have a description.
- Every syntax error and error in a builtin command should contain an error message describing what went wrong and a relevant help page. Whenever possible, errors should be flagged red by the syntax highlighter.
- The help manual should be easy to read, easily available from the shell, complete and contain many examples
- The language should be uniform, so that once the user understands the command/argument syntax, he will know the whole language, and be able to use tab-completion to discover new featues.

View File

@@ -7,6 +7,7 @@
- <a href='#faq-default'>How do I make fish my default shell?</a>
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
- <a href='#faq-greeting'>How do I change the greeting message?</a>
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
<hr>
@@ -56,8 +57,8 @@ feature, write <code>set CDPATH .</code> on the commandline.
If fish is unable to locate a command with a given name, fish will
test if a directory of that name exists. If it does, it is implicitly
assumed that you want to change working directory. For example, the
fastest way to switch to your home directory is to simply type
<code>~</code>.
fastest way to switch to your home directory is to simply press
<code>~</code> and enter.
<hr>
@@ -92,8 +93,8 @@ In order to change your default shell, type:
You may need to adjust the above path to e.g. /usr/bin/fish. Use the command <code>which fish</code> if you are unsure of where fish is installed.
You will need to log out and back in again for the change to take
effect.
Unfortunatly, there is no way to make the changes take effect at once,
you will need to log out and back in again.
<hr>
@@ -104,7 +105,7 @@ Quick answer:
Run the following command in fish:
<pre>
echo function fish_title;end ~/.config/fish/config.fish
echo 'function fish_title;end' &gt; ~/.config/fish/config.fish
</pre>
Problem solved!
@@ -136,5 +137,25 @@ the greeting use:
set fish_greeting
</pre>
<hr>
\section faq-history Why doesn't history substitution ("!$" etc.) work?
Because history substitution is an awkward interface that was invented before
interactive line editing was even possible. Fish drops it in favor of
perfecting the interactive history recall interface. Switching requires a
small change of habits: if you want to modify an old line/word, first recall
it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then
type "sudo ".
Fish history recall is very simple yet effective:
- As in any modern shell, the Up arrow recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.
- If the line you want is far back in the history, type any part of the line and then press Up one or more times. This will constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.
- Alt+Up recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.
- If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press Alt+Up. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (Alt+D and Alt+Backspace are your friends).
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
*/

View File

@@ -1,15 +1,15 @@
\section fish_indent fish_indent - indenter and prettyfier
\section fish_indent fish_indent - indenter and prettifier
\subsection fish_indent-synopsis Synopsis
<tt>fish_indent [options]</tt>
\subsection fish_indent-description Description
\c fish_indent is used to indent or otherwise prettyfy a piece of fish
\c fish_indent is used to indent or otherwise prettify a piece of fish
code. \c fish_indent reads commands from standard input and outputs
them to standard output.
\c fish_indent underatands the following options:
\c fish_indent understands the following options:
- <tt>-h</tt> or <tt>--help</tt> displays this help message and then exits
- <tt>-i</tt> or <tt>--no-indent</tt> do not indent commands

View File

@@ -1,4 +1,4 @@
\section fish_prompt fish_prompt - define the apperance of the command line promp
\section fish_prompt fish_prompt - define the apperance of the command line prompt
\subsection fish_promt-synopsis Synopsis
<pre>function fish_prompt

9
doc_src/funced.txt Normal file
View File

@@ -0,0 +1,9 @@
\section funced funced - edit a function interactively
\subsection funced-synopsis Synopsis
<code>funced NAME</code>
\subsection funced-description Description
Use the funced command to interactively edit the definition of a
function. If there is no function with the name specified, a skeleton function is inserted, if a function exist, the definion will be shown on the command line.

12
doc_src/funcsave.txt Normal file
View File

@@ -0,0 +1,12 @@
\section funcsave funcsave - save the definition of a function to the users autoload directory
\subsection funcsave-synopsis Synopsis
<tt>funcsave FUNCTION_NAME</tt>
\subsection funcsave-description Description
funcsave is used to save the current definition of a function to
a file which will be autoloaded by current and future fish
sessions. This can be useful if you have interactively created a new
function and wish to save it for later use.

View File

@@ -6,6 +6,7 @@
\subsection function-description Description
- <code>-d DESCRIPTION</code> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description
- <code>-e</code> or <code>--on-event EVENT_NAME</code> tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
- <code>-j PID</code> or <code> --on-job-exit PID</code> tells fish to run this function when the job with group id PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
- <code>-p PID</code> or <code> --on-process-exit PID</code> tells fish to run this function when the fish child process with process id PID exits
- <code>-s</code> or <code>--on-signal SIGSPEC</code> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP)
@@ -26,6 +27,11 @@ will write <code>hello</code> whenever the user enters \c hi.
If the user enters any additional arguments after the function, they
are inserted into the environment <a href="index.html#variables-arrays">variable array</a> argv.
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href='#emit">emit</a> builtin. Fish generates the following named events:
- \c fish_prompt, which is emitted whenever a new fish prompt is about to be displayed
- \c fish_command_not_found, which is emitted whenever a command lookup failed
\subsection function-example Example
<pre>

View File

@@ -8,6 +8,7 @@
This builtin command is used to print or erase functions.
- <code>-a</code> or <code>--all</code> list all functions, even those whose name start with an underscore.
- <code>-c OLDNAME NEWNAME</code> or <code>--copy OLDNAME NEWNAME</code> creates a new function named NEWNAME, using the definition of the OLDNAME function.
- <code>-d DESCRIPTION</code> or <code>--description=DESCRIPTION</code> change the description of this function
- <code>-e</code> or <code>--erase</code> causes the specified functions to be erased.
- <code>-h</code> or <code>--help</code> display a help message and exit
@@ -23,5 +24,8 @@ Automatically loaded functions can not be removed using functions
-e. Either remove the definition file or change the
$fish_function_path variable to remove autoloaded functions.
Function copies, created with -c, will not have any event/signal/on-exit
notifications that the original may have had.
The exit status of the functions builtin is the number functions
specified in the argument list that do not exist.

View File

@@ -135,11 +135,15 @@ these characters, so called escape sequences are provided. These are:
- <code>'\\\<'</code>, escapes the less than character
- <code>'\\\>'</code>, escapes the more than character
- <code>'\\^'</code>, escapes the circumflex character
- <code>'\\&'</code>, escapes the ampersand character
- <code>'\\;'</code>, escapes the semicolon character
- <code>'\\"'</code>, escapes the quote character
- <code>'\\''</code>, escapes the apostrophe character
- <code>'\\x<i>xx</i>'</code>, where <code><i>xx</i></code> is a hexadecimal number, escapes the ascii character with the specified value. For example, \\x9 is the tab character.
- <code>'\\X<i>xx</i>'</code>, where <code><i>xx</i></code> is a hexadecimal number, escapes a byte of data with the specified value. If you are using a mutibyte encoding, this can be used to enter invalid strings. Only use this if you know what you are doing.
- <code>'\\<i>ooo</i>'</code>, where <code><i>ooo</i></code> is an octal number, escapes the ascii character with the specified value. For example, \\011 is the tab character.
- <code>'\\u<i>xxxx</i>'</code>, where <code><i>xxxx</i></code> is a hexadecimal number, escapes the 16-bit unicode character with the specified value. For example, \\u9 is the tab character.
- <code>'\\U<i>xxxxxxxx</i>'</code>, where <code><i>xxxxxxxx</i></code> is a hexadecimal number, escapes the 32-bit unicode character with the specified value. For example, \\U9 is the tab character.
- <code>'\\u<i>xxxx</i>'</code>, where <code><i>xxxx</i></code> is a hexadecimal number, escapes the 16-bit Unicode character with the specified value. For example, \\u9 is the tab character.
- <code>'\\U<i>xxxxxxxx</i>'</code>, where <code><i>xxxxxxxx</i></code> is a hexadecimal number, escapes the 32-bit Unicode character with the specified value. For example, \\U9 is the tab character.
- <code>'\\c<i>x</i>'</code>, where <code><i>x</i></code> is a letter of the alphabet, escapes the control sequence generated by pressing the control key and the specified letter. For example, \\ci is the tab character
\subsection redirects IO redirection
@@ -306,7 +310,7 @@ a filename consisting of the name of the function plus the suffix
The default value for \$fish_function_path is \c ~/.config/fish/functions
\c /etc/fish/functions \c /usr/share/fish/functions. The exact path
to the last two of these may be slighly different depending on what
to the last two of these may be slightly different depending on what
install path prefix was chosen at configuration time. The rationale
behind having three different directories is that the first one is for
user specific functions, the second one is for system-wide additional
@@ -466,11 +470,11 @@ prints a list of all user groups with the groups members as description.
<pre>__fish_complete_pids</pre>
prints a list of all procceses IDs with the command name as description.
prints a list of all processes IDs with the command name as description.
<pre>__fish_complete_suffix SUFFIX</pre>
performs file completion allowing only files ending in SUFFIX. The mimetype database is usded to find a suitable description.
performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description.
<pre>__fish_complete_users</pre>
@@ -494,7 +498,7 @@ prints a list of all known network interfaces.
<pre>__fish_print_packages</pre>
prints a list of all installed packages. This function currently handles
debian, rpm and gentoo packages.
Debian, rpm and Gentoo packages.
@@ -509,7 +513,7 @@ of the name of the command to complete and the suffix '.fish'.
The default value for \$fish_complete_path is ~/.config/fish/completions,
/etc/fish/completions and /usr/share/fish/completions. The exact
path to the last two of these may be slighly different depending on
path to the last two of these may be slightly different depending on
what install path prefix was chosen at configuration time. If a
suitable file is found in one of these directories, it will be
automatically loaded and the search will be stopped. The rationale
@@ -519,14 +523,14 @@ completions and the last one is for default fish completions.
If you have written new completions for a common
Unix command, please consider sharing your work by sending it to <a
href='mailto: fish-users@lists.sf.net'>the fish mailinglist</a>.
href='mailto: fish-users@lists.sf.net'>the fish mailing list</a>.
\section expand Parameter expansion (Globbing)
When an argument for a program is given on the commandline, it
undergoes the process of parameter expansion before it is sent on to
the command. Parameter expansion is a powerful set of mechamisms that
the command. Parameter expansion is a powerful set of mechanisms that
allow you to expand the parameter in various ways, including
performing wildcard matching on files, inserting the value of
environment variables into the parameter or even using the output of
@@ -620,9 +624,8 @@ The {$USER}san syntax might need a bit of an elaboration. Posix
shells allow you to specify a variable name using '$VARNAME' or
'${VARNAME}'. Fish supports the former, and has no support whatsoever
for the latter or anything like it. So what is '{$VARNAME}' then?
Well, '{WHATEVER}' is <a href='#brace'>brace expansion</a>, identical
to that supported by e.g. bash. 'a{b,c}d' -> 'abd acd' works
both in bash and on fish. So '{$VARNAME}' is a bracket-expansion with
Well, '{WHATEVER}' is <a href='#brace'>brace expansion</a>, e.g. 'a{b,c}d' -> 'abd acd'.
So '{$VARNAME}' is a bracket-expansion with
only a single element, i.e. it becomes expanded to '$VARNAME', which
will be variable expanded to the value of the variable 'VARNAME'. So
you might think that the brackets don't actually do anything, and that
@@ -684,7 +687,7 @@ The \% (percent) character at the beginning of a parameter followed by
a string is expanded into a process id. The following expansions are
performed:
- If the string is the entire word \c self, the shells pid is the result
- If the string is the entire word \c self, the shells pid is the result.
- Otherwise, if the string is the id of a job, the result is the process
group id of the job.
- Otherwise, if any child processes match the specified string, their
@@ -749,7 +752,7 @@ the shell through <a href="expand-variable">variable expansion</a>.
Example:
To use the value of a the variable \c smurf, write $ (dollar symbol)
To use the value of the variable \c smurf, write $ (dollar symbol)
followed by the name of the variable, like <code>echo Smurfs are
usually $smurf_color</code>, which would print the result 'Smurfs are
usually blue'.
@@ -868,7 +871,7 @@ echo $PATH[3]
</pre>
Note that array indices start at 1 in fish, not 0, as is more common
in other languages. This is because many common unix tools like seq
in other languages. This is because many common Unix tools like seq
are more suited to such use.
If you do not use any brackets, all the elements of the array will be
@@ -928,7 +931,7 @@ values of most of these variables.
- \c history, which is an array containing the last commands that where entered.
- \c HOME, which is the users home directory. This variable can only be changed by the root user.
- \c PWD, which is the current working directory.
- \c status, which is the exit status of the last foreground job to exit.
- \c status, which is the exit status of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number.
- \c USER, which is the username. This variable can only be changed by the root user.
The names of these variables are mostly derived from the csh family of
@@ -967,6 +970,8 @@ variable may also be set to a specific value:
- 126 means that while a file with the specified name was located, it was not executable
- 127 means that no function, builtin or command with the given name could be located
If a process exits through a signal, the exit status will be 128 plus the number of the signal.
\subsection variables-color Variables for changing highlighting colors
The colors used by fish for syntax highlighting can be configured by
@@ -975,7 +980,7 @@ variables can be one of the colors accepted by the <a
href='commands.html#set_color'>set_color</a> command. The \c --bold
or \c -b switches accepted by \c set_color are also accepted.
The following variables are available to change the highligting colors
The following variables are available to change the highlighting colors
in fish:
- \c fish_color_normal, the default color
@@ -1050,7 +1055,7 @@ Here are some of the commands available in the editor:
- Alt-left and Alt-right moves one word left or right, or moves forward/backward in the directory history if the commandline is empty
- Up and down search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the <a href='#history'>history </a>section for more information on history searching.
- Alt-up and Alt-down search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the <a href='#history'>history </a>section for more information on history searching.
- Delete and backspace removes one character forwards or backwards respecitvely
- Delete and backspace removes one character forwards or backwards respectively
- Ctrl-c deletes entire line
- Ctrl-d delete one character to the right of the cursor, unless the buffer is empty, in which case the shell will exit
- Ctrl-k move contents from the cursor to the end of line to the <a href="#killring">killring</a>
@@ -1140,7 +1145,7 @@ than a single line:
- Pressing the enter key while a block of commands is unclosed, i.e. when one or more block commands such as 'for', 'begin' or 'if' do not have a corresponding 'end' command.
- Pressing Alt-enter instead of pressing the enter key.
- By backslash escaping a newline, i.e. by inserting a backslash (\\) character pefore pressing the enter key.
- By backslash escaping a newline, i.e. by inserting a backslash (\\) character before pressing the enter key.
The fish commandline editor works exactly the same in single line mode
and in multiline mode. To move between lines use the left and right
@@ -1241,7 +1246,7 @@ fish_title function is executed before and after a new command is
executed or put into the foreground and the output is used as a
titlebar message. The $_ environment variable will always contain the
name of the job to be put into the foreground (Or 'fish' if control is
returning to the shell) when the fish_prompt function is called.
returning to the shell) when the \c fish_prompt function is called.
Example:
<p>
@@ -1256,6 +1261,12 @@ end
</pre>
</p>
\subsection greeting Configurable greeting
If a function named fish_greeting exists after initialization, it will
be run when entering interactive mode. Otherwise,if an environment
variable named fish_greeting exists, it will be printed.
\subsection event Event handlers
When defining a new function in fish, it is possible to make it into an
@@ -1266,6 +1277,7 @@ specific event takes place. Events that can trigger a handler currently are:
- When a process or job exits
- When the value of a variable is updated
- When the prompt is about to be shown
- When a command lookup fails
Example:
@@ -1280,9 +1292,9 @@ For more information on how to define new event handlers, see the
documentation for the <a href='commands.html#function'>function</a>
command.
\subsection debuging Debuging fish scripts
\subsection debugging Debugging fish scripts
Fish includes a built in debuger. The debuger allows you to stop
Fish includes a built in debugger. The debugger allows you to stop
execution of a script at an arbitrary point and launch a prompt. This
prompt can then be used to check or change the value of any variables
or perform any shellscript command. To resume normal execution of the
@@ -1290,15 +1302,15 @@ script, simply exit the prompt.
To start the debugger, simply call the builtin command
'breakpoint'. The default action of the TRAP signal is to call this
builtin, so a running script can be debuged by sending it the TRAP
signal. Once in the debuger, it is easy to insert new breakpoints by
builtin, so a running script can be debugged by sending it the TRAP
signal. Once in the debugger, it is easy to insert new breakpoints by
using the funced function to edit the definition of a function.
\section issues Common issues with fish
If you install fish in your home directory, fish will not work
correctly for any other user than yourself. This is because fish needs
its initalization files to function properly. To solve this
its initialization files to function properly. To solve this
problem, either copy the initialization files to each fish users home
directory, or install them in /etc.
@@ -1310,7 +1322,7 @@ making a translation. Currently, only the shell itself can be
translated, a future version of fish should also include translated
manuals.
To make a translation of fish, you will first need the sourcecode,
To make a translation of fish, you will first need the source code,
available from the <a href='http://www.fishshell.org'>fish
homepage</a>. Download the latest version, and then extract it using a
command like <code>tar -zxf fish-VERSION.tar.gz</code>.
@@ -1318,7 +1330,7 @@ command like <code>tar -zxf fish-VERSION.tar.gz</code>.
Next, cd into the newly created fish directory using <code>cd
fish-VERSION</code>.
You will now need to configure the sourcecode using the command
You will now need to configure the source code using the command
<code>./configure</code>. This step might take a while.
Before you continue, you will need to know the ISO 639 language code
@@ -1326,7 +1338,7 @@ of the language you are translating to. These codes can be found <a
href='http://www.w3.org/WAI/ER/IG/ert/iso639.htm'>here</a>. For
example, the language code for Uighur is ug.
Now you have the sourcecode and it is properly configured. Lets start
Now you have the source code and it is properly configured. Lets start
translating. To do this, first create an empty translation table for
the language you wish to translate to by writing <code>make
po/[LANGUAGE CODE].po</code> in the fish terminal. For example, if you
@@ -1346,7 +1358,7 @@ msgstr ""
</pre>
The first line is the English string to translate, the second line
should contain your translation. For example, in swedish the above
should contain your translation. For example, in Swedish the above
might become:
<pre>
@@ -1395,8 +1407,7 @@ g++, javac, java, gcj, lpr, doxygen, whois)
- Selectable completions in the pager
- Per process output redirection
- Reduce the space of the pager by one line to allow the commandline to remain visible.
- down-arrow could be used to save the current command to the history. Or give the next command in-sequnce. Or both.
- Drop support for inputrc-files. Use shellscripts and the bind builtin. Also, redo the syntax for the bind builtin to something more sane.
- down-arrow could be used to save the current command to the history. Or give the next command in-sequence. Or both.
- History could reload itself when the file is updated. This would need to be done in a clever way to avoid chain reactions
- The error function should probably be moved into it's own library, and be made mere general purpose.
- The code validation functions should be moved from the parser to parse_util.
@@ -1410,6 +1421,8 @@ g++, javac, java, gcj, lpr, doxygen, whois)
- Don't use expand_string to perform completions. wildcard_complete can be called directly, the brace expansion handling should be universal, and the process expansion can be moved to complete.c.
- Make the history search support incremental searching
- An automatic logout feature
- Make tab completions completely silent by default, i.e. kill stderr when running completion commands. This needs to be overridalbe for debugging purposes.
- Move history to an environment variable
\subsection bugs Known bugs and issues
@@ -1417,16 +1430,14 @@ g++, javac, java, gcj, lpr, doxygen, whois)
- delete-word is broken on the commandline 'sudo update-alternatives --config x-'
- Sometimes autoheader needs to be run on a fresh tarball. Fix dates before creating tarballs.
- The completion autoloader does not remember which completions where actually autoloaded, and may unload manually specified completions.
- There have been stray reports of issues with strang values of the PATH variable during startup.
- There have been stray reports of issues with strange values of the PATH variable during startup.
- bindings in config.fish are overwritten by default key bindings.
- Adding 'bind -k ...' doesn't overwrite non-keybinding binds of the same sequence.
- History file does not remove duplicates.
- History file should apply some kind of maximum history length.
- Older versions of Doxygen has bugs in the man-page generation which cause the builtin help to render incorrectly. Version 1.2.14 is known to have this problem.
If you think you have found a bug not described here, please send a
report to <a href="mailto:fish-users@lists.sf.net">fish-users@lists.sf.net</a>.
\subsection issues Known issues
Older versions of Doxygen has bugs in the man-page generation which
cause the builtin help to render incorrectly. Version 1.2.14 is known
to have this problem.
*/

View File

@@ -1,28 +1,11 @@
/** \page license Licenses
Fish Copyright (C) 2005-2006 Axel Liljencrantz. Fish is released under
<h2>License for fish</h2>
Fish Copyright (C) 2005-2009 Axel Liljencrantz. Fish is released under
the GNU General Public License, version 2. The license agreement is
included below.
Fish contains code under the BSD license, namely versions of the
two functions strlcat and strlcpy, modified for use with wide
character strings. This code is copyrighted by Todd C. Miller. The
license agreement is included below.
The XSel command, written and copyrighted by Conrad Parker, is
distributed together with, and used by fish. It is released under the MIT
license. The license agreement is included below.
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
by the mimedb command, which is a part of fish. It is released under
the LGPL. The license agreement is included below.
Fish contains code from the glibc library, namely the wcstok
function. This code is licensed under the LGPL. The license agreement
is included below.
<HR>
<H2><A NAME="SEC1" HREF="gpl.html#TOC1">GNU GENERAL PUBLIC LICENSE</A></H2>
<P>
@@ -480,6 +463,18 @@ without express or implied warranty.
<HR>
<h2>License for xdgmime and glibc</h2>
The xdgmime library, written and copyrighted by Red Hat, Inc, is used
by the mimedb command, which is a part of fish. It is released under
the LGPL, version 2 or later, or under the Academic Free License,
version 2. Version 2 of the LGPL license agreement is included below.
Fish contains code from the glibc library, namely the wcstok
function. This code is licensed under the LGPL, version 2 or
later. Version 2 of the LPGL license agreement is included below.
<H2><A NAME="SEC1" HREF="#TOC1">GNU LESSER GENERAL PUBLIC LICENSE</A></H2>
<P>

View File

@@ -1,12 +1,12 @@
\section open open - open file in it's default application
\section open open - open file in its default application
\subsection open-synopsis Synopsis
<tt>open FILES...</tt>
\subsection open-description Description
The \c open command is used to open a file in it's default application. \c open is implemented using the <a href="commands.html#mimedb">mimedb</a> command.
The \c open command is used to open a file in its default application. \c open is implemented using the \c xdg-open command if it exists, or else the <a href="commands.html#mimedb">mimedb</a> command.
\subsection open-example Example
<tt>open *.txt</tt> opens all the text files in the current directory using your systems default text editor.
<tt>open *.txt</tt> opens all the text files in the current directory using your system's default text editor.

View File

@@ -17,7 +17,7 @@ variable.
\subsection or-example Example
The following code runs the \c make command to build a program, if the
build succceeds, the program is installed. If either step fails,
build succeeds, the program is installed. If either step fails,
<tt>make clean</tt> is run, which removes the files created by the
build process

View File

@@ -1,12 +0,0 @@
\section save_function save_function - save the definition of a function to the users autoload directory
\subsection save_function-synopsis Synopsis
<tt>save_function FUNCTION_NAME</tt>
\subsection save_function-description Description
save_function is used to save the current definition of a function to
a file which will be autoloaded by current and future fish
sessions. This can be useful if you have interactively created a new
function and wish to save it for later use.

View File

@@ -28,3 +28,9 @@ result in a white font color.
Not all terminal emulators support all these features. This is not a
bug in set_color but a missing feature in the terminal emulator.
set_color uses the terminfo database to look up how to change terminal
colors on whatever terminal is in use. Some systems have old and
incomplete terminfo databases, and may lack color information for
terminals that support it. Download and install the latest version of
ncurses and recompile fish against it in order to fix this issue.

View File

@@ -14,5 +14,5 @@
- <tt>-f</tt> or <tt>--current-filename</tt> prints the filename of the currently running script
- <tt>-n</tt> or <tt>--current-line-number</tt> prints the line number of the currently running script
- <tt>-j CONTROLTYPE</tt> or <tt>--job-control=CONTROLTYPE</tt> set the job control type. Can be one of: none, full, interactive
- <tt>-t</tt> or <tt>--print-stack-trace</tt>
- <tt>-t</tt> or <tt>--print-stack-trace</tt> prints a stack trace of all function calls on the call stack
- <tt>-h</tt> or <tt>--help</tt> display a help message and exit

View File

@@ -56,7 +56,7 @@ The fish implementation of ulimit should behave identically to the
implementation in bash, except for these differences:
- Fish ulimit supports GNU-style long options for all switches
- Fish ulimit does not support the -p option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because it this method of determining pipe sixe is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
- Fish ulimit does not support the -p option for getting the pipe size. The bash implementation consists of a compile-time check that empirically guesses this number by writing to a pipe and waiting for SIGPIPE. Fish does not do this because it this method of determining pipe size is unreliable. Depending on bash version, there may also be further additional limits to set in bash that do not exist in fish.
- Fish ulimit does not support getting or setting multiple limits in one command, except reporting all values using the -a switch
\subsection ulimit-example Example

54
env.c
View File

@@ -480,6 +480,21 @@ static void setup_path()
al_destroy( &l );
}
int env_set_pwd()
{
wchar_t dir_path[4096];
wchar_t *res = wgetcwd( dir_path, 4096 );
if( !res )
{
return 0;
}
env_set( L"PWD", dir_path, ENV_EXPORT | ENV_GLOBAL );
return 1;
}
/**
Set up default values for various variables if not defined.
*/
static void env_set_defaults()
{
@@ -502,6 +517,8 @@ static void env_set_defaults()
free( unam_narrow );
}
env_set_pwd();
}
void env_init()
@@ -510,6 +527,7 @@ void env_init()
struct passwd *pw;
wchar_t *uname;
wchar_t *version;
wchar_t *shlvl;
sb_init( &dyn_var );
b_init( &export_buffer );
@@ -526,6 +544,7 @@ void env_init()
hash_put( &env_read_only, L"LINES", L"" );
hash_put( &env_read_only, L"COLUMNS", L"" );
hash_put( &env_read_only, L"PWD", L"" );
hash_put( &env_read_only, L"SHLVL", L"" );
/*
Names of all dynamically calculated variables
@@ -627,6 +646,38 @@ void env_init()
&start_fishd,
&universal_callback );
/*
Set up SHLVL variable
*/
shlvl = env_get( L"SHLVL" );
if ( shlvl )
{
wchar_t *nshlvl, **end_nshlvl;
/* add an extra space for digit dump (9+1=10) */
size_t i = wcslen( shlvl ) + 2 * sizeof(wchar_t);
nshlvl = malloc(i);
end_nshlvl = calloc( 1, sizeof(nshlvl) );
if ( !nshlvl || !end_nshlvl )
DIE_MEM();
if ( nshlvl && swprintf( nshlvl, i,
L"%ld", wcstoul( shlvl, end_nshlvl, 10 )+1 ) != -1 )
{
env_set( L"SHLVL",
nshlvl,
ENV_GLOBAL | ENV_EXPORT );
}
free( end_nshlvl );
free( nshlvl );
}
else
{
env_set( L"SHLVL",
L"1",
ENV_GLOBAL | ENV_EXPORT );
}
/*
Set correct defaults for e.g. USER and HOME variables
*/
@@ -1442,6 +1493,9 @@ static void export_func1( void *k, void *v, void *aux )
}
/**
Get list of all exported variables
*/
static void get_exported( env_node_t *n, hash_table_t *h )
{
if( !n )

7
env.h
View File

@@ -132,4 +132,11 @@ char **env_export_arr( int recalc );
*/
void env_get_names( array_list_t *l, int flags );
/**
Update the PWD variable
directory
*/
int env_set_pwd();
#endif

View File

@@ -176,8 +176,10 @@ static char *iconv_wide_names_2[]=
}
;
wchar_t *utf2wcs( const char *in )
/**
Convert utf-8 string to wide string
*/
static wchar_t *utf2wcs( const char *in )
{
iconv_t cd=(iconv_t) -1;
int i,j;
@@ -253,7 +255,7 @@ wchar_t *utf2wcs( const char *in )
return 0;
}
nconv = iconv( cd, (const char **)&in, &in_len, &nout, &out_len );
nconv = iconv( cd, (char **)&in, &in_len, &nout, &out_len );
if (nconv == (size_t) -1)
{
@@ -287,7 +289,10 @@ wchar_t *utf2wcs( const char *in )
return out;
}
char *wcs2utf( const wchar_t *in )
/**
Convert wide string to utf-8
*/
static char *wcs2utf( const wchar_t *in )
{
iconv_t cd=(iconv_t) -1;
int i,j;
@@ -404,6 +409,9 @@ void env_universal_common_destroy()
hash_destroy( &env_universal_var );
}
/**
Read one byte of date form the specified connection
*/
static int read_byte( connection_t *src )
{
@@ -740,6 +748,9 @@ void try_send_all( connection_t *c )
}
}
/**
Escape specified string
*/
static wchar_t *full_escape( const wchar_t *in )
{
string_buffer_t out;

11
event.c
View File

@@ -704,9 +704,11 @@ void event_free( event_t *e )
}
void event_fire_generic(const wchar_t *name)
void event_fire_generic_internal(const wchar_t *name, ...)
{
event_t ev;
va_list va;
wchar_t *arg;
CHECK( name, );
@@ -715,6 +717,13 @@ void event_fire_generic(const wchar_t *name)
ev.function_name=0;
al_init( &ev.arguments );
va_start( va, name );
while( (arg=va_arg(va, wchar_t *) )!= 0 )
{
al_push( &ev.arguments, arg );
}
va_end( va );
event_fire( &ev );
}

View File

@@ -164,7 +164,8 @@ const wchar_t *event_get_desc( event_t *e );
/**
Fire a generic event with the specified name
*/
void event_fire_generic(const wchar_t *name);
#define event_fire_generic( ... ) event_fire_generic_internal( __VA_ARGS__, (void *)0 )
void event_fire_generic_internal(const wchar_t *name,...);
#endif

113
exec.c
View File

@@ -53,6 +53,11 @@
*/
#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" )
/**
file descriptor redirection error message
*/
#define WRITE_ERROR _( L"An error occurred while writing output" )
/**
file redirection error message
*/
@@ -92,6 +97,18 @@ static array_list_t *open_fds=0;
static int set_child_group( job_t *j, process_t *p, int print_errors );
static void exec_write_and_exit( int fd, char *buff, size_t count, int status )
{
if( write_loop(fd, buff, count) == -1 )
{
debug( 0, WRITE_ERROR);
wperror( L"write" );
exit(status);
}
exit( status );
}
void exec_close( int fd )
{
int i;
@@ -443,6 +460,40 @@ static int setup_child_process( job_t *j, process_t *p )
}
/**
Returns the interpreter for the specified script. Returns 0 if file
is not a script with a shebang. This function leaks memory on every
call. Only use it in the execve error handler which calls exit
right afterwards, anyway.
*/
static wchar_t *get_interpreter( wchar_t *file )
{
string_buffer_t sb;
FILE *fp = wfopen( file, "r" );
sb_init( &sb );
wchar_t *res = 0;
if( fp )
{
while( 1 )
{
wint_t ch = getwc( fp );
if( ch == WEOF )
break;
if( ch == L'\n' )
break;
sb_append_char( &sb, (wchar_t)ch );
}
}
res = (wchar_t *)sb.buff;
if( !wcsncmp( L"#! /", res, 4 ) )
return res+3;
if( !wcsncmp( L"#!/", res, 3 ) )
return res+2;
return 0;
}
/**
This function is executed by the child process created by a call to
@@ -549,22 +600,22 @@ static void launch_process( process_t *p )
if( arg_max > 0 )
{
sb_format_size( &sz2, ARG_MAX );
sb_format_size( &sz2, arg_max );
debug( 0,
L"The total size of the argument and environment lists (%ls) exceeds the system limit of %ls.",
L"The total size of the argument and environment lists (%ls) exceeds the operating system limit of %ls.",
(wchar_t *)sz1.buff,
(wchar_t *)sz2.buff);
}
else
{
debug( 0,
L"The total size of the argument and environment lists (%ls) exceeds the system limit.",
L"The total size of the argument and environment lists (%ls) exceeds the operating system limit.",
(wchar_t *)sz1.buff);
}
debug( 0,
L"Please try running the command again with fewer arguments.");
L"Try running the command again with fewer arguments.");
sb_destroy( &sz1 );
sb_destroy( &sz2 );
@@ -573,9 +624,41 @@ static void launch_process( process_t *p )
break;
}
case ENOEXEC:
{
wperror(L"exec");
debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
exit(STATUS_EXEC_FAIL);
}
case ENOENT:
{
wchar_t *interpreter = get_interpreter( p->actual_cmd );
if( interpreter && waccess( interpreter, X_OK ) )
{
debug(0, L"The file '%ls' specified the interpreter '%ls', which is not an executable command.", p->actual_cmd, interpreter );
}
else
{
debug(0, L"The file '%ls' or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found.", p->actual_cmd);
}
exit(STATUS_EXEC_FAIL);
}
case ENOMEM:
{
debug(0, L"Out of memory");
exit(STATUS_EXEC_FAIL);
}
default:
{
debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
wperror(L"exec");
// debug(0, L"The file '%ls' is marked as an executable but could not be run by the operating system.", p->actual_cmd);
exit(STATUS_EXEC_FAIL);
}
}
@@ -830,6 +913,9 @@ static pid_t exec_fork()
}
/**
Perform output from builtins
*/
static void do_builtin_io( wchar_t *out, wchar_t *err )
{
@@ -1357,15 +1443,17 @@ void exec( job_t *j )
if( pid == 0 )
{
/*
This is the child process. Write out the contents of the pipeline.
*/
p->pid = getpid();
setup_child_process( j, p );
write( io_buffer->fd,
exec_write_and_exit(io_buffer->fd,
io_buffer->param2.out_buffer->buff,
io_buffer->param2.out_buffer->used );
exit( status );
io_buffer->param2.out_buffer->used,
status);
}
else
{
@@ -1411,10 +1499,10 @@ void exec( job_t *j )
p->pid = getpid();
setup_child_process( j, p );
write( 1,
exec_write_and_exit( 1,
input_redirect->param2.out_buffer->buff,
input_redirect->param2.out_buffer->used );
exit( 0 );
input_redirect->param2.out_buffer->used,
0);
}
else
{
@@ -1487,7 +1575,8 @@ void exec( job_t *j )
{
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!p->status):p->status );
int status = p->status;
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!status):status );
}
break;
}

View File

@@ -109,11 +109,11 @@ parameter expansion.
/**
Characters which make a string unclean if they are the first
character of the string. See \c is_clean().
character of the string. See \c expand_is_clean().
*/
#define UNCLEAN_FIRST L"~%"
/**
Unclean characters. See \c is_clean().
Unclean characters. See \c expand_is_clean().
*/
#define UNCLEAN L"$*?\\\"'({})"
@@ -764,7 +764,9 @@ void expand_variable_error( const wchar_t *token, int token_pos, int error_pos )
}
}
/**
Parse an array slicing specification
*/
static int parse_slice( wchar_t *in, wchar_t **end_ptr, array_list_t *idx )
{
@@ -1517,6 +1519,11 @@ static void remove_internal_separator( const void *s, int conv )
*out++ = conv?L'*':ANY_STRING;
break;
case ANY_STRING_RECURSIVE:
in++;
*out++ = conv?L'*':ANY_STRING_RECURSIVE;
break;
default:
*out++ = *in++;
}

View File

@@ -58,6 +58,10 @@
Use unencoded private-use keycodes for internal characters
*/
#define EXPAND_RESERVED 0xf000
/**
End of range reserved for expand
*/
#define EXPAND_RESERVED_END 0xf000f
enum
{

View File

@@ -1183,5 +1183,12 @@ long sysconf(int name)
return -1;
}
#endif
#ifndef HAVE_NAN
double nan(char *tagp)
{
return 0.0/0.0;
}
#endif

View File

@@ -54,9 +54,18 @@ typedef char tputs_arg_t;
#endif
#ifndef HAVE_WINSIZE
/**
Structure used to get the size of a terminal window
*/
struct winsize
{
/**
Number of rows
*/
unsigned short ws_row;
/**
Number of columns
*/
unsigned short ws_col;
}
;
@@ -400,17 +409,35 @@ extern int _nl_msg_cat_cntr;
#ifndef HAVE_KILLPG
/**
Send specified signal to specified process group.
*/
int killpg( int pgr, int sig );
#endif
#ifndef HAVE_WORKING_GETOPT_LONG
/**
Struct describing a long getopt option
*/
struct option
{
/**
Name of option
*/
const char *name;
/**
Flag
*/
int has_arg;
/**
Flag
*/
int *flag;
/**
Return value
*/
int val;
}
;
@@ -442,4 +469,9 @@ long sysconf(int name);
#endif
#ifndef HAVE_NAN
double nan(char *tagp);
#endif
#endif

13
fish.c
View File

@@ -66,7 +66,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/**
The string describing the single-character options accepted by the main fish binary
*/
#define GETOPT_STRING "hilnvc:p:d:"
#define GETOPT_STRING "+hilnvc:p:d:"
/**
Parse init files
@@ -106,10 +106,9 @@ static int read_init()
}
/*
/**
Parse the argument list, return the index of the first non-switch
arguments.
*/
static int fish_parse_opt( int argc, char **argv, char **cmd_ptr )
{
@@ -324,12 +323,12 @@ int main( int argc, char **argv )
{
if( my_optind == argc )
{
res = reader_read( 0, 0 );
res = reader_read( STDIN_FILENO, 0 );
}
else
{
char **ptr;
char *file = *(argv+1);
char *file = *(argv+(my_optind++));
int i;
string_buffer_t sb;
int fd;
@@ -341,11 +340,11 @@ int main( int argc, char **argv )
return 1;
}
if( *(argv+2))
if( *(argv+my_optind))
{
sb_init( &sb );
for( i=1,ptr = argv+2; *ptr; i++, ptr++ )
for( i=1,ptr = argv+my_optind; *ptr; i++, ptr++ )
{
if( i != 1 )
sb_append( &sb, ARRAY_SEP_STR );

View File

@@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/** \file main.c
/** \file fish_indent.c
The fish_indent proegram.
*/
@@ -48,13 +48,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define GETOPT_STRING "hvi"
void read_file( FILE *f, string_buffer_t *b )
/**
Read the entire contents of a file into the specified string_Buffer_t
*/
static void read_file( FILE *f, string_buffer_t *b )
{
while( 1 )
{
errno=0;
wint_t c = fgetwc( f );
if( c == WEOF )
{
if( errno )
{
wperror(L"fgetwc");
exit(1);
}
break;
}
@@ -62,6 +72,9 @@ void read_file( FILE *f, string_buffer_t *b )
}
}
/**
Insert the specified number of tabe into the output buffer
*/
static void insert_tabs( string_buffer_t *out, int indent )
{
int i;
@@ -73,6 +86,9 @@ static void insert_tabs( string_buffer_t *out, int indent )
}
/**
Indent the specified input
*/
static int indent( string_buffer_t *out, wchar_t *in, int flags )
{
tokenizer tok;
@@ -109,6 +125,11 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
{
indent--;
}
/* case should have the same indent level as switch*/
else if( wcscmp( unesc, L"case" ) == 0 )
{
indent--;
}
else if( wcscmp( unesc, L"end" ) == 0 )
{
indent--;
@@ -116,7 +137,7 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
}
if( do_indent && flags)
if( do_indent && flags && prev_type != TOK_PIPE )
{
insert_tabs( out, indent );
}
@@ -128,7 +149,9 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
}
else
{
sb_printf( out, L" %ls", last );
if ( prev_type != TOK_REDIRECT_FD )
sb_append( out, L" " );
sb_append( out, last );
}
break;
@@ -145,40 +168,61 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
case TOK_PIPE:
{
sb_append( out, L" | " );
sb_append( out, L" " );
if ( last[0] == '2' && !last[1] ) {
sb_append( out, L"^" );
} else if ( last[0] != '1' || last[1] ) {
sb_append( out, last, L">" );
}
sb_append( out, L"| " );
is_command = 1;
break;
}
case TOK_REDIRECT_OUT:
case TOK_REDIRECT_APPEND:
case TOK_REDIRECT_IN:
case TOK_REDIRECT_FD:
{
sb_append( out, L" " );
if ( wcscmp( last, L"2" ) == 0 ) {
sb_append( out, L"^" );
} else {
if ( wcscmp( last, L"1" ) != 0 )
sb_append( out, last );
switch( type )
{
case TOK_REDIRECT_OUT:
sb_append( out, L"> " );
sb_append( out, L">" );
}
break;
}
case TOK_REDIRECT_APPEND:
sb_append( out, L">> " );
{
sb_append( out, L" " );
if ( wcscmp( last, L"2" ) == 0 ) {
sb_append( out, L"^^" );
} else {
if ( wcscmp( last, L"1" ) != 0 )
sb_append( out, last );
sb_append( out, L">>" );
}
break;
}
case TOK_REDIRECT_IN:
sb_append( out, L"< " );
{
sb_append( out, L" " );
if ( wcscmp( last, L"0" ) != 0 )
sb_append( out, last );
sb_append( out, L"<" );
break;
}
case TOK_REDIRECT_FD:
sb_append( out, L">& " );
break;
}
{
sb_append( out, L" " );
if ( wcscmp( last, L"1" ) != 0 )
sb_append( out, last );
sb_append( out, L">&" );
break;
}
case TOK_BACKGROUND:
{
sb_append( out, L"&\n" );
@@ -187,7 +231,6 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
break;
}
case TOK_COMMENT:
{
if( do_indent && flags)
@@ -217,7 +260,12 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
return res;
}
wchar_t *trim( wchar_t *in )
/**
Remove any prefix and suffix newlines from the specified
string. Does not allocete a new string, edits the string in place
and returns a pointer somewhere into the string.
*/
static wchar_t *trim( wchar_t *in )
{
wchar_t *end;
@@ -245,7 +293,9 @@ wchar_t *trim( wchar_t *in )
}
/**
The main mathod. Run the program.
*/
int main( int argc, char **argv )
{
string_buffer_t sb_in;

View File

@@ -351,7 +351,7 @@ static int pager_buffered_writer( char c)
*/
static void pager_flush()
{
write( 1, pager_buffer->buff, pager_buffer->used );
write_loop( 1, pager_buffer->buff, pager_buffer->used );
pager_buffer->used = 0;
}

View File

@@ -750,6 +750,9 @@ static void test_expand()
}
/**
Test path functions
*/
static void test_path()
{
say( L"Testing path functions" );

View File

@@ -521,7 +521,7 @@ static void load_or_save( int save)
if( save )
{
write( c.fd, SAVE_MSG, strlen(SAVE_MSG) );
write_loop( c.fd, SAVE_MSG, strlen(SAVE_MSG) );
enqueue_all( &c );
}
else

View File

@@ -41,9 +41,9 @@
typedef struct
{
/** Function definition */
wchar_t *cmd;
wchar_t *definition;
/** Function description */
wchar_t *desc;
wchar_t *description;
/**
File where this function was defined
*/
@@ -53,6 +53,9 @@ typedef struct
*/
int definition_offset;
/**
List of all named arguments for this function
*/
array_list_t *named_arguments;
@@ -61,6 +64,10 @@ typedef struct
*/
int is_autoload;
/**
Set to non-zero if invoking this function shadows the variables
of the underlying function.
*/
int shadows;
}
function_internal_data_t;
@@ -155,6 +162,9 @@ void function_init()
&hash_wcs_cmp );
}
/**
Clear specified value, but not key
*/
static void clear_entry( void *key, void *value )
{
halloc_free( value );
@@ -180,7 +190,7 @@ void function_add( function_data_t *data )
d = halloc( 0, sizeof( function_internal_data_t ) );
d->definition_offset = parse_util_lineno( parser_get_buffer(), current_block->tok_pos )-1;
d->cmd = halloc_wcsdup( d, data->definition );
d->definition = halloc_wcsdup( d, data->definition );
if( data->named_arguments )
{
@@ -192,9 +202,9 @@ void function_add( function_data_t *data )
}
}
cmd_end = d->cmd + wcslen(d->cmd)-1;
cmd_end = d->definition + wcslen(d->definition)-1;
d->desc = data->description?halloc_wcsdup( d, data->description ):0;
d->description = data->description?halloc_wcsdup( d, data->description ):0;
d->definition_file = intern(reader_current_filename());
d->is_autoload = is_autoload;
d->shadows = data->shadows;
@@ -208,6 +218,43 @@ void function_add( function_data_t *data )
}
int function_copy( const wchar_t *name, const wchar_t *new_name )
{
int i;
function_internal_data_t *d, *orig_d;
CHECK( name, 0 );
CHECK( new_name, 0 );
orig_d = (function_internal_data_t *)hash_get(&function, name);
if( !orig_d )
return 0;
d = halloc(0, sizeof( function_internal_data_t ) );
d->definition_offset = orig_d->definition_offset;
d->definition = halloc_wcsdup( d, orig_d->definition );
if( orig_d->named_arguments )
{
d->named_arguments = al_halloc( d );
for( i=0; i<al_get_count( orig_d->named_arguments ); i++ )
{
al_push( d->named_arguments, halloc_wcsdup( d, (wchar_t *)al_get( orig_d->named_arguments, i ) ) );
}
d->description = orig_d->description?halloc_wcsdup(d, orig_d->description):0;
d->shadows = orig_d->shadows;
// This new instance of the function shouldn't be tied to the def
// file of the original.
d->definition_file = 0;
d->is_autoload = 0;
}
hash_put( &function, intern(new_name), d );
return 1;
}
int function_exists( const wchar_t *cmd )
{
@@ -266,7 +313,7 @@ const wchar_t *function_get_definition( const wchar_t *name )
data = (function_internal_data_t *)hash_get( &function, name );
if( data == 0 )
return 0;
return data->cmd;
return data->definition;
}
array_list_t *function_get_named_arguments( const wchar_t *name )
@@ -307,7 +354,7 @@ const wchar_t *function_get_desc( const wchar_t *name )
if( data == 0 )
return 0;
return _(data->desc);
return _(data->description);
}
void function_set_desc( const wchar_t *name, const wchar_t *desc )
@@ -322,7 +369,7 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc )
if( data == 0 )
return;
data->desc = halloc_wcsdup( data, desc );
data->description = halloc_wcsdup( data, desc );
}
/**
@@ -331,6 +378,10 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc )
static int al_contains_str( array_list_t *list, const wchar_t * str )
{
int i;
CHECK( list, 0 );
CHECK( str, 0 );
for( i=0; i<al_get_count( list ); i++ )
{
if( wcscmp( al_get( list, i ), str) == 0 )

View File

@@ -15,15 +15,38 @@
#include "util.h"
/**
Structure describing a function
*/
Structure describing a function. This is used by the parser to
store data on a function while parsing it. It is not used
internally to store functions, the function_internal_data_t
structure is used for that purpose. Parhaps these two should be
merged.
*/
typedef struct function_data
{
/**
Name of function
*/
wchar_t *name;
/**
Description of function
*/
wchar_t *description;
/**
Function definition
*/
wchar_t *definition;
/**
List of all event handlers for this function
*/
array_list_t *events;
/**
List of all named arguments for this function
*/
array_list_t *named_arguments;
/**
Set to non-zero if invoking this function shadows the variables
of the underlying function.
*/
int shadows;
}
function_data_t;
@@ -108,4 +131,10 @@ array_list_t *function_get_named_arguments( const wchar_t *name );
*/
int function_get_shadows( const wchar_t *name );
/**
Creates a new function using the same definition as the specified function.
Returns non-zero if copy is successful.
*/
int function_copy( const wchar_t *name, const wchar_t *new_name );
#endif

View File

@@ -78,6 +78,9 @@ typedef struct halloc
}
halloc_t;
/**
Allign the specified pointer
*/
static char *align_ptr( char *in )
{
unsigned long step = maxi(sizeof(double),sizeof(void *));
@@ -87,6 +90,9 @@ static char *align_ptr( char *in )
return (char *)long_out;
}
/**
Allign specifies size_t
*/
static size_t align_sz( size_t in )
{
size_t step = maxi(sizeof(double),sizeof(void *));

View File

@@ -530,6 +530,20 @@ static void highlight_param( const wchar_t * buff,
}
}
static int has_expand_reserved( wchar_t *str )
{
while( *str )
{
if( *str >= EXPAND_RESERVED &&
*str <= EXPAND_RESERVED_END )
{
return 1;
}
str++;
}
return 0;
}
void highlight_shell( wchar_t * buff,
int *color,
@@ -639,7 +653,7 @@ void highlight_shell( wchar_t * buff,
wcsdup(tok_last( &tok )),
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES);
if( cmd == 0 )
if( (cmd == 0) || has_expand_reserved( cmd ) )
{
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
}

View File

@@ -252,6 +252,9 @@ static wchar_t *history_unescape_newlines( wchar_t *in )
return (wchar_t *)out->buff;
}
/**
Check if the specified item is already loaded
*/
static int item_is_new( history_mode_t *m, void *d )
{
char *begin = (char *)d;
@@ -409,6 +412,9 @@ static void history_destroy_mode( history_mode_t *m )
}
/**
Free all memory used by specified mistory mode
*/
static void history_destroy_mode_wrapper( void *n, history_mode_t *m )
{
halloc_free( m );

27
input.c
View File

@@ -232,6 +232,9 @@ static const wchar_t code_arr[] =
*/
static array_list_t mappings = {0,0,0};
/**
List of all terminfo mappings
*/
static array_list_t *terminfo_mappings = 0;
@@ -240,28 +243,18 @@ static array_list_t *terminfo_mappings = 0;
*/
static int is_init = 0;
/**
Initialize terminfo.
*/
static void input_terminfo_init();
/**
Deallocate memory used by terminfo. Or at least try to. Terminfo leaks.
*/
static void input_terminfo_destroy();
/**
Returns the function description for the given function code.
*/
/*
static const wchar_t *input_get_desc( wchar_t c )
{
int i;
for( i = 0; i<(sizeof( code_arr )/sizeof(wchar_t)) ; i++ )
{
if( c == code_arr[i] )
{
return desc_arr[i];
}
}
return 0;
}
*/
void input_mapping_add( const wchar_t *sequence,
const wchar_t *command )
@@ -300,7 +293,7 @@ static int interrupt_handler()
/*
Fire any pending events
*/
event_fire( 0 );
event_fire( NULL );
/*
Reap stray processes, including printing exit status messages

19
input.h
View File

@@ -89,19 +89,26 @@ void input_unreadch( wint_t ch );
/**
Add a key mapping from the specified sequence
Add a key mapping from the specified sequence to the specified command
\param mode the name of the mapping mode to add this mapping to
\param s the sequence
\param d a description of the sequence
\param cmd an input function that will be run whenever the key sequence occurs
\param sequence the sequence to bind
\param command an input function that will be run whenever the key sequence occurs
*/
void input_mapping_add( const wchar_t *sequence, const wchar_t *cmd );
void input_mapping_add( const wchar_t *sequence, const wchar_t *command );
/**
Insert all mapping names into the specified array_list_t
*/
void input_mapping_get_names( array_list_t *list );
/**
Erase binding for specified key sequence
*/
int input_mapping_erase( const wchar_t *sequence );
/**
Return the command bound to the specified key sequence
*/
const wchar_t *input_mapping_get( const wchar_t *sequence );
/**

View File

@@ -28,7 +28,7 @@ Implementation file for the low level input library
/**
Time in milliseconds to wait for another byte to be available for
reading after \x1b is read before assuming that escape key was
reading after \\x1b is read before assuming that escape key was
pressed, and not an escape sequence.
*/
#define WAIT_ON_ESCAPE 10

3
io.h
View File

@@ -44,6 +44,9 @@ typedef struct io_data
} param2
;
/**
Set to true if this is an input io redirection
*/
int is_input;
/** Pointer to the next IO redirection */

46
kill.c
View File

@@ -45,19 +45,25 @@ static ll_node_t /** Last kill string */*kill_last=0, /** Current kill string */
static wchar_t *cut_buffer=0;
/**
Test if the xsel command is installed
Test if the xsel command is installed. Since this is called often,
cache the result.
*/
static int has_xsel()
{
static int called=0;
static int res = 0;
if (!called) {
void *context = halloc(0, 0);
wchar_t *path = path_get_path( context, L"xsel" );
int res = !!path;
res = !!path;
halloc_free( context );
called = 1;
}
return res;
}
/**
Add the string to the internal killring
*/
@@ -86,17 +92,41 @@ static void kill_add_internal( wchar_t *str )
void kill_add( wchar_t *str )
{
wchar_t *cmd = NULL;
wchar_t *escaped_str;
kill_add_internal(str);
if( !has_xsel() )
return;
/*
Check to see if user has set the FISH_CLIPBOARD_CMD variable,
and, if so, use it instead of checking the display, etc.
I couldn't think of a safe way to allow overide of the echo
command too, so, the command used must accept the input via stdin.
*/
wchar_t *clipboard;
if( (clipboard = env_get(L"FISH_CLIPBOARD_CMD")) )
{
escaped_str = escape( str, 1 );
cmd = wcsdupcat(L"echo -n ", escaped_str, clipboard);
}
else
{
/* This is for sending the kill to the X copy-and-paste buffer */
if( !has_xsel() ) {
return;
}
wchar_t *disp;
if( (disp = env_get( L"DISPLAY" )) )
{
wchar_t *escaped_str = escape( str, 1 );
wchar_t *cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
escaped_str = escape( str, 1 );
cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
}
}
if (cmd != NULL)
{
if( exec_subshell( cmd, 0 ) == -1 )
{
/*

120
mimedb.c
View File

@@ -94,6 +94,17 @@ license. Read the source code of the library for more information.
*/
#define GETOPT_STRING "tfimdalhv"
/**
Error message if system call goes wrong.
*/
#define ERROR_SYSTEM "%s: Could not execute command \"%s\"\n"
/**
Exit code if system call goes wrong.
*/
#define STATUS_ERROR_SYSTEM 1
/**
All types of input and output possible
*/
@@ -203,7 +214,7 @@ static char * search_ini( const char *filename, const char *match )
buf[0]=0;
done = 1;
}
else if( strncmp( buf, match,len )==0)
else if( strncmp( buf, match, len ) == 0 && buf[len] == '=' )
{
done=1;
}
@@ -229,7 +240,9 @@ static char * search_ini( const char *filename, const char *match )
*/
static char *file_exists( const char *dir, const char *in )
{
char *filename = my_malloc( strlen( dir ) + strlen(in) + 1 );
int dir_len = strlen( dir );
int need_sep = dir[dir_len - 1] != '/';
char *filename = my_malloc( dir_len + need_sep + strlen( in ) + 1 );
char *replaceme;
struct stat buf;
@@ -240,7 +253,9 @@ static char *file_exists( const char *dir, const char *in )
return 0;
}
strcpy( filename, dir );
strcat( filename, in );
if ( need_sep )
filename[dir_len++] = '/';
strcpy( filename + dir_len, in );
if( !stat( filename, &buf ) )
return filename;
@@ -274,9 +289,15 @@ static char *file_exists( const char *dir, const char *in )
Try to find the specified file in any of the possible directories
where mime files can be located. This code is shamelessly stolen
from xdg_run_command_on_dirs.
\param list Full file paths will be appended to this list.
\param f The relative filename search for the the data directories.
\param all If zero, then stop after the first filename.
\return The number of filenames added to the list.
*/
static char *get_filename( char *f )
static int append_filenames( array_list_t *list, char *f, int all )
{
int prev_count = al_get_count( list );
char *result;
const char *xdg_data_home;
const char *xdg_data_dirs;
@@ -286,8 +307,12 @@ static char *get_filename( char *f )
if (xdg_data_home)
{
result = file_exists( xdg_data_home, f );
if (result)
return result;
if ( result )
{
al_push( list, result );
if ( !all )
return 1;
}
}
else
{
@@ -298,23 +323,27 @@ static char *get_filename( char *f )
{
char *guessed_xdg_home;
guessed_xdg_home = my_malloc (strlen (home) + strlen ("/.local/share/") + 1);
guessed_xdg_home = my_malloc (strlen (home) + strlen ("/.local/share") + 1);
if( !guessed_xdg_home )
return 0;
strcpy (guessed_xdg_home, home);
strcat (guessed_xdg_home, "/.local/share/");
strcat (guessed_xdg_home, "/.local/share");
result = file_exists( guessed_xdg_home, f );
free (guessed_xdg_home);
if (result)
return result;
if ( result )
{
al_push( list, result );
if ( !all )
return 1;
}
}
}
xdg_data_dirs = getenv ("XDG_DATA_DIRS");
if (xdg_data_dirs == NULL)
xdg_data_dirs = "/usr/local/share/:/usr/share/";
xdg_data_dirs = "/usr/local/share:/usr/share";
ptr = xdg_data_dirs;
@@ -334,10 +363,7 @@ static char *get_filename( char *f )
continue;
}
if (*end_ptr == ':')
len = end_ptr - ptr;
else
len = end_ptr - ptr + 1;
dir = my_malloc (len + 1);
if( !dir )
return 0;
@@ -348,12 +374,32 @@ static char *get_filename( char *f )
free (dir);
if (result)
return result;
if ( result )
{
al_push( list, result );
if ( !all ) {
return 1;
}
}
ptr = end_ptr;
}
return 0;
return al_get_count( list ) - prev_count;
}
/**
Find at most one file relative to the XDG data directories.
*/
static char *get_filename( char *f )
{
array_list_t list;
char *first = NULL;
al_init( &list );
append_filenames( &list, f, 0 );
first = al_pop( &list );
al_destroy( &list );
return first;
}
/**
@@ -470,7 +516,7 @@ static char *get_description( const char *mimetype )
int fd;
struct stat st;
char *contents;
char *start=0, *stop=0;
char *start=0, *stop=0, *best_start=0;
if( !start_re )
{
@@ -583,6 +629,7 @@ static char *get_description( const char *mimetype )
while( !regexec(start_re, start, 1, match, 0) )
{
int new_w = match[0].rm_eo - match[0].rm_so;
start += match[0].rm_eo;
if( new_w > w )
{
@@ -591,12 +638,13 @@ static char *get_description( const char *mimetype )
match, so we use the new match
*/
w=new_w;
start += match[0].rm_eo;
best_start = start;
}
}
if( w != -1 )
{
start = best_start;
if( !regexec(stop_re, start, 1, match, 0) )
{
/*
@@ -625,22 +673,32 @@ static char *get_description( const char *mimetype )
static char *get_action( const char *mimetype )
{
char *res=0;
int i;
char *launcher;
char *end;
char *mime_filename;
array_list_t mime_filenames;
char *launcher_str;
char *launcher_str = NULL;
char *launcher_filename, *launcher_command_str, *launcher_command;
char *launcher_full;
mime_filename = get_filename( DESKTOP_DEFAULT );
if( !mime_filename )
al_init( &mime_filenames );
if( !append_filenames( &mime_filenames, DESKTOP_DEFAULT, 1 ) )
{
al_destroy( &mime_filenames );
return 0;
}
launcher_str = search_ini( mime_filename, mimetype );
for ( i = 0; i < al_get_count( &mime_filenames ); i++ )
{
launcher_str = search_ini( al_get( &mime_filenames, i ), mimetype );
if ( launcher_str )
break;
}
free( mime_filename );
al_foreach( &mime_filenames, free );
al_destroy( &mime_filenames );
if( !launcher_str )
{
@@ -665,7 +723,7 @@ static char *get_action( const char *mimetype )
Core 3) we also test some common subclassings.
*/
if( strncmp( mimetype, "text/", 5 ) == 0 )
if( strncmp( mimetype, "text/plain", 10) != 0 && strncmp( mimetype, "text/", 5 ) == 0 )
return get_action( "text/plain" );
return 0;
@@ -704,7 +762,7 @@ static char *get_action( const char *mimetype )
free( launcher_full );
launcher_command_str = search_ini( launcher_filename, "Exec=" );
launcher_command_str = search_ini( launcher_filename, "Exec" );
if( !launcher_command_str )
{
@@ -1125,8 +1183,12 @@ static void launch( char *filter, array_list_t *files, int fileno )
writer( '&' );
writer( '\0' );
// fprintf( stderr, "mimedb: %s\n", launch_buff );
system( launch_buff );
if( system( launch_buff ) == -1 )
{
fprintf( stderr, _( ERROR_SYSTEM ), MIMEDB, launch_buff );
exit(STATUS_ERROR_SYSTEM);
}
break;
}
}

View File

@@ -121,6 +121,9 @@ static char *writestr_buff = 0;
static int (*out)(char c) = &writeb_internal;
/**
Name of terminal
*/
static wchar_t *current_term = 0;
@@ -359,7 +362,7 @@ void set_color( int c, int c2 )
*/
static int writeb_internal( char c )
{
write( 1, &c, 1 );
write_loop( 1, &c, 1 );
return 0;
}

View File

@@ -73,7 +73,9 @@ enum
void set_color( int c, int c2 );
/**
Write specified multibyte string
*/
#define writembs( mbs ) \
{ \
char *tmp = mbs; \
@@ -144,10 +146,18 @@ int writeb( tputs_arg_t b );
void output_set_writer( int (*writer)(char) );
//typedef int (*func_ptr_t)(char);
/**
Return the current output writer
*/
int (*output_get_writer())(char) ;
/**
Set the terminal name
*/
void output_set_term( wchar_t *term );
/**
Return the terminal name
*/
wchar_t *output_get_term();
#endif

View File

@@ -292,7 +292,7 @@ struct block_lookup_entry
/**
List of all legal block types
*/
const static struct block_lookup_entry block_lookup[]=
static const struct block_lookup_entry block_lookup[]=
{
{
WHILE, L"while", WHILE_BLOCK
@@ -436,6 +436,7 @@ typedef struct
/**
Return the current number of block nestings
*/
/*
static int block_count( block_t *b )
{
@@ -443,7 +444,7 @@ static int block_count( block_t *b )
return 0;
return( block_count(b->outer)+1);
}
*/
void parser_push_block( int type )
{
@@ -1513,7 +1514,9 @@ static void parse_job_argument_list( process_t *p,
{
case TOK_STRING:
{
target = (wchar_t *)expand_one( j, wcsdup( tok_last( tok ) ), 0);
target = (wchar_t *)expand_one( j,
wcsdup( tok_last( tok ) ),
no_exec ? EXPAND_SKIP_VARIABLES : 0);
if( target == 0 && error_code == 0 )
{
@@ -2086,6 +2089,7 @@ static int parse_job( process_t *p,
current_tokenizer_pos=tmp;
job_set_flag( j, JOB_SKIP, 1 );
event_fire_generic(L"fish_command_not_found", (wchar_t *)al_get( args, 0 ) );
proc_set_last_status( err==ENOENT?STATUS_UNKNOWN_COMMAND:STATUS_NOT_EXECUTABLE );
}
}
@@ -2315,8 +2319,12 @@ static void eval_job( tokenizer *tok )
j = job_create();
job_set_flag( j, JOB_FOREGROUND, 1 );
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) );
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) && (!is_subshell && !is_event));
job_set_flag( j, JOB_SKIP_NOTIFICATION, is_subshell || is_block || is_event || (!is_interactive));
job_set_flag( j, JOB_TERMINAL, job_get_flag( j, JOB_CONTROL ) \
&& (!is_subshell && !is_event));
job_set_flag( j, JOB_SKIP_NOTIFICATION, is_subshell \
|| is_block \
|| is_event \
|| (!is_interactive));
current_block->job = j;
@@ -2536,7 +2544,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
error_code = 0;
event_fire( 0 );
event_fire( NULL );
while( tok_has_next( current_tokenizer ) &&
!error_code &&
@@ -2544,7 +2552,7 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
!exit_status() )
{
eval_job( current_tokenizer );
event_fire( 0 );
event_fire( NULL );
}
int prev_block_type = current_block->type;

10
path.h
View File

@@ -9,6 +9,9 @@
#ifndef FISH_PATH_H
#define FISH_PATH_H
/**
Return value for path_cdpath_get when locatied a rotten symlink
*/
#define EROTTEN 1
/**
@@ -48,6 +51,13 @@ wchar_t *path_get_path( void *context, const wchar_t *cmd );
*/
wchar_t *path_get_cdpath( void *context, wchar_t *in );
/**
Remove doulbe slashes and trailing slashes from a path,
e.g. transform foo//bar/ into foo/bar.
The returned string is allocated using the specified halloc
context.
*/
wchar_t *path_make_canonical( void *context, const wchar_t *path );

View File

@@ -5,18 +5,30 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "print_help.h"
#define CMD_LEN 1024
#define HELP_ERR "Could not show help message\n"
/* defined in common.h */
ssize_t write_loop(int fd, char *buff, size_t count);
void print_help( char *c, int fd )
{
char cmd[ CMD_LEN];
int printed = snprintf( cmd, CMD_LEN, "fish -c '__fish_print_help %s >&%d'", c, fd );
if( printed < CMD_LEN )
system( cmd );
{
if( (system( cmd ) == -1) )
{
write_loop(2, HELP_ERR, strlen(HELP_ERR));
}
}
}

51
proc.c
View File

@@ -343,30 +343,35 @@ static void mark_process_status( job_t *j,
process_t *p,
int status )
{
p->status = status;
// debug( 0, L"Process %ls %ls", p->argv[0], WIFSTOPPED (status)?L"stopped":(WIFEXITED( status )?L"exited":(WIFSIGNALED( status )?L"signaled to exit":L"BLARGH")) );
p->status = status;
if (WIFSTOPPED (status))
{
p->stopped = 1;
}
else
else if (WIFSIGNALED(status) || WIFEXITED(status))
{
p->completed = 1;
if (( !WIFEXITED( status ) ) &&
(! WIFSIGNALED( status )) )
}
else
{
ssize_t ignore;
/* This should never be reached */
p->completed = 1;
char mess[MESS_SIZE];
snprintf( mess,
MESS_SIZE,
"Process %d exited abnormally\n",
(int) p->pid );
write( 2, mess, strlen(mess) );
}
/*
If write fails, do nothing. We're in a signal handlers error
handler. If things aren't working properly, it's safer to
give up.
*/
ignore = write( 2, mess, strlen(mess) );
}
}
@@ -817,8 +822,8 @@ static int select_try( job_t *j )
int retval;
struct timeval tv;
tv.tv_sec=5;
tv.tv_usec=0;
tv.tv_sec=0;
tv.tv_usec=10000;
retval =select( maxfd+1, &fds, 0, 0, &tv );
return retval > 0;
@@ -926,7 +931,7 @@ static int terminal_give_to_job( job_t *j, int cont )
static int terminal_return_from_job( job_t *j)
{
if( tcsetpgrp (0, getpid()) )
if( tcsetpgrp (0, getpgrp()) )
{
debug( 1, _( L"Could not return shell to foreground" ) );
wperror( L"tcsetpgrp" );
@@ -1106,7 +1111,7 @@ void job_continue (job_t *j, int cont)
while( p->next )
p = p->next;
if( WIFEXITED( p->status ) )
if( WIFEXITED( p->status ) || WIFSIGNALED(p->status))
{
/*
Mark process status only if we are in the foreground
@@ -1114,8 +1119,9 @@ void job_continue (job_t *j, int cont)
*/
if( p->pid )
{
debug( 3, L"Set status of %ls to %d", j->command, WEXITSTATUS(p->status) );
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(WEXITSTATUS(p->status)?0:1):WEXITSTATUS(p->status) );
int status = proc_format_status(p->status);
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?!status:status);
}
}
}
@@ -1140,6 +1146,21 @@ void job_continue (job_t *j, int cont)
}
int proc_format_status(int status)
{
if( WIFSIGNALED( status ) )
{
return 128+WTERMSIG(status);
}
else if( WIFEXITED( status ) )
{
return WEXITSTATUS(status);
}
return status;
}
void proc_sanity_check()
{
job_t *j;

6
proc.h
View File

@@ -485,4 +485,10 @@ void proc_push_interactive( int value );
*/
void proc_pop_interactive();
/**
Format an exit status code as returned by e.g. wait into a fish exit code number as accepted by proc_set_last_status.
*/
int proc_format_status(int status) ;
#endif

270
reader.c
View File

@@ -117,6 +117,9 @@ commence.
*/
#define DEFAULT_PROMPT L"echo \"$USER@\"; hostname|cut -d . -f 1; echo \" \"; pwd; printf '> ';"
/**
The name of the function that prints the fish prompt
*/
#define PROMPT_FUNCTION_NAME L"fish_prompt"
/**
@@ -132,15 +135,40 @@ commence.
*/
#define READAHEAD_MAX 256
/**
A mode for calling the reader_kill function. In this mode, the new
string is appended to the current contents of the kill buffer.
*/
#define KILL_APPEND 0
/**
A mode for calling the reader_kill function. In this mode, the new
string is prepended to the current contents of the kill buffer.
*/
#define KILL_PREPEND 1
/**
History search mode. This value means that no search is currently
performed.
*/
#define NO_SEARCH 0
/**
History search mode. This value means that we are perforing a line
history search.
*/
#define LINE_SEARCH 1
/**
History search mode. This value means that we are perforing a token
history search.
*/
#define TOKEN_SEARCH 2
/**
History search mode. This value means we are searching backwards.
*/
#define SEARCH_BACKWARD 0
/**
History search mode. This value means we are searching forwards.
*/
#define SEARCH_FORWARD 1
/**
@@ -155,6 +183,9 @@ typedef struct reader_data
*/
wchar_t *buff;
/**
The representation of the current screen contents
*/
screen_t screen;
/**
@@ -252,6 +283,9 @@ typedef struct reader_data
*/
int prev_end_loop;
/**
The current contents of the top item in the kill ring.
*/
string_buffer_t kill_item;
/**
@@ -509,6 +543,9 @@ static int check_size()
}
/**
Compare two completion entrys
*/
static int completion_cmp( const void *a, const void *b )
{
completion_t *c= *((completion_t **)a);
@@ -518,6 +555,9 @@ static int completion_cmp( const void *a, const void *b )
}
/**
Sort an array_list_t containing compltion_t structs.
*/
static void sort_completion_list( array_list_t *comp )
{
qsort( comp->arr,
@@ -584,10 +624,16 @@ void reader_write_title()
don't. Since we can't see the underlying terminal below screen
there is no way to fix this.
*/
if( !term || !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
if ( !term )
{
return;
}
if( !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
{
char *n = ttyname( STDIN_FILENO );
if( contains( term, L"linux" ) )
{
return;
@@ -601,7 +647,7 @@ void reader_write_title()
title = function_exists( L"fish_title" )?L"fish_title":DEFAULT_TITLE;
if( wcslen( title ) ==0 )
if( wcslen( title ) == 0 )
return;
al_init( &l );
@@ -655,10 +701,11 @@ static void exec_prompt()
sb_clear( &data->prompt_buff );
for( i=0; i<al_get_count( &prompt_list); i++ )
for( i = 0; i < al_get_count( &prompt_list )-1; i++ )
{
sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ) );
sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ), L"\n" );
}
sb_append( &data->prompt_buff, (wchar_t *)al_get( &prompt_list, i ));
al_foreach( &prompt_list, &free );
al_destroy( &prompt_list );
@@ -949,9 +996,8 @@ static void get_param( wchar_t *cmd,
string.
\param val the string to insert
\param is_complete Whether this completion is the whole string or
just the common prefix of several completions. If the former, end by
printing a space (and an end quote if the parameter is quoted).
\param flags A union of all flags describing the completion to insert. See the completion_t struct for more information on possible values.
*/
static void completion_insert( const wchar_t *val, int flags )
{
@@ -959,12 +1005,15 @@ static void completion_insert( const wchar_t *val, int flags )
wchar_t quote;
int add_space = !(flags & COMPLETE_NO_SPACE);
int do_replace = (flags&COMPLETE_NO_CASE);
int do_replace = (flags & COMPLETE_NO_CASE);
int do_escape = !(flags & COMPLETE_DONT_ESCAPE);
// debug( 0, L"Insert completion %ls with flags %d", val, flags);
if( do_replace )
{
int tok_start, tok_len;
int tok_start, tok_len, move_cursor;
wchar_t *begin, *end;
string_buffer_t sb;
wchar_t *escaped;
@@ -978,19 +1027,29 @@ static void completion_insert( const wchar_t *val, int flags )
sb_init( &sb );
sb_append_substring( &sb, data->buff, begin - data->buff );
if( do_escape )
{
escaped = escape( val, ESCAPE_ALL | ESCAPE_NO_QUOTED );
sb_append( &sb, escaped );
move_cursor = wcslen(escaped);
free( escaped );
}
else
{
sb_append( &sb, val );
move_cursor = wcslen(val);
}
if( add_space )
{
sb_append( &sb, L" " );
move_cursor += 1;
}
sb_append( &sb, end );
reader_set_buffer( (wchar_t *)sb.buff, (begin-data->buff)+wcslen(val)+!!add_space );
reader_set_buffer( (wchar_t *)sb.buff, (begin-data->buff)+move_cursor );
sb_destroy( &sb );
reader_super_highlight_me_plenty( data->buff_pos, 0 );
@@ -998,6 +1057,9 @@ static void completion_insert( const wchar_t *val, int flags )
}
else
{
if( do_escape )
{
get_param( data->buff,
@@ -1045,6 +1107,11 @@ static void completion_insert( const wchar_t *val, int flags )
else
*pout = 0;
}
}
else
{
replaced = wcsdup(val);
}
if( insert_str( replaced ) )
{
@@ -1054,7 +1121,7 @@ static void completion_insert( const wchar_t *val, int flags )
if( add_space )
{
if( (quote) &&
if( quote &&
(data->buff[data->buff_pos] != quote ) )
{
/*
@@ -1225,7 +1292,7 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
io_buffer_destroy( in);
}
/*
/**
Flash the screen. This function only changed the color of the
current line, since the flash_screen sequnce is rather painful to
look at in most terminal emulators.
@@ -1253,6 +1320,46 @@ static void reader_flash()
}
/**
Characters that may not be part of a token that is to be replaced
by a case insensitive completion.
*/
#define REPLACE_UNCLEAN L"$*?({})"
/**
Check if the specified string can be replaced by a case insensitive
complition with the specified flags.
Advanced tokens like those containing {}-style expansion can not at
the moment be replaced, other than if the new token is already an
exact replacement, e.g. if the COMPLETE_DONT_ESCAPE flag is set.
*/
int reader_can_replace( const wchar_t *in, int flags )
{
const wchar_t * str = in;
if( flags & COMPLETE_DONT_ESCAPE )
{
return 1;
}
CHECK( in, 1 );
/*
Test characters that have a special meaning in any character position
*/
while( *str )
{
if( wcschr( REPLACE_UNCLEAN, *str ) )
return 0;
str++;
}
return 1;
}
/**
Handle the list of completions. This means the following:
@@ -1288,8 +1395,14 @@ static int handle_completions( array_list_t *comp )
context = halloc( 0, 0 );
tok = halloc_wcsndup( context, begin, end-begin );
/*
Check trivial cases
*/
switch( al_get_count( comp ) )
{
/*
No suitable completions found, flash screen and retur
*/
case 0:
{
reader_flash();
@@ -1297,12 +1410,21 @@ static int handle_completions( array_list_t *comp )
break;
}
/*
Exactly one suitable completion found - insert it
*/
case 1:
{
completion_t *c = (completion_t *)al_get( comp, 0 );
if( !(c->flags & COMPLETE_NO_CASE) || expand_is_clean( tok ) )
/*
If this is a replacement completion, check
that we know how to replace it, e.g. that
the token doesn't contain evil operators
like {}
*/
if( !(c->flags & COMPLETE_NO_CASE) || reader_can_replace( tok, c->flags ) )
{
completion_insert( c->completion,
c->flags );
@@ -1316,12 +1438,17 @@ static int handle_completions( array_list_t *comp )
if( !done )
{
/*
Try to find something to insert whith the correct case
*/
for( i=0; i<al_get_count( comp ); i++ )
{
completion_t *c = (completion_t *)al_get( comp, i );
int new_len;
/*
Ignore case insensitive completions for now
*/
if( c->flags & COMPLETE_NO_CASE )
continue;
@@ -1340,6 +1467,9 @@ static int handle_completions( array_list_t *comp )
}
}
/*
If we found something to insert, do it.
*/
if( len > 0 )
{
if( count > 1 )
@@ -1352,14 +1482,16 @@ static int handle_completions( array_list_t *comp )
}
if( !done && base == 0 )
{
/*
Try to find something to insert ignoring case
*/
if( begin )
{
if( expand_is_clean( tok ) )
{
int offset = wcslen( tok );
count = 0;
@@ -1369,9 +1501,16 @@ static int handle_completions( array_list_t *comp )
completion_t *c = (completion_t *)al_get( comp, i );
int new_len;
if( !(c->flags & COMPLETE_NO_CASE) )
continue;
if( !reader_can_replace( tok, c->flags ) )
{
len=0;
break;
}
count++;
if( base )
@@ -1397,7 +1536,7 @@ static int handle_completions( array_list_t *comp )
completion_insert( base, flags );
done = 1;
}
}
}
}
@@ -1449,7 +1588,7 @@ static int handle_completions( array_list_t *comp )
get_param( data->buff, data->buff_pos, &quote, 0, 0, 0 );
is_quoted = (quote != L'\0');
write(1, "\n", 1 );
write_loop(1, "\n", 1 );
run_pager( prefix, is_quoted, comp );
}
@@ -1486,12 +1625,53 @@ static void reader_interactive_init()
not enable it for us.
*/
/* Loop until we are in the foreground. */
/*
Check if we are in control of the terminal, so that we don't do
semi-expensive things like reset signal handlers unless we
really have to, which we often don't.
*/
if (tcgetpgrp( 0 ) != shell_pgid)
{
int block_count = 0;
int i;
/*
Bummer, we are not in control of the terminal. Stop until
parent has given us control of it. Stopping in fish is a bit
of a challange, what with all the signal fidgeting, we need
to reset a bunch of signal state, making this coda a but
unobvious.
In theory, reseting signal handlers could cause us to miss
signal deliveries. In practice, this code should only be run
suring startup, when we're not waiting for any signals.
*/
while (signal_is_blocked())
{
signal_unblock();
block_count++;
}
signal_reset_handlers();
/*
Ok, signal handlers are taken out of the picture. Stop ourself in a loop
until we are in control of the terminal.
*/
while (tcgetpgrp( 0 ) != shell_pgid)
{
killpg( shell_pgid, SIGTTIN);
}
signal_set_handlers();
for( i=0; i<block_count; i++ )
{
signal_block();
}
}
/* Put ourselves in our own process group. */
shell_pgid = getpid ();
if( getpgrp() != shell_pgid )
@@ -1801,7 +1981,7 @@ static void handle_token_history( int forward, int reset )
\param dir Direction to move/erase. 0 means move left, 1 means move right.
\param erase Whether to erase the characters along the way or only move past them.
\param do_append if erase is true, this flag decides if the new kill item should be appended to the previous kill item.
\param new if the new kill item should be appended to the previous kill item or not.
*/
static void move_word( int dir, int erase, int new )
{
@@ -1970,6 +2150,10 @@ void reader_set_buffer( wchar_t *b, int p )
data->buff_pos=l;
}
data->search_mode = NO_SEARCH;
sb_clear( &data->search_buff );
history_reset();
reader_super_highlight_me_plenty( data->buff_pos,
0 );
reader_repaint_needed();
@@ -1984,11 +2168,42 @@ int reader_get_cursor_pos()
return data->buff_pos;
}
#define ENV_CMD_DURATION L"CMD_DURATION"
void set_env_cmd_duration(struct timeval *after, struct timeval *before)
{
time_t secs = after->tv_sec - before->tv_sec;
suseconds_t usecs = after->tv_usec - before->tv_usec;
wchar_t buf[16];
if (after->tv_usec < before->tv_usec) {
usecs += 1000000;
secs -= 1;
}
if (secs < 1) {
env_remove( ENV_CMD_DURATION, 0 );
} else {
if (secs < 10) { // 10 secs
swprintf(buf, 16, L"%lu.%02us", secs, usecs / 10000);
} else if (secs < 60) { // 1 min
swprintf(buf, 16, L"%lu.%01us", secs, usecs / 100000);
} else if (secs < 600) { // 10 mins
swprintf(buf, 16, L"%lum %lu.%01us", secs / 60, secs % 60, usecs / 100000);
} else if (secs < 5400) { // 1.5 hours
swprintf(buf, 16, L"%lum %lus", secs / 60, secs % 60);
} else {
swprintf(buf, 16, L"%.1fh", secs / 3600.0f);
}
env_set( ENV_CMD_DURATION, buf, ENV_EXPORT );
}
}
void reader_run_command( const wchar_t *cmd )
{
wchar_t *ft;
struct timeval time_before, time_after;
ft= tok_first( cmd );
@@ -2000,9 +2215,14 @@ void reader_run_command( const wchar_t *cmd )
term_donate();
gettimeofday(&time_before, NULL);
eval( cmd, 0, TOP );
job_reap( 1 );
gettimeofday(&time_after, NULL);
set_env_cmd_duration(&time_after, &time_before);
term_steal();
env_set( L"_", program_name, ENV_GLOBAL );
@@ -2228,7 +2448,7 @@ static void handle_end_loop()
if( !reader_exit_forced() && !data->prev_end_loop && job_count && !is_breakpoint )
{
writestr(_( L"There are stopped jobs\n" ));
writestr(_( L"There are stopped jobs. A second attempt to exit will enforce their termination.\n" ));
reader_exit( 0, 0 );
data->prev_end_loop=1;
@@ -2517,7 +2737,7 @@ wchar_t *reader_readline()
case R_REPAINT:
{
exec_prompt();
write( 1, "\r", 1 );
write_loop( 1, "\r", 1 );
s_reset( &data->screen, 0 );
reader_repaint();
break;
@@ -2564,9 +2784,11 @@ wchar_t *reader_readline()
comp = al_halloc( 0 );
data->complete_func( buffcpy, comp );
sort_completion_list( comp );
remove_duplicates( comp );
free( buffcpy );
comp_empty = handle_completions( comp );

View File

@@ -86,6 +86,10 @@ static int try_sequence( char *seq, wchar_t *str )
return 0;
}
/**
Returns the number of columns left until the next tab stop, given
the current cursor postion.
*/
static int next_tab_stop( int in )
{
/*
@@ -232,6 +236,10 @@ static int calc_prompt_width( wchar_t *prompt )
{
res = next_tab_stop( res );
}
else if( prompt[j] == L'\n' )
{
res = 0;
}
else
{
/*
@@ -333,7 +341,7 @@ static void s_check_status( screen_t *s)
*/
int prev_line = s->actual_cursor[1];
write( 1, "\r", 1 );
write_loop( 1, "\r", 1 );
s_reset( s, 0 );
s->actual_cursor[1] = prev_line;
}
@@ -696,8 +704,8 @@ static void s_update( screen_t *scr, wchar_t *prompt )
for( j=start_pos; j<al_get_count( &o_line->text ); j++ )
{
wchar_t o = (wchar_t)al_get( &o_line->text, j );
int o_c = (int)al_get( &o_line->color, j );
wchar_t o = (wchar_t)(long)al_get( &o_line->text, j );
int o_c = (int)(long)al_get( &o_line->color, j );
if( !o )
@@ -713,8 +721,8 @@ static void s_update( screen_t *scr, wchar_t *prompt )
}
else
{
wchar_t s = (wchar_t)al_get( &s_line->text, j );
int s_c = (int)al_get( &s_line->color, j );
wchar_t s = (wchar_t)(long)al_get( &s_line->text, j );
int s_c = (int)(long)al_get( &s_line->color, j );
if( o != s || o_c != s_c )
{
s_move( scr, &output, current_width, i );
@@ -752,13 +760,16 @@ static void s_update( screen_t *scr, wchar_t *prompt )
if( output.used )
{
write( 1, output.buff, output.used );
write_loop( 1, output.buff, output.used );
}
b_destroy( &output );
}
/**
Returns non-zero if we are using a dumb terminal.
*/
static int is_dumb()
{
return ( !cursor_up || !cursor_down || !cursor_left || !cursor_right );
@@ -797,9 +808,9 @@ void s_write( screen_t *s,
char *prompt_narrow = wcs2str( prompt );
char *buffer_narrow = wcs2str( b );
write( 1, "\r", 1 );
write( 1, prompt_narrow, strlen( prompt_narrow ) );
write( 1, buffer_narrow, strlen( buffer_narrow ) );
write_loop( 1, "\r", 1 );
write_loop( 1, prompt_narrow, strlen( prompt_narrow ) );
write_loop( 1, buffer_narrow, strlen( buffer_narrow ) );
free( prompt_narrow );
free( buffer_narrow );
@@ -931,7 +942,7 @@ void s_reset( screen_t *s, int reset_cursor )
This should prevent reseting the cursor position during the
next repaint.
*/
write( 1, "\r", 1 );
write_loop( 1, "\r", 1 );
s->actual_cursor[1] = prev_line;
}
fstat( 1, &s->prev_buff_1 );

View File

@@ -2,9 +2,13 @@
The screen library allows the interactive reader to write its
output to screen efficiently by keeping an inetrnal representation
of the current screen contents and trying to find the most
of the current screen contents and trying to find a reasonably
efficient way for transforming that to the desired screen content.
*/
The current implementation is less smart than ncurses allows
and can not for example move blocks of text around to handle text
insertion.
*/
#ifndef FISH_SCREEN_H
#define FISH_SCREEN_H
@@ -13,7 +17,7 @@
*/
typedef struct
{
/*
/**
The internal representation of the desired screen contents.
*/
array_list_t desired;
@@ -35,7 +39,7 @@ typedef struct
*/
string_buffer_t actual_prompt;
/*
/**
The actual width of the screen at the time of the last screen
write.
*/

6
seq.in
View File

@@ -45,4 +45,8 @@ for i in $from $step $to
end
end
echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
if [ $step -ge 0 ]
echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
else
echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc
end

View File

@@ -332,7 +332,7 @@ int main( int argc, char **argv )
if( del_curterm( cur_term ) == ERR )
{
fprintf( stderr, _("Error while closing terminfo") );
fprintf( stderr, "%s", _("Error while closing terminfo") );
}
}

View File

@@ -0,0 +1,28 @@
#
# Command specific completions for the adduser command.
# These completions where generated from the commands
# man page by the make_completions.py script, but may
# have been hand edited since.
#
complete -x -c adduser -a "(__fish_complete_users; __fish_complete_groups)"
complete -c adduser -l conf --description 'Specify config file' -r
complete -c adduser -l disabled-login --description 'Do not run passwd to set the password'
complete -c adduser -l disabled-password --description 'Like --disabled-login, but logins are still possible (for example using SSH RSA keys) but not using password authentication'
complete -c adduser -l force-badname --description 'By default, user and group names are checked against the configurable regular expression NAME_REGEX (or NAME_REGEX if --system is specified) specified in the configuration file'
complete -c adduser -l gecos --description 'Set the gecos field for the new entry generated' -r
complete -c adduser -l gid --description 'When creating a group, this option forces the new groupid to be the given number' -r
complete -c adduser -l group --description 'When combined with --system, a group with the same name and ID as the system user is created'
complete -c adduser -l help --description 'Display brief instructions'
complete -c adduser -l home --description 'Use specified directory as the user\'s home directory' -x -a '(__fish_complete_directories)'
complete -c adduser -l shell --description 'Use shell as the user\'s login shell, rather than the default specified by the configuration file' -x -a '(cat /etc/shells)'
complete -c adduser -l ingroup --description 'Add the new user to GROUP instead of a usergroup or the default group defined by USERS_GID in the configuration file' -x -a '(cat /etc/group|cut -d : -f 1)'
complete -c adduser -l no-create-home --description 'Do not create the home directory, even if it doesni\'t exist'
complete -c adduser -l quiet --description 'Suppress informational messages, only show warnings and errors'
complete -c adduser -l debug --description 'Be verbose, most useful if you want to nail down a problem with adduser'
complete -c adduser -l system --description 'Create a system user or group'
complete -c adduser -l uid --description 'Force the new userid to be the given number' -r
complete -c adduser -l firstuid --description 'Override the first uid in the range that the uid is chosen from (overrides FIRST_UID specified in the configuration file)' -r
complete -c adduser -l lastuid --description 'ID Override the last uid in the range that the uid is chosen from ( LAST_UID )' -r
complete -c adduser -l add_extra_groups --description 'Add new user to extra groups defined in the configuration file'
complete -c adduser -l version --description 'Display version and copyright information'

View File

@@ -2,7 +2,7 @@
function __fish_apt_no_subcommand --description 'Test if aptitude has yet to be given the subcommand'
for i in (commandline -opc)
if contains -- $i autoclean clean forget-new keep-all update upgrade changelog dist-upgrade download forbid-version hold install keep markauto purge reinstall remove show unhold unmarkauto search help
if contains -- $i autoclean clean forget-new keep-all update safe-upgrade changelog full-upgrade download forbid-version hold install keep markauto purge reinstall remove show unhold unmarkauto search help
return 1
end
end
@@ -11,7 +11,7 @@ end
function __fish_apt_use_package --description 'Test if aptitude command should have packages as potential completion'
for i in (commandline -opc)
if contains -- $i changelog dist-upgrade download forbid-version hold install keep-all markauto purge reinstall remove show unhold unmarkauto
if contains -- $i changelog full-upgrade download forbid-version hold install keep-all markauto purge reinstall remove show unhold unmarkauto
return 0
end
end
@@ -26,9 +26,9 @@ complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'clean' --description
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'forget-new' --description 'Forget all internal information about what packages are \'new\''
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'keep-all' --description 'Cancel all scheduled actions on all packages'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'update' --description 'Update the list of available packages from the apt sources'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'upgrade' --description 'Upgrade installed packages to their most recent version'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'safe-upgrade' --description 'Upgrade installed packages to their most recent version'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'changelog' --description 'Download and displays the Debian changelog for the packages'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'dist-upgrade' --description 'Upgrade, removing or installing packages as necessary'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'full-upgrade' --description 'Upgrade, removing or installing packages as necessary'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'download' --description 'Download the packages to the current directory'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'forbid-version' --description 'Forbid the upgrade to a particular version'
complete -f -n '__fish_apt_no_subcommand' -c aptitude -a 'hold' --description 'Ignore the packages by future upgrade commands'

View File

@@ -0,0 +1,19 @@
#
# Command specific completions for the badblocks command.
# These completions where generated from the commands
# man page by the make_completions.py script, and
# have been hand edited since.
#
complete -c badblocks -s b --description 'Block-size Specify the size of blocks in bytes'
complete -c badblocks -s c --description 'Number of blocks is the number of blocks which are tested at a time'
complete -c badblocks -s f --description 'Normally, badblocks will refuse to do a read/write or a nondestructive test on a device which is mounted, since either can cause the system to potentially crash and/or damage the filesys tem even if it is mounted read-only'
complete -c badblocks -s i --description 'Input_file Read a list of already existing known bad blocks'
complete -c badblocks -s o --description 'Output_file Write the list of bad blocks to the specified file'
complete -c badblocks -s p --description 'Repeat scanning the disk until there are no new blocks discovered in specified number of consecutive scans of the disk'
complete -c badblocks -s t --description 'Test_pattern Specify a test pattern to be read (and written) to disk blocks'
complete -c badblocks -s n --description 'Use non-destructive read-write mode'
complete -c badblocks -s s --description 'Show the progress of the scan by writing out the block numbers as they are checked'
complete -c badblocks -s v --description 'Verbose mode'
complete -c badblocks -s w --description 'Use write-mode test'
complete -c badblocks -s X --description 'Internal flag only to be used by e2fsck(8) and mke2fs(8)'

View File

@@ -0,0 +1,3 @@
complete -c djview -x -a "(__fish_complete_suffix .djvu)"

View File

@@ -0,0 +1,3 @@
complete -c djview3 -x -a "(__fish_complete_suffix .djvu)"

View File

@@ -0,0 +1,3 @@
complete -c djview4 -x -a "(__fish_complete_suffix .djvu)"

View File

@@ -0,0 +1,6 @@
complete -c dlocate -s S -x -d 'List records that match filenames'
complete -c dlocate -s L -d 'List all files in the package' -xa '(__fish_print_packages)'
complete -c dlocate -o ls -d 'ls -ldF all files in the package' -xa '(__fish_print_packages)'
complete -c dlocate -o du -d 'du -sck all files in the package' -xa '(__fish_print_packages)'

View File

@@ -0,0 +1,6 @@
complete -c dpkg -s i -l install -d 'Install .deb package' -xa '(__fish_complete_suffix .deb)'
complete -c dpkg -s r -l remove -d 'Remove package' -xa '(__fish_print_packages)'
complete -c dpkg -s P -l purge -d 'Purge package' -xa '(__fish_print_packages)'
complete -c dpkg -l force-all -d 'Continue on all problems'

View File

@@ -0,0 +1,94 @@
# completions for effectv 0.3.9 or similiar
complete -c effectv -f -a "QuarkTV" -d "Dissolves moving objects"
complete -c effectv -f -a "FireTV" -d "Clips incoming objects and burns it"
complete -c effectv -f -a "BurningTV" -d "Burns incoming objects"
complete -c effectv -f -a "RadioacTV" -d "Brightens moving objects and blurs it"
complete -c effectv -f -a "StreakTV" -d "Makes 8 afterimages"
complete -c effectv -f -a "BaltanTV" -d "Makes afterimages longer"
complete -c effectv -f -a "1DTV" -d "Grabs a horizontal line from video every 1/30 sec"
complete -c effectv -f -a "DotTV" -d "Converts the picture into a set of dots"
complete -c effectv -f -a "MosaicTV" -d "Censors incoming objects"
complete -c effectv -f -a "PuzzleTV" -d "Scrambles the picture"
complete -c effectv -f -a "PredatorTV" -d "Makes incoming objects invisible visibly"
complete -c effectv -f -a "SpiralTV" -d "Spiraling effect"
complete -c effectv -f -a "SimuraTV" -d "Color distortion and image mirroring"
complete -c effectv -f -a "EdgeTV" -d "Detects edge and display it like good old computer way"
complete -c effectv -f -a "ShagadelicTV" -d "Go back to swinging '60s"
complete -c effectv -f -a "NoiseTV" -d "Makes incoming objects noisy"
complete -c effectv -f -a "AgingTV" -d "Film-aging effect"
complete -c effectv -f -a "LifeTV" -d "Conway's life game with video input interaction"
complete -c effectv -f -a "TransFormTV" -d "Performs positional translations on images"
complete -c effectv -f -a "SparkTV" -d "Spark effect"
complete -c effectv -f -a "warpTV" -d "Goo'ing effect"
complete -c effectv -f -a "HolographicTV" -d "Holographic vision seen in Star Wars"
complete -c effectv -f -a "cycleTV" -d "Color cycling effect"
complete -c effectv -f -a "RippleTV" -d "Ripple mark effect"
complete -c effectv -f -a "DiceTV" -d "A 'dicing' effect"
complete -c effectv -f -a "VertigoTV" -d "Alpha blending with zoomed and rotated images"
complete -c effectv -f -a "DeinterlaceTV" -d "Deinterlacing video images"
complete -c effectv -f -a "nervousTV" -d "Realtime frame shuffling effect"
complete -c effectv -f -a "RndmTV" -d "Gives you a noisy picture in color or B/W"
complete -c effectv -f -a "RevTV" -d "Waveform monitor effect"
complete -c effectv -f -a "RandomDotStereoTV" -d "Makes random dot stereo stream from video input"
complete -c effectv -f -a "LensTV" -d "Old school demo lens effect"
complete -c effectv -f -a "DiffTV" -d "Hilights interframe differences"
complete -c effectv -f -a "BrokenTV" -d "Simulates broken TV"
complete -c effectv -f -a "WarholTV" -d "Hommage to Andy Warhol"
complete -c effectv -f -a "MatrixTV" -d "A Matrix like effect"
complete -c effectv -f -a "PUPTV" -d "Comes from \"Partial UPdate\", certain part of image is updated at a frame"
complete -c effectv -f -a "ChameleonTV" -d "Vanishing into the wall..."
complete -c effectv -o help -d "show usage information"
complete -c effectv -o device -r -d "[FILE] use device FILE for video4linux (default is /dev/video0)"
complete -c effectv -o channel -r -d "[CHANNEL] channel number of video source (default is 0)"
set __fish_effectv_norms "ntsc
pal
secam
pal-nc
pal-m
pal-n
ntsc-jp"
complete -c effectv -o norm -x -a '(echo $__fish_effectv_norms)' -d "[NORM] set video norm (default is ntsc)"
set __fish_effectv_freqs "argentina
australia
australia-optus
canada-cable
china-bcast
europe-east
europe-west
france
ireland
italy
japan-bcast
japan-cable
newzealand
southafrica
us-bcast
us-cable
us-cable-hrc"
complete -c effectv -o freqtab -x -a '(echo $__fish_effectv_freqs)' -d "[FREQUTAB] set frequency table"
complete -c effectv -o fullscreen -d "enable fullscreen mode"
complete -c effectv -o hardware -d "use direct video memory (if possible)"
complete -c effectv -o doublebuffer -d "enable double buffering mode (if possible)"
complete -c effectv -o fps -d "show frames/sec"
complete -c effectv -o size -x -a "WxH" -d "[WxH] set the size of capturing image to WxH pixels (default 320x240)"
complete -c effectv -o geometry -x -a "WxH" -d "[WxH] set the size of screen to WxH pixels"
complete -c effectv -o scale -x -d "[NUMBER] set the scaling. When the capturing size is set, the screen size is scaled by NUMBER"
complete -c effectv -o autoplay -x -d "[FRAMES] change effects automatically every FRAMES"
set __fish_effectv_palettes "grey
rgb24
rgb555
rgb565
yuv410p
yuv411p
yuv420p
yuv422
yuv422p"
complete -c effectv -o palette -x -a '(echo $__fish_effectv_palettes)' -d "[PALETTE] set the PALETTE of capturing device"
complete -c effectv -o vloopback -r -d "[FILE] use device FILE for output of vloopback device"

View File

@@ -37,6 +37,7 @@ complete -c find -o cnewer --description "File status last changed more recently
complete -c find -o ctime --description "File status last changed specified number of days ago" -r
complete -c find -o empty --description "File is empty and is either a regular file or a directory"
complete -c find -o executable --description "File is executable"
complete -c find -o false --description "Always false"
complete -c find -o fstype --description "File is on filesystem of specified type" -a "(__fish_print_filesystems)" -r
complete -c find -o gid --description "Numeric group id of file" -r

View File

@@ -0,0 +1 @@
complete -c funced -xa "(functions -na)" --description "Save function"

View File

@@ -0,0 +1 @@
complete -c funcsave -xa "(functions -na)" --description "Save function"

View File

@@ -5,7 +5,7 @@ complete -c function -s j -l on-job-exit --description "Make the function a job
complete -c function -s p -l on-process-exit --description "Make the function a process exit event handler" -x
complete -c function -s s -l on-signal --description "Make the function a signal event handler" -x
complete -c function -s v -l on-variable --description "Make the function a variable update event handler" -x
complete -c function -s v -l on-event --description "Make the function a generic event handler" -x
complete -c function -s e -l on-event --description "Make the function a generic event handler" -x
complete -c function -s b -l key-binding --description "Allow dash (-) in function name"
complete -c function -s a -l argument-names --description "Specify named arguments"
complete -c function -s S -l no-scope-shadowing --description "Do not shadow variable scope of calling function"

View File

@@ -4,8 +4,8 @@
#####
# Global options
complete -c gem -n 'not __subcommand_given' -s h -l help -d "Print usage informations and quit"
complete -c gem -n 'not __subcommand_given' -s v -l version -d "Print the version and quit"
complete -c gem -n 'not __fish_use_subcommand' -s h -l help -d "Print usage informations and quit"
complete -c gem -n 'not __fish_use_subcommand' -s v -l version -d "Print the version and quit"
#####
# Subcommands
@@ -31,7 +31,7 @@ complete -c gem -n '__fish_use_subcommand' -xa 'update\t"'(_ "Update the named g
# Subcommand switches
# common opts
set -l common_opt -c gem -n 'not __fish_use_subcommand' #'__subcommand_given'
set -l common_opt -c gem -n 'not __fish_use_subcommand'
complete $common_opt -l source --description "Use URL as the remote source for gems" -x
complete $common_opt -s p -l http-proxy --description "Use the given HTTP proxy for remote operations" -x
complete $common_opt -l no-http-proxy --description "Use no HTTP proxy for remote operations"

246
share/completions/git.fish Normal file
View File

@@ -0,0 +1,246 @@
# fish completion for git
function __fish_git_branches
git branch --no-color -a 2>/dev/null | sed 's/^..//'
end
function __fish_git_tags
git tag
end
function __fish_git_heads
__fish_git_branches
__fish_git_tags
end
function __fish_git_remotes
git remote
end
function __fish_git_ranges
set from (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[0]')
set to (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[1]')
if [ "$from" = "" ]
__fish_git_branches
return 0
end
for from_ref in (__fish_git_heads | grep -e "$from")
for to_ref in (__fish_git_heads | grep -e "$to")
printf "%s..%s\n" $from_ref $to_ref
end
end
end
function __fish_git_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'git' ]
return 0
end
return 1
end
function __fish_git_using_command
set cmd (commandline -opc)
if [ (count $cmd) -gt 1 ]
if [ $argv[1] = $cmd[2] ]
return 0
end
end
return 1
end
# general options
complete -f -c git -n 'not __fish_git_needs_command' -l help -d 'Display the manual of a git command'
#### fetch
complete -f -c git -n '__fish_git_needs_command' -a fetch -d 'Download objects and refs from another repository'
complete -f -c git -n '__fish_git_using_command fetch' -a '(__fish_git_remotes)' -d 'Remote'
complete -f -c git -n '__fish_git_using_command fetch' -s q -l quiet -d 'Be quiet'
complete -f -c git -n '__fish_git_using_command fetch' -s v -l verbose -d 'Be verbose'
complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append ref names and object names'
# TODO --upload-pack
complete -f -c git -n '__fish_git_using_command fetch' -s f -l force -d 'Force update of local branches'
# TODO other options
### remote
complete -f -c git -n '__fish_git_needs_command' -a remote -d 'Manage set of tracked repositories'
complete -f -c git -n '__fish_git_using_command remote' -a '(__fish_git_remotes)'
complete -f -c git -n '__fish_git_using_command remote' -s v -l verbose -d 'Be verbose'
complete -f -c git -n '__fish_git_using_command remote' -a add -d 'Adds a new remote'
complete -f -c git -n '__fish_git_using_command remote' -a rm -d 'Removes a remote'
complete -f -c git -n '__fish_git_using_command remote' -a show -d 'Shows a remote'
complete -f -c git -n '__fish_git_using_command remote' -a prune -d 'Deletes all stale tracking branches'
complete -f -c git -n '__fish_git_using_command remote' -a update -d 'Fetches updates'
# TODO options
### show
complete -f -c git -n '__fish_git_needs_command' -a show -d 'Shows the last commit of a branch'
complete -f -c git -n '__fish_git_using_command show' -a '(__fish_git_branches)' -d 'Branch'
# TODO options
### show-branch
complete -f -c git -n '__fish_git_needs_command' -a show-branch -d 'Shows the commits on branches'
complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_heads)' --description 'Branch'
# TODO options
### add
complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to the index'
# TODO options
### checkout
complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
# TODO options
### apply
complete -f -c git -n '__fish_git_needs_command' -a apply -d 'Apply a patch on a git index file and a working tree'
# TODO options
### archive
complete -f -c git -n '__fish_git_needs_command' -a archive -d 'Create an archive of files from a named tree'
# TODO options
### bisect
complete -f -c git -n '__fish_git_needs_command' -a bisect -d 'Find the change that introduced a bug by binary search'
# TODO options
### branch
complete -f -c git -n '__fish_git_needs_command' -a branch -d 'List, create, or delete branches'
complete -f -c git -n '__fish_git_using_command branch' -a '(__fish_git_branches)' -d 'Branch'
complete -f -c git -n '__fish_git_using_command branch' -s d -d 'Delete Branch'
complete -f -c git -n '__fish_git_using_command branch' -s D -d 'Force deletion of branch'
complete -f -c git -n '__fish_git_using_command branch' -s m -d 'Rename branch'
complete -f -c git -n '__fish_git_using_command branch' -s M -d 'Force renaming branch'
complete -f -c git -n '__fish_git_using_command branch' -s a -d 'Lists both local and remote branches'
### cherry-pick
complete -f -c git -n '__fish_git_needs_command' -a cherry-pick -d 'Apply the change introduced by an existing commit'
complete -f -c git -n '__fish_git_using_command cherry-pick' -a '(__fish_git_branches)' -d 'Branch'
# TODO options
### clone
complete -f -c git -n '__fish_git_needs_command' -a clone -d 'Clone a repository into a new directory'
# TODO options
### commit
complete -c git -n '__fish_git_needs_command' -a commit -d 'Record changes to the repository'
complete -c git -n '__fish_git_using_command commit' -l amend -d 'Amend the log message of the last commit'
# TODO options
### diff
complete -c git -n '__fish_git_needs_command' -a diff -d 'Show changes between commits, commit and working tree, etc'
complete -c git -n '__fish_git_using_command diff' -a '(__fish_git_ranges)' -d 'Branch'
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
# TODO options
### grep
complete -c git -n '__fish_git_needs_command' -a grep -d 'Print lines matching a pattern'
# TODO options
### init
complete -f -c git -n '__fish_git_needs_command' -a init -d 'Create an empty git repository or reinitialize an existing one'
# TODO options
### log
complete -c git -n '__fish_git_needs_command' -a log -d 'Show commit logs'
complete -c git -n '__fish_git_using_command log' -a '(__fish_git_heads) (__fish_git_ranges)' -d 'Branch'
complete -f -c git -n '__fish_git_using_command log' -l pretty -a 'oneline short medium full fuller email raw format:'
# TODO options
### merge
complete -f -c git -n '__fish_git_needs_command' -a merge -d 'Join two or more development histories together'
complete -f -c git -n '__fish_git_using_command merge' -a '(__fish_git_branches)' -d 'Branch'
complete -f -c git -n '__fish_git_using_command merge' -l commit -d "Autocommit the merge"
complete -f -c git -n '__fish_git_using_command merge' -l no-commit -d "Don't autocommit the merge"
complete -f -c git -n '__fish_git_using_command merge' -l stat -d "Show diffstat of the merge"
complete -f -c git -n '__fish_git_using_command merge' -s n -l no-stat -d "Don't show diffstat of the merge"
complete -f -c git -n '__fish_git_using_command merge' -l squash -d "Squash changes from other branch as a single commit"
complete -f -c git -n '__fish_git_using_command merge' -l no-squash -d "Don't squash changes"
complete -f -c git -n '__fish_git_using_command merge' -l ff -d "Don't generate a merge commit if merge is fast forward"
complete -f -c git -n '__fish_git_using_command merge' -l no-ff -d "Generate a merge commit even if merge is fast forward"
# TODO options
### mv
complete -c git -n '__fish_git_needs_command' -a mv -d 'Move or rename a file, a directory, or a symlink'
# TODO options
### prune
complete -f -c git -n '__fish_git_needs_command' -a prune -d 'Prune all unreachable objects from the object database'
# TODO options
### pull
complete -f -c git -n '__fish_git_needs_command' -a pull -d 'Fetch from and merge with another repository or a local branch'
# TODO options
### push
complete -f -c git -n '__fish_git_needs_command' -a push -d 'Update remote refs along with associated objects'
# TODO options
### rebase
complete -f -c git -n '__fish_git_needs_command' -a rebase -d 'Forward-port local commits to the updated upstream head'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_branches)' -d 'Branch'
# TODO options
### reset
complete -c git -n '__fish_git_needs_command' -a reset -d 'Reset current HEAD to the specified state'
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset files in working directory'
complete -c git -n '__fish_git_using_command reset' -a '(__fish_git_branches)'
# TODO options
### revert
complete -f -c git -n '__fish_git_needs_command' -a revert -d 'Revert an existing commit'
# TODO options
### rm
complete -c git -n '__fish_git_needs_command' -a rm -d 'Remove files from the working tree and from the index'
complete -c git -n '__fish_git_using_command rm' -f
complete -c git -n '__fish_git_using_command rm' -l cached -d 'Keep local copies'
complete -c git -n '__fish_git_using_command rm' -l ignore-unmatch -d 'Exit with a zero status even if no files matched'
complete -c git -n '__fish_git_using_command rm' -s r -d 'Allow recursive removal'
complete -c git -n '__fish_git_using_command rm' -s q -l quiet -d 'Suppress the output'
complete -c git -n '__fish_git_using_command rm' -s f -l force -d 'Override the up-to-date check'
complete -c git -n '__fish_git_using_command rm' -s n -l dry-run -d 'Dry run'
# TODO options
### status
complete -f -c git -n '__fish_git_needs_command' -a status -d 'Show the working tree status'
complete -f -c git -n '__fish_git_using_command status' -s s -l short -d 'Give the output in the short-format'
complete -f -c git -n '__fish_git_using_command status' -s b -l branch -d 'Show the branch and tracking info even in short-format'
complete -f -c git -n '__fish_git_using_command status' -l porcelain -d 'Give the output in a stable, easy-to-parse format'
complete -f -c git -n '__fish_git_using_command status' -s z -d 'Terminate entries with NUL character'
complete -f -c git -n '__fish_git_using_command status' -s u -l untracked-files -x -a 'no normal all' -d 'The untracked files handling mode'
complete -f -c git -n '__fish_git_using_command status' -l ignore-submodules -x -a 'none untracked dirty all' -d 'Ignore changes to submodules'
# TODO options
### tag
complete -f -c git -n '__fish_git_needs_command' -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
complete -f -c git -n '__fish_git_using_command tag; and __fish_not_contain_opt -s d; and __fish_not_contain_opt -s v; and test (count (commandline -opc | grep -v -e \'^-\')) -eq 3' -a '(__fish_git_branches)' -d 'Branch'
complete -f -c git -n '__fish_git_using_command tag' -s d -d 'Remove a tag'
complete -f -c git -n '__fish_git_using_command tag' -s v -d 'Verify signature of a tag'
complete -f -c git -n '__fish_git_using_command tag' -s f -d 'Force overwriting exising tag'
complete -f -c git -n '__fish_git_using_command tag' -s s -d 'Make a GPG-signed tag'
complete -f -c git -n '__fish_contains_opt -s d' -a '(__fish_git_tags)' -d 'Tag'
complete -f -c git -n '__fish_contains_opt -s v' -a '(__fish_git_tags)' -d 'Tag'
# TODO options
### config
complete -f -c git -n '__fish_git_needs_command' -a config -d 'Set and read git configuration variables'
# TODO options
### format-patch
complete -f -c git -n '__fish_git_needs_command' -a format-patch -d 'Generate patch series to send upstream'
complete -f -c git -n '__fish_git_using_command format-patch' -a '(__fish_git_branches)' -d 'Branch'
## git submodule
complete -f -c git -n '__fish_git_needs_command' -a submodule -d 'Initialize, update or inspect submodules'
complete -f -c git -n '__fish_git_using_command submodule' -a 'add status init update summary foreach sync' -d 'Make a GPG-signed tag'
## git whatchanged
complete -f -c git -n '__fish_git_needs_command' -a whatchanged -d 'Show logs with difference each commit introduces'
## Aliases (custom user-defined commands)
complete -c git -n '__fish_git_needs_command' -a '(git config --get-regexp alias | sed -e "s/^alias\.\(\S\+\).*/\1/")' -d 'Alias (user-defined command)'

View File

@@ -0,0 +1,12 @@
#
# Command specific completions for the groupadd command.
# These completions where generated from the commands
# man page by the make_completions.py script, but may
# have been hand edited since.
#
complete -c groupadd -s f --description 'Exit with success status if the specified group already exists'
complete -c groupadd -s g --description 'The numerical value of the group\'s ID'
complete -c groupadd -s h -l help --description 'Display help message and exit'
complete -c groupadd -s K --description 'Overrides default key/value pairs from /etc/login'
complete -c groupadd -s o --description 'This option permits to add group with non-unique GID'

View File

@@ -0,0 +1,4 @@
complete -c gv -x -a "(__fish_complete_suffix .ps)"
complete -c gv -x -a "(__fish_complete_suffix .ps.gz)"
complete -c gv -x -a "(__fish_complete_suffix .eps)"
complete -c gv -x -a "(__fish_complete_suffix .pdf)"

View File

@@ -0,0 +1,5 @@
# Completions for top
complete -c htop -s d --description "Update interval" -x
complete -c htop -s u --description "Monitor effective UID" -x -a "(__fish_complete_users)"
complete -c htop -l sort-key -d 'Sort column' -xa "(htop --sort-key '')"

View File

@@ -0,0 +1,2 @@
complete -x -c ifdown -a "(__fish_print_interfaces)" --description "Network interface"
complete -c ifdown -l force --description "force"

View File

@@ -0,0 +1,2 @@
complete -x -c ifup -a "(__fish_print_interfaces)" --description "Network interface"
complete -c ifup -l force --description "force"

View File

@@ -0,0 +1,18 @@
function __fish_invoke_rcd_has_service
set tokens (commandline -opc)
if [ (count $tokens) -eq 2 ]
return 0
else
return 1
end
end
complete -f -c invoke-rc.d -n 'not __fish_invoke_rcd_has_service' -a '(__fish_print_debian_services)'
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'start' -d 'Start the service'
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'stop' -d 'Stop the service'
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'restart' -d 'Restart the service'
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'reload' -d 'Reload Configuration'
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'force-reload' -d 'Force reloading configuration'
complete -f -c invoke-rc.d -n '__fish_invoke_rcd_has_service' -a 'status' -d 'Print the status of the service'

View File

@@ -1,30 +1,6 @@
# Completions for the kill command
__fish_make_completion_signals
set -l signals
if kill -L ^/dev/null >/dev/null
# Debian and some related systems use 'kill -L' to write out a numbered list
# of signals. Use this to complete on both number _and_ on signal name.
complete -c kill -s L --description "List codes and names of available signals"
set signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ //' | sgrep -E '^[^ ]+')
else
# Posix systems print out the name of a signal using 'kill -l
# SIGNUM', so we use this instead.
complete -c kill -s l --description "List names of available signals"
for i in (seq 31)
set signals $signals $i" "(kill -l $i)
end
end
for i in $signals
for i in $__kill_signals
set number (echo $i | cut -d " " -f 1)
set name (echo $i | cut -d " " -f 2)
complete -c kill -o $number -d $name
@@ -33,6 +9,5 @@ for i in $signals
complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
end
complete -c kill -xa '(__fish_complete_pids)'

View File

@@ -0,0 +1,20 @@
__fish_make_completion_signals
for i in $__kill_signals
set number (echo $i | cut -d " " -f 1)
set name (echo $i | cut -d " " -f 2)
complete -c killall -o $number -d $name
complete -c killall -o $name -d $name
complete -c killall -o s -x -a \"$number\tSend\ $name\ signal\"
complete -c killall -o s -x -a \"$name\tSend\ $name\ signal\"
end
complete -c killall -xa '(__fish_complete_proc)'
complete -c killall -s e -l exact -d 'Require an exact match for very long names'
complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
complete -c killall -s i -l interactive -d 'Interactively ask for confirmation before killing'
complete -c killall -s u -l user -d 'Kill only processes the specified user owns. Command names are optional'
complete -c killall -s w -l wait -d 'Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state'

View File

@@ -0,0 +1,7 @@
complete -c latexmk -x -a "(__fish_complete_suffix (commandline -ct) .tex '(La)TeX file')"
complete -c latexmk -o dvi -d "Make dvi"
complete -c latexmk -o ps -d "Make ps dvi->ps"
complete -c latexmk -o pdf -d "Make pdf"
complete -c latexmk -o pdfps -d "Make pdf dvi->ps->pdf"
complete -c latexmk -o pdfdvi -d "Make pdf dvi->pdf"

18
share/completions/ln.fish Normal file
View File

@@ -0,0 +1,18 @@
# completions for ln
# Author: SanskritFritz (gmail)
complete -c ln -f -s s -l symbolic -d 'make symbolic links instead of hard links'
complete -c ln -f -l backup=CONTROL -d 'make a backup of each existing destination file'
complete -c ln -f -s b -d 'like --backup but does not accept an argument'
complete -c ln -f -s d -l directory -d 'allow the superuser to attempt to hard link directories'
complete -c ln -f -s f -l force -d 'remove existing destination files'
complete -c ln -f -s i -l interactive -d 'prompt whether to remove destinations'
complete -c ln -f -s L -l logical -d 'make hard links to symbolic link references'
complete -c ln -f -s n -l no-dereference -d 'treat destination that is a symlink to a directory as if it were a normal file'
complete -c ln -f -s P -l physical -d 'make hard links directly to symbolic links'
complete -c ln -f -s S -l suffix=SUFFIX -d 'override the usual backup suffix'
complete -c ln -f -s t -l target-directory=DIRECTORY -d 'specify the DIRECTORY in which to create the links'
complete -c ln -f -s T -l no-target-directory -d 'treat LINK_NAME as a normal file'
complete -c ln -f -s v -l verbose -d 'print name of each linked file'
complete -c ln -f -l help -d 'display this help and exit'
complete -c ln -f -l version -d 'output version information and exit'

View File

@@ -0,0 +1,2 @@
__fish_complete_tex lualatex

Some files were not shown because too many files have changed in this diff Show More