feat(cli): --mes-reportable on template alarm add/update and instance alarm-override set
Claude-Session: https://claude.ai/code/session_01Y5ef34iUUMjmwnMpL9xgmB
This commit is contained in:
@@ -553,8 +553,9 @@ public static class InstanceCommands
|
||||
var setAlarmOption = new Option<string>("--alarm") { Description = "Alarm canonical name (e.g., 'TempLevels' or 'Pump.TempSensor.Heat')", Required = true };
|
||||
var setConfigOption = new Option<string?>("--trigger-config") { Description = "JSON override for TriggerConfiguration (HiLo: partial merge; others: whole-replace)" };
|
||||
var setPriorityOption = new Option<int?>("--priority") { Description = "Priority override (0-1000)" };
|
||||
var setMesReportableOption = new Option<bool?>("--mes-reportable") { Description = "MES-reportable override: true or false; omit to inherit the template value" };
|
||||
var setCmd = new Command("set") { Description = "Set (upsert) an alarm override on an instance" };
|
||||
setCmd.Add(setIdOption); setCmd.Add(setAlarmOption); setCmd.Add(setConfigOption); setCmd.Add(setPriorityOption);
|
||||
setCmd.Add(setIdOption); setCmd.Add(setAlarmOption); setCmd.Add(setConfigOption); setCmd.Add(setPriorityOption); setCmd.Add(setMesReportableOption);
|
||||
setCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
@@ -563,7 +564,8 @@ public static class InstanceCommands
|
||||
result.GetValue(setIdOption),
|
||||
result.GetValue(setAlarmOption)!,
|
||||
result.GetValue(setConfigOption),
|
||||
result.GetValue(setPriorityOption)));
|
||||
result.GetValue(setPriorityOption),
|
||||
result.GetValue(setMesReportableOption)));
|
||||
});
|
||||
group.Add(setCmd);
|
||||
|
||||
|
||||
@@ -682,6 +682,8 @@ public static class TemplateCommands
|
||||
var triggerConfigOption = new Option<string?>("--trigger-config") { Description = "Trigger configuration JSON" };
|
||||
var lockedOption = new Option<bool>("--locked") { Description = "Lock status" };
|
||||
lockedOption.DefaultValueFactory = _ => false;
|
||||
var mesReportableOption = new Option<bool>("--mes-reportable") { Description = "Report this alarm to MES (IsFlaggedForMES on the alarm-status API)" };
|
||||
mesReportableOption.DefaultValueFactory = _ => false;
|
||||
|
||||
// Typed setpoint flags (alternative to raw --trigger-config; raw wins when both supplied).
|
||||
var attributeOption = new Option<string?>("--attribute") { Description = "Attribute name the trigger watches (all trigger types except Expression)" };
|
||||
@@ -714,6 +716,7 @@ public static class TemplateCommands
|
||||
addCmd.Add(descOption);
|
||||
addCmd.Add(triggerConfigOption);
|
||||
addCmd.Add(lockedOption);
|
||||
addCmd.Add(mesReportableOption);
|
||||
addCmd.Add(attributeOption);
|
||||
addCmd.Add(matchValueOption);
|
||||
addCmd.Add(notEqualsOption);
|
||||
@@ -751,7 +754,8 @@ public static class TemplateCommands
|
||||
result.GetValue(priorityOption)!,
|
||||
result.GetValue(descOption),
|
||||
triggerConfig,
|
||||
result.GetValue(lockedOption)));
|
||||
result.GetValue(lockedOption),
|
||||
result.GetValue(mesReportableOption)));
|
||||
});
|
||||
group.Add(addCmd);
|
||||
|
||||
@@ -763,6 +767,8 @@ public static class TemplateCommands
|
||||
var updateTriggerConfigOption = new Option<string?>("--trigger-config") { Description = "Trigger configuration JSON" };
|
||||
var updateLockedOption = new Option<bool>("--locked") { Description = "Lock status" };
|
||||
updateLockedOption.DefaultValueFactory = _ => false;
|
||||
var updateMesReportableOption = new Option<bool>("--mes-reportable") { Description = "Report this alarm to MES (IsFlaggedForMES on the alarm-status API)" };
|
||||
updateMesReportableOption.DefaultValueFactory = _ => false;
|
||||
// --trigger-kind for update (same semantics as add)
|
||||
var updateTriggerKindOption = new Option<string?>("--trigger-kind")
|
||||
{
|
||||
@@ -777,6 +783,7 @@ public static class TemplateCommands
|
||||
updateCmd.Add(updateDescOption);
|
||||
updateCmd.Add(updateTriggerConfigOption);
|
||||
updateCmd.Add(updateLockedOption);
|
||||
updateCmd.Add(updateMesReportableOption);
|
||||
updateCmd.Add(updateTriggerKindOption);
|
||||
updateCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
@@ -794,7 +801,8 @@ public static class TemplateCommands
|
||||
result.GetValue(updatePriorityOption)!,
|
||||
result.GetValue(updateDescOption),
|
||||
triggerConfig,
|
||||
result.GetValue(updateLockedOption)));
|
||||
result.GetValue(updateLockedOption),
|
||||
result.GetValue(updateMesReportableOption)));
|
||||
});
|
||||
group.Add(updateCmd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user