Switch 'refresh' command to new CLI module.

This commit is contained in:
Dominik Picheta 2016-12-19 23:35:27 +01:00
commit dcbbb8b62e
3 changed files with 22 additions and 12 deletions

View file

@ -22,12 +22,14 @@ type
HighPriority, MediumPriority, LowPriority
DisplayType* = enum
Error, Warning, Message
Error, Warning, Message, Success
const
longestCategory = len("Downloading")
foregrounds: array[Error .. Message, ForegroundColor] = [fgRed, fgYellow, fgCyan]
styles: array[HighPriority .. LowPriority, set[Style]] = [{styleBright}, {}, {styleDim}]
foregrounds: array[Error .. Success, ForegroundColor] =
[fgRed, fgYellow, fgCyan, fgGreen]
styles: array[HighPriority .. LowPriority, set[Style]] =
[{styleBright}, {}, {styleDim}]
proc newCLI(): CLI =
result = CLI(

View file

@ -2,7 +2,7 @@
# BSD License. Look at license.txt for more info.
import parsecfg, streams, strutils, os, tables, Uri
import tools, version, common
import tools, version, common, cli
type
Config* = object
@ -50,13 +50,15 @@ proc parseConfig*(): Config =
var f = newFileStream(confFile, fmRead)
if f == nil:
# Try the old deprecated babel.ini
# TODO: This can be removed.
confFile = getConfigDir() / "babel" / "babel.ini"
f = newFileStream(confFile, fmRead)
if f != nil:
echo("[Warning] Using deprecated config file at ", confFile)
display("Warning", "Using deprecated config file at " & confFile,
displayType = Warning)
if f != nil:
echo("Reading from config file at ", confFile)
display("Reading", "config file at " & confFile)
var p: CfgParser
open(p, f, confFile)
var currentSection = ""