aboutsummaryrefslogtreecommitdiffhomepage
path: root/expand.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-08 18:51:52 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-08 18:51:52 -0700
commit73e56527bf581f54e77d4267985da939259eff1a (patch)
tree2fff1bf6d16def68d4d1c0da0b51529422adb6a8 /expand.cpp
parent24059924b142744e3edfd61d31af9dafb27f78e2 (diff)
Improve error message for $?
Diffstat (limited to 'expand.cpp')
-rw-r--r--expand.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/expand.cpp b/expand.cpp
index 26b6e2d5..2824b954 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -52,6 +52,11 @@ parameter expansion.
#define COMPLETE_VAR_DESC _( L"The '$' character begins a variable name. The character '%lc', which directly followed a '$', is not allowed as a part of a variable name, and variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
/**
+ Error issued on $?
+*/
+#define COMPLETE_YOU_WANT_STATUS _( L"$? is not a valid variable in fish. If you want the exit status of the last command, try $status.")
+
+/**
Error issued on invalid variable name
*/
#define COMPLETE_VAR_NULL_DESC _( L"The '$' begins a variable name. It was given at the end of an argument. Variable names may not be zero characters long. To learn more about variable expansion in fish, type 'help expand-variable'.")
@@ -724,7 +729,7 @@ void expand_variable_error( parser_t &parser, const wchar_t *token, int token_po
parser.error( SYNTAX_ERROR,
error_pos,
- COMPLETE_VAR_DESC,
+ (token_stop_char == L'?' ? COMPLETE_YOU_WANT_STATUS : COMPLETE_VAR_DESC),
token_stop_char );
break;
}