fix(driver-s7-cli): resolve Medium code-review finding (Driver.S7.Cli-002)
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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).")]
|
||||
|
||||
Reference in New Issue
Block a user