Skip to content

Commit

Permalink
feat: made the shell's options' list more human-friendly
Browse files Browse the repository at this point in the history
FossilOrigin-Name: de22db7054204ab4e55db9b1006319829f7991dfdd824f675aad04cb4241c0d3
  • Loading branch information
thindil committed Dec 18, 2023
1 parent f70c836 commit 0f267b8
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,23 @@ proc showOptions*(db): ResultCode {.sideEffect, raises: [], tags: [
objs = options)
let color: string = getColor(db = db, name = default)
for option in options:
var value: string = option.value
if value != option.defaultValue:
value &= " (changed)"
var
value: string = option.value
let suffix: string = (if value ==
option.defaultValue: "" else: " (changed)")
case option.valueType
of boolean:
if value == "true":
value = "yes"
else:
value = "no"
of historysort:
if value == "recentamount":
value = "recent and amount"
else:
discard
table.add(parts = [style(ss = option.option, style = getColor(db = db,
name = ids)), style(ss = value, style = getColor(db = db,
name = ids)), style(ss = value & suffix, style = getColor(db = db,
name = values)), style(ss = option.description, style = color)])
except:
return showError(message = "Can't show the shell's options. Reason: ",
Expand Down

0 comments on commit 0f267b8

Please sign in to comment.