From 18112bab123244a88b0bbd72412307e4d116b354 Mon Sep 17 00:00:00 2001 From: thindil Date: Fri, 12 Jan 2024 05:13:55 +0000 Subject: [PATCH] feat: when command plugin show was executed without entering a plugin id, show the list of available plugins to select FossilOrigin-Name: 5716c30dbd42f57e88d266a202b8483638bb54eacd1f1c457fd0968e8d66a59b --- src/plugins.nim | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins.nim b/src/plugins.nim index f94b005a..2a8c1c71 100644 --- a/src/plugins.nim +++ b/src/plugins.nim @@ -793,16 +793,10 @@ proc showPlugin*(arguments; db; commands): ResultCode {.sideEffect, raises: [], arguments.len > 0 db != nil body: - if arguments.len < 6: - return showError(message = "Enter the ID of the plugin to show.", db = db) - let id: DatabaseId = try: - parseInt(s = $arguments[5 .. ^1]).DatabaseId - except ValueError: - return showError(message = "The Id of the plugin must be a positive number.", db = db) + let id: DatabaseId = getPluginId(arguments = arguments, db = db) + if id.Natural == 0: + return QuitFailure.ResultCode try: - if not db.exists(T = Plugin, cond = "id=?", params = $id): - return showError(message = "The plugin with the ID: " & $id & - " doesn't exists.", db = db) var plugin: Plugin = newPlugin() db.select(obj = plugin, cond = "id=?", params = $id) var table: TerminalTable = TerminalTable()