Commit graph

187 commits

Author SHA1 Message Date
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
axel
45412f2b1f Move keyword detection code to separate file
darcs-hash:20070422095026-ac50b-77a840e2830370f46b7a48fd8863095d2cd7a5f0.gz
2007-04-22 19:50:26 +10:00
axel
5c9570eb56 Minor code tweaks
darcs-hash:20070416201053-ac50b-99d3ee51ef2b3642c737c3809bc2a4bfbe103b67.gz
2007-04-17 06:10:53 +10:00
axel
4d6751c274 Allow named arguments to function instead of only $argv. Philip Ganchev once suggested this, and it was suggested again by Egil Möller.
darcs-hash:20070416200611-ac50b-5eb42c94a65a4e72cae12cd9c04424bdc3b2b4f8.gz
2007-04-17 06:06:11 +10:00
axel
6616543991 Add breakpoint builtin
darcs-hash:20061111105400-ac50b-18b9165f8719efd45b46e3b3786f7079edd721e7.gz
2006-11-11 20:54:00 +10:00
axel
766482d90e Fix bug in read builtin - signal handlers where not correctly set, causiong ^C not to work
darcs-hash:20070201002053-ac50b-b73e22cbeecaeb364974cd2c512efbd517bb90d3.gz
2007-02-01 10:20:53 +10:00
axel
ba6661e9df Fix occasional duplicate stack trace, reported by Mike Roberts. Also make fish less likely to print huge amounts of help in non-interactive mode, as per suggestion from Mike Roberts.
darcs-hash:20070131160317-ac50b-8354948f55a1478515ebfe7ddb6db14b6775dd18.gz
2007-02-01 02:03:17 +10:00
axel
ba932b6590 Add support for -s switch to read builtin, enables shell syntax highlighting in the read builtin
darcs-hash:20070129162624-ac50b-dff9d9ebf16ce3247b83d917efbffd4942cda83f.gz
2007-01-30 02:26:24 +10:00
axel
85241817f8 Drop unneeded generic descriptions for completion of functions and builtins. Add description for count.
darcs-hash:20070127020752-ac50b-62dba47967cac04cd242894bfaa03116461883f3.gz
2007-01-27 12:07:52 +10:00