Skip to content

Commit 90f3df7

Browse files
committed
refactor: line number option
1 parent 34ca8da commit 90f3df7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/kotlin/spp/cli/commands/developer/instrument/AddBreakpoint.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AddBreakpoint : CliktCommand(name = "breakpoint", help = "Add a live break
4242

4343
private val log = LoggerFactory.getLogger(AddBreakpoint::class.java)
4444
val source by argument(help = "Qualified class name")
45-
val line by argument(help = "Line number").int()
45+
val line by option("-line", "-l", help = "Line number").int()
4646
val id by option("-id", "-i", help = "Breakpoint identifier")
4747
val condition by option("-condition", "-c", help = "Trigger condition")
4848
val expiresAt by option("-expiresAt", "-e", help = "Expiration time (epoch time [ms])").long()
@@ -53,7 +53,7 @@ class AddBreakpoint : CliktCommand(name = "breakpoint", help = "Add a live break
5353

5454
override fun run() = runBlocking {
5555
val input = LiveBreakpointInput(
56-
location = LiveSourceLocationInput(source, line),
56+
location = LiveSourceLocationInput(source, Optional.presentIfNotNull(line)),
5757
condition = Optional.Present(condition),
5858
expiresAt = Optional.Present(expiresAt),
5959
hitLimit = Optional.Present(hitLimit),

src/main/kotlin/spp/cli/commands/developer/instrument/AddLog.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ import spp.protocol.instrument.throttle.ThrottleStep
4141
class AddLog : CliktCommand(name = "log", help = "Add a live log instrument") {
4242

4343
val source by argument(help = "Qualified class name")
44-
val line by argument(help = "Line number").int()
4544
val logFormat by argument(help = "Log format")
45+
val line by option("-line", "-l", help = "Line number").int()
4646
val logArguments by option("-logArgument", "-l", help = "Log argument").multiple()
4747
val id by option("-id", "-i", help = "Log identifier")
4848
val condition by option("-condition", "-c", help = "Trigger condition")
@@ -56,7 +56,7 @@ class AddLog : CliktCommand(name = "log", help = "Add a live log instrument") {
5656
val input = LiveLogInput(
5757
logFormat = logFormat,
5858
logArguments = Optional.Present(logArguments),
59-
location = LiveSourceLocationInput(source, line),
59+
location = LiveSourceLocationInput(source, Optional.presentIfNotNull(line)),
6060
condition = Optional.Present(condition),
6161
expiresAt = Optional.Present(expiresAt),
6262
hitLimit = Optional.Present(hitLimit),

src/main/kotlin/spp/cli/commands/developer/instrument/AddMeter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ import spp.protocol.instrument.throttle.ThrottleStep
4343
class AddMeter : CliktCommand(name = "meter", help = "Add a live meter instrument") {
4444

4545
val source by argument(help = "Qualified class name")
46-
val line by argument(help = "Line number").int()
4746
val meterType by argument(help = "Meter type").enum<MeterType>()
4847
val valueType by argument(help = "Metric value type").enum<MetricValueType>()
48+
val line by option("-line", "-l", help = "Line number").int()
4949
val value by option("-value", "-v", help = "Metric value")
5050
val id by option("-id", "-i", help = "Meter identifier")
5151
val condition by option("-condition", "-c", help = "Trigger condition")
@@ -63,7 +63,7 @@ class AddMeter : CliktCommand(name = "meter", help = "Add a live meter instrumen
6363
value = Optional.presentIfNotNull(value)
6464
),
6565
id = Optional.presentIfNotNull(id),
66-
location = LiveSourceLocationInput(source, line),
66+
location = LiveSourceLocationInput(source, Optional.presentIfNotNull(line)),
6767
condition = Optional.Present(condition),
6868
expiresAt = Optional.Present(expiresAt),
6969
hitLimit = Optional.Present(hitLimit),

0 commit comments

Comments
 (0)