add status command

This commit is contained in:
Richard Frith-Macdonald 2019-05-09 12:22:36 +01:00
parent a990abc848
commit 530ec43cfc
2 changed files with 37 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2019-05-09 Richard Frith-Macdonald <rfm@gnu.org>
* EcCommand.m: Add status command for daiagnostics.
2019-05-05 Richard Frith-Macdonald <rfm@gnu.org>
* EcCommand.m:

View file

@ -1019,7 +1019,7 @@ static NSMutableDictionary *launchInfo = nil;
{
m = @"Commands are -\n"
@"Help\tArchive\tControl\tLaunch\tList\tMemory\t"
@"Quit\tRestart\tResume\tSuspend\tTell\n\n"
@"Quit\tRestart\tResume\tStatus\tSuspend\tTell\n\n"
@"Type 'help' followed by a command word for details.\n"
@"A command line consists of a sequence of words, "
@"the first of which is the command to be executed. "
@ -1098,6 +1098,10 @@ static NSMutableDictionary *launchInfo = nil;
m = @"Resumes the launching/relaunching of tasks.\n"
@"Has no effect if launching has not been suspended.\n";
}
else if (comp(wd, @"Status") >= 0)
{
m = @"Reports the status of the Command server.\n";
}
else if (comp(wd, @"Suspend") >= 0)
{
m = @"Suspends the launching/relaunching of tasks.\n"
@ -1283,8 +1287,8 @@ static NSMutableDictionary *launchInfo = nil;
}
else
{
m = [m stringByAppendingString:
@"autolaunch in a few minutes\n"];
m = [m stringByAppendingFormat:
@"autolaunch at %@\n", date];
}
}
else
@ -1312,8 +1316,8 @@ static NSMutableDictionary *launchInfo = nil;
}
else
{
m = [m stringByAppendingString:
@"autolaunch in a few minutes\n"];
m = [m stringByAppendingFormat:
@"autolaunch at %@\n", date];
}
}
}
@ -1589,6 +1593,10 @@ static NSMutableDictionary *launchInfo = nil;
m = @"Launching was/is not suspended.\n";
}
}
else if (comp(wd, @"status") >= 0)
{
m = [self description];
}
else if (comp(wd, @"suspend") >= 0)
{
if (YES == launchSuspended)
@ -1916,6 +1924,26 @@ static NSMutableDictionary *launchInfo = nil;
[super dealloc];
}
- (NSString*) description
{
NSMutableString *m;
m = [NSMutableString stringWithFormat: @"%@ running since %@\n",
[super description], [self ecStarted]];
[m appendFormat: @" Active clients: %u\n", (unsigned) [clients count]];
if (launchSuspended)
{
[m appendString: @" Launching is currently suspended.\n"];
}
if ([launching count] > 0)
{
[m appendFormat: @" Launching: %u of %u concurrently allowed.\n",
(unsigned)[launching count], (unsigned)launchLimit];
[m appendFormat: @" Names: %@\n", [launching allKeys]];
}
return m;
}
- (NSArray*) findAll: (NSArray*)a
byAbbreviation: (NSString*)s
{