From 0f267b82bc8ed66508bfc79185aa0d4398c0fd7b Mon Sep 17 00:00:00 2001 From: thindil Date: Mon, 18 Dec 2023 05:29:36 +0000 Subject: [PATCH] feat: made the shell's options' list more human-friendly FossilOrigin-Name: de22db7054204ab4e55db9b1006319829f7991dfdd824f675aad04cb4241c0d3 --- src/options.nim | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/options.nim b/src/options.nim index e3c73dcc..c682559c 100644 --- a/src/options.nim +++ b/src/options.nim @@ -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: ",