Skip to content

Commit

Permalink
chore: fixed some issues reported by nimalyzer
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 71b7dd99c9858e6dfb97745a9504415b87c91e68dde30f6c845406ab73ef0dd0
  • Loading branch information
thindil committed Nov 2, 2024
1 parent f620774 commit 0941073
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/output.nim
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,17 @@ proc showFormHeader*(message; width: ColumnAmount = (try: terminalWidth(
db != nil
body:
type LocalOption = ref object
value: string
value: OptionValue
proc initLocalOption(value: OptionValue = ""): LocalOption {.raises: [],
tags: [], contractual.} =
## Initialize a new instance of LocalOptions object
##
## * value - the value of the option. Can be empty. Default value is empty
##
## Returns the new instance of LocalOption object
result = LocalOption(value: value)
try:
var option: LocalOption = LocalOption()
var option: LocalOption = initLocalOption()
db.rawSelect(qry = "SELECT value FROM options WHERE option='outputHeaders'", obj = option)
let headerType: DbString = option.value
if headerType == "hidden":
Expand Down Expand Up @@ -190,7 +198,8 @@ proc showFormHeader*(message; width: ColumnAmount = (try: terminalWidth(
e = getCurrentException(), db = db)

proc selectOption*(options: Table[char, string];
default: char; prompt: OutputMessage; db): char {.sideEffect, raises: [], tags: [ReadIOEffect,
default: char; prompt: OutputMessage; db): char {.sideEffect, raises: [],
tags: [ReadIOEffect,
WriteIOEffect, RootEffect], contractual.} =
## Show the list of options from which the user can select one value
##
Expand Down Expand Up @@ -250,8 +259,8 @@ proc confirm*(prompt: OutputMessage; db): bool {.sideEffect, raises: [], tags: [
discard
return inputChar in {'y', 'Y'}

proc showFormPrompt*(prompt: OutputMessage; db) {.sideEffect, raises: [], tags: [
ReadIOEffect, WriteIOEffect, RootEffect], contractual.} =
proc showFormPrompt*(prompt: OutputMessage; db) {.sideEffect, raises: [],
tags: [ReadIOEffect, WriteIOEffect, RootEffect], contractual.} =
## Show the prompt in the shell's forms
##
## * prompt - the text displayed as a form's prompt
Expand Down

0 comments on commit 0941073

Please sign in to comment.