Commit graph

195 commits

Author SHA1 Message Date
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
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
ceba377ab8 use is_interactive instead of isatty to test whether we are in interactive mode 2010-10-13 04:30:23 +08:00
James Buren
41ae7bccc2 silences some warnings outputted by gcc with -Wall and -Wextra 2010-10-08 08:43:57 +08:00
Grissiom
1b9dd0c75f Merge remote branch 'origin/otherchirps-dev' 2010-09-19 14:12:30 +08:00
Grissiom
04951f8b34 reader_read( 0... => reader_read( STDIN_FILENO 2010-09-18 20:26:54 +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
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
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
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
liljencrantz
6598320534 Remove useless stray argument in function call
darcs-hash:20080116222628-75c98-a307fbeacdd815edcedea05930dc8b4bb064acb3.gz
2008-01-17 08:26:28 +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
87db9517e9 Add lots of new code comments.
darcs-hash:20080113164747-75c98-9d0cefd27be7aef7ba60772616d9da7e6bb52912.gz
2008-01-14 02:47:47 +10:00
liljencrantz
2229fad410 Fix bug in return and block builtins - they where unable to handle functions that do not shadow the calling scope
darcs-hash:20080109030136-75c98-05f7a48cd991ac24e15d7e8b580caef0396ff59c.gz
2008-01-09 13:01:36 +10:00
liljencrantz
348e991d7c Indentation fixes, add a few comments, spelling, etc.
darcs-hash:20071028090840-75c98-2ae076441517cd7a0d8172fad28edaf6f034b70c.gz
2007-10-28 19:08:40 +10:00
liljencrantz
175dd75a3d Tiny touchups of docs and code
darcs-hash:20071006105527-75c98-339c5d7ec2fbae0c2d4dc93552db85c389971a6a.gz
2007-10-06 20:55:27 +10:00
liljencrantz
713c84d821 Make the . builtin have a more useful (and posix-compatible) exit status
darcs-hash:20071005145808-75c98-17100c1e321b8bca06f75e900db1386451232f98.gz
2007-10-06 00:58:08 +10:00
liljencrantz
d34d05ca8b Comment updates, minor code cleanups and other janitorial jobs
darcs-hash:20071002100937-75c98-d4040e70a256e36a6334cca0a05d60500680132b.gz
2007-10-02 20:09:37 +10:00
liljencrantz
97b77d1b3a Indentation and comments
darcs-hash:20070928213922-75c98-96ae445e28ad3273c98ddc4ca16597988eb66d37.gz
2007-09-29 07:39:22 +10:00
liljencrantz
f28e83d3e9 Improve error reporting for bind builtin
darcs-hash:20070928213523-75c98-bd88022a63af1409ae28ae0829280df9652dcaff.gz
2007-09-29 07:35:23 +10:00
liljencrantz
0e716763d8 Replace variadic functions like sb_append and contains_str with variadic macros without a sentinel.
darcs-hash:20070928213227-75c98-2e7b06242acfd5fd0bf02ce77c41d52374f2363a.gz
2007-09-29 07:32:27 +10:00
liljencrantz
cf8e746d0c First stab at dropping all support for readlines inputrc files and instead using an internal system for performing keybinding.
darcs-hash:20070925161447-75c98-1feaef88a4b518badb7879f598f06ab650a8f93b.gz
2007-09-26 02:14:47 +10:00
liljencrantz
710a01c945 Improve error reporting in the . builtin
darcs-hash:20070924081428-75c98-72b9f1dfe64a40b0f7893c9ebcb59f477f6c924c.gz
2007-09-24 18:14:28 +10:00
liljencrantz
e6b9955fc1 Add switch fo scope hiding in output of functions builtin
darcs-hash:20070922221920-75c98-7a17d24162a3fbdfd9c05690d2358511a3ca0281.gz
2007-09-23 08:19:20 +10:00
liljencrantz
c0aac8996d Improve documentation for breakpoint builtin
darcs-hash:20070921151654-75c98-550df5aebaa11855c53585202ab7fafe7c5820ad.gz
2007-09-22 01:16:54 +10:00
liljencrantz
607e970659 Further improve accuracy of cd builtins error messages. Now correctly reports rotten symlinks.
darcs-hash:20070920175243-75c98-e210034c7bfc8308be9e03017a5a0d8ef7648b9c.gz
2007-09-21 03:52:43 +10:00
liljencrantz
3b39b1fa03 Significantly improve accuracy of error reporting in the cd builtin
darcs-hash:20070920172928-75c98-826cd86e1c33e1f6c746227655e340a6bb459f30.gz
2007-09-21 03:29:28 +10:00
liljencrantz
370aeec44d Fix bug in the count builtin, causing it to exit with status 0 even if no arguments where given
darcs-hash:20070909135734-75c98-2d0495a15440e50fb6521bffef85147832771c80.gz
2007-09-09 23:57:34 +10:00
liljencrantz
b0ae3dc9cc Handle merge confligt for previous patches. The exact same bug was fixed twice.
darcs-hash:20070908222725-75c98-2e1d0b090608d71f452c6ba7c3e1281782ebec11.gz
2007-09-09 08:27:25 +10:00
Claes Nästén
c2c4b24174 Fix issue in error handling, reported to and fixed by Axel Liljencrantz. Change val[0] and body[0] in env universal to val[1] and body[1] to support compilation with Sun Studio. Change default prompt to use pekdon instead of whoami as it does not exist under Solaris.
darcs-hash:20070822080052-cac88-326332f0df7d17ddca4a4496c93728a47f19bba5.gz
2007-08-22 18:00:52 +10:00
liljencrantz
151943f89e Indentation, typo and formating fixes. Very minor patch.
darcs-hash:20070908222453-75c98-2236d962f0c9016820063e871fbbeaa42f36ef22.gz
2007-09-09 08:24:53 +10:00
liljencrantz
ad02bb9b48 Add a 'generic' type of event that can be emited from any piece of code or by the user. Use this event layer to perform interactive configuration startup at the correct time.
darcs-hash:20070819164230-75c98-f91b8a73de7bbbb500d80770ddf4d2d46ae592cc.gz
2007-08-20 02:42:30 +10:00
liljencrantz
e076f2c239 Make the contains builtin not allow reordering of switches and non-switches
darcs-hash:20070814214257-75c98-a50161a8146dfd0a6c6a948e1960f93dd52275fd.gz
2007-08-15 07:42:57 +10:00
liljencrantz
0a0870180d Fix duplicate switch antry in builtin_status. Don't know if this was caused by patch bug or typo.
darcs-hash:20070801225421-75c98-8c91f5fb00ccc05ac40ef12ffbfc68fec5e64dd0.gz
2007-08-02 08:54:21 +10:00
liljencrantz
972edef341 Replace the contains function with a builtin for performance reasons. The contains function used at lots of forks, which was noticable on systems such as OS X with slow forks, as well as on completions that do a lot of tests, like svn
darcs-hash:20070801225318-75c98-48cc4d685ab665c7c2eb93ac3c374bf5afecd28a.gz
2007-08-02 08:53:18 +10:00
James Vega
8ed521c817 Update status builtin to properly handle and document all of its options.
darcs-hash:20070801194450-35ec8-e2fe5b798e728d1caef474295a92230c35c79c17.gz
2007-08-02 05:44:50 +10:00
axel
91de143003 Replace the count function with a builtin for performance reasons. The count function used at least two forks, which was noticable on systems such as OS X with slow forks
darcs-hash:20070731212332-ac50b-8f5b2e70008ddb131dc8bae3f361d8d65a294948.gz
2007-08-01 07:23:32 +10:00
axel
748d726ddf Replace the count function with a builtin for performance reasons. The count function used at least two forks, which was noticable on systems such as OS X with slow forks
darcs-hash:20070731212320-ac50b-3bae489646f359ca86bb1f049901860ce9aedd5f.gz
2007-08-01 07:23:20 +10:00
axel
d0585befb3 Make sure that io redirections are respected by the '.' builtin. This was not the case earlier, which caused various bugs, especially after eval was made into a function that internally used '.'
darcs-hash:20070425183002-ac50b-d7d93e3b74e7274fe3e0aad98e95dd608bb903ae.gz
2007-04-26 04:30:02 +10:00
axel
c00e1fcf26 Fix bug in stack trace printing code
darcs-hash:20070424060620-ac50b-174e68e78bc2b1d6e5e3f5787e4a252cad95911c.gz
2007-04-24 16:06:20 +10:00
axel
2c02b59703 Replace the eval builtin with a function
darcs-hash:20070422221806-ac50b-28cffc6c3063c14cd8ab30f999e3530314c78af2.gz
2007-04-23 08:18:06 +10:00
axel
ee94424b0f Add the possibility for functions which do not shadow the arguments of the calling function
darcs-hash:20070422221033-ac50b-d9544c87d0ddab10f7f503b5a1707292f266efe4.gz
2007-04-23 08:10:33 +10:00
axel
2b7535bb51 Make the . (source) builtin able to read commands from stdin
darcs-hash:20070422211947-ac50b-b8d33d81fcef5e0b7e76a8d2a9f0bcbcf3ac67b7.gz
2007-04-23 07:19:47 +10:00
axel
c5805cfd47 Validate variables names when using named arguments for functions
darcs-hash:20070422211624-ac50b-11920a8a00c7bae97c3556bc7ce47b3022c34f08.gz
2007-04-23 07:16:24 +10:00
axel
7ca76ef743 Make 'functions' builtin print named arguments of functions
darcs-hash:20070422211534-ac50b-3293f1d733a8a3be760f344598bfae8b77647b2f.gz
2007-04-23 07:15:34 +10:00
axel
2c743173d3 Fix minor memory leak on printing help for builtins
darcs-hash:20070422211451-ac50b-42293b46e39cd5d0cfdf2ca63effe12faa048970.gz
2007-04-23 07:14:51 +10:00
axel
003dfb99da Prettyfy output of 'functions' builtin a tiny bit
darcs-hash:20070422185627-ac50b-99b7c27d06f5a6d5e7a7b66da864317bf1019fe2.gz
2007-04-23 04:56:27 +10:00