From 086f487786f5ec34181caa10626c3d0c22a3cdbc Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 22 May 2026 10:17:33 -0400 Subject: [PATCH] fix(driver-s7-cli): resolve Medium code-review finding (Driver.S7.Cli-002) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trim the --type help text on read and subscribe to the implemented set (Bool/Byte/Int16/UInt16/Int32/UInt32/Float32) and append a one-line caveat that Int64, UInt64, Float64, String, and DateTime are not yet implemented and will return BadNotSupported — so the CLI does not advertise options that cannot succeed. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Commands/ReadCommand.cs | 7 +++++-- .../Commands/SubscribeCommand.cs | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/ReadCommand.cs b/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/ReadCommand.cs index 36a43ae..0286df2 100644 --- a/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/ReadCommand.cs +++ b/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/ReadCommand.cs @@ -19,9 +19,12 @@ public sealed class ReadCommand : S7CommandBase IsRequired = true)] public string Address { get; init; } = default!; + // Driver.S7.Cli-002: help text trimmed to the types the driver actually implements. + // Int64 / UInt64 / Float64 / String / DateTime are defined in S7DataType but the driver + // raises NotSupportedException (→ BadNotSupported) on reads of those types. [CommandOption("type", 't', Description = - "Bool / Byte / Int16 / UInt16 / Int32 / UInt32 / Int64 / UInt64 / Float32 / Float64 / " + - "String / DateTime (default Int16).")] + "Bool / Byte / Int16 / UInt16 / Int32 / UInt32 / Float32 (default Int16). " + + "Int64, UInt64, Float64, String, and DateTime are not yet implemented and will return BadNotSupported.")] public S7DataType DataType { get; init; } = S7DataType.Int16; [CommandOption("string-length", Description = diff --git a/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/SubscribeCommand.cs b/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/SubscribeCommand.cs index e69e586..dbe5983 100644 --- a/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/SubscribeCommand.cs +++ b/src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.S7.Cli/Commands/SubscribeCommand.cs @@ -15,9 +15,10 @@ public sealed class SubscribeCommand : S7CommandBase [CommandOption("address", 'a', Description = "S7 address — same format as `read`.", IsRequired = true)] public string Address { get; init; } = default!; + // Driver.S7.Cli-002: help text trimmed to the types the driver actually implements. [CommandOption("type", 't', Description = - "Bool / Byte / Int16 / UInt16 / Int32 / UInt32 / Int64 / UInt64 / Float32 / Float64 / " + - "String / DateTime (default Int16).")] + "Bool / Byte / Int16 / UInt16 / Int32 / UInt32 / Float32 (default Int16). " + + "Int64, UInt64, Float64, String, and DateTime are not yet implemented and will return BadNotSupported.")] public S7DataType DataType { get; init; } = S7DataType.Int16; [CommandOption("interval-ms", 'i', Description = "Publishing interval ms (default 1000).")]