Skip to content

Commit

Permalink
feat: when command plugin show was executed without entering a plugin…
Browse files Browse the repository at this point in the history
… id, show the list of available plugins to select

FossilOrigin-Name: 5716c30dbd42f57e88d266a202b8483638bb54eacd1f1c457fd0968e8d66a59b
  • Loading branch information
thindil committed Jan 12, 2024
1 parent f358580 commit 18112ba
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/plugins.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 18112ba

Please sign in to comment.