aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--builtin.c59
-rw-r--r--doc_src/status.txt8
2 files changed, 59 insertions, 8 deletions
diff --git a/builtin.c b/builtin.c
index df6eba19..86e6f27b 100644
--- a/builtin.c
+++ b/builtin.c
@@ -364,6 +364,18 @@ static void builtin_unknown_option( const wchar_t *cmd, const wchar_t *opt )
builtin_print_help( cmd, sb_err );
}
+/**
+ Perform error reporting for encounter with missing argument
+*/
+static void builtin_missing_argument( const wchar_t *cmd, const wchar_t *opt )
+{
+ sb_printf( sb_err,
+ BUILTIN_ERR_MISSING,
+ cmd,
+ opt );
+ builtin_print_help( cmd, sb_err );
+}
+
/*
Here follows the definition of all builtin commands. The function
names are all on the form builtin_NAME where NAME is the name of the
@@ -1913,19 +1925,19 @@ static int builtin_status( wchar_t **argv )
}
,
{
- L"is-command-substitution", no_argument, &mode, IS_SUBST
+ L"is-command-substitution", no_argument, 0, 'c'
}
,
{
- L"is-block", no_argument, &mode, IS_BLOCK
+ L"is-block", no_argument, 0, 'b'
}
,
{
- L"is-interactive", no_argument, &mode, IS_INTERACTIVE
+ L"is-interactive", no_argument, 0, 'i'
}
,
{
- L"is-login", no_argument, &mode, IS_LOGIN
+ L"is-login", no_argument, 0, 'l'
}
,
{
@@ -1941,11 +1953,11 @@ static int builtin_status( wchar_t **argv )
}
,
{
- L"current-filename", no_argument, &mode, CURRENT_FILENAME
+ L"current-filename", no_argument, 0, 'f'
}
,
{
- L"current-line-number", no_argument, &mode, CURRENT_LINE_NUMBER
+ L"current-line-number", no_argument, 0, 'n'
}
,
{
@@ -1968,7 +1980,7 @@ static int builtin_status( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
- L"hj:t",
+ L":cbilfnhj:t",
long_options,
&opt_index );
if( opt == -1 )
@@ -1984,9 +1996,32 @@ static int builtin_status( wchar_t **argv )
argv[0],
long_options[opt_index].name );
builtin_print_help( argv[0], sb_err );
-
return STATUS_BUILTIN_ERROR;
+ case 'c':
+ mode = IS_SUBST;
+ break;
+
+ case 'b':
+ mode = IS_BLOCK;
+ break;
+
+ case 'i':
+ mode = IS_INTERACTIVE;
+ break;
+
+ case 'l':
+ mode = IS_LOGIN;
+ break;
+
+ case 'f':
+ mode = CURRENT_FILENAME;
+ break;
+
+ case 'n':
+ mode = CURRENT_LINE_NUMBER;
+ break;
+
case 'h':
builtin_print_help( argv[0], sb_out );
return STATUS_BUILTIN_OK;
@@ -2013,6 +2048,14 @@ static int builtin_status( wchar_t **argv )
break;
+ case 't':
+ mode = STACK_TRACE;
+ break;
+
+ case ':':
+ builtin_missing_argument( argv[0], argv[woptind-1] );
+ return STATUS_BUILTIN_ERROR;
+
case '?':
builtin_unknown_option( argv[0], argv[woptind-1] );
return STATUS_BUILTIN_ERROR;
diff --git a/doc_src/status.txt b/doc_src/status.txt
index 65896f2b..de05b512 100644
--- a/doc_src/status.txt
+++ b/doc_src/status.txt
@@ -8,3 +8,11 @@
- <tt>-b</tt> or <tt>--is-block</tt> returns 0 if fish is currently executing a block of code
- <tt>-i</tt> or <tt>--is-interactive</tt> returns 0 if fish is interactive, i.e.connected to a keyboard
- <tt>-l</tt> or <tt>--is-login</tt> returns 0 if fish is a login shell, i.e. if fish should perform login tasks such as setting up the PATH.
+- <tt>--is-full-job-control</tt> returns 0 if full job control is enabled
+- <tt>--is-interactive-job-control</tt> returns 0 if interactive job control is enabled
+- <tt>--is-no-job-control</tt> returns 0 if no job control is enabled
+- <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>-h</tt> or <tt>--help</tt> display a help message and exit