mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-01-22 07:07:32 -06:00
debug -> verbosity
This commit is contained in:
parent
eecde6f7da
commit
c74e07801c
5 changed files with 20 additions and 16 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -52,6 +52,6 @@ jobs:
|
|||
cache
|
||||
--host,="${{ inputs.hosts }}"
|
||||
--flake .
|
||||
--debug
|
||||
-vv
|
||||
--
|
||||
--keep-going
|
||||
|
|
4
.github/workflows/update.yml
vendored
4
.github/workflows/update.yml
vendored
|
@ -56,7 +56,7 @@ jobs:
|
|||
cache
|
||||
--host,="${{ env.hosts }}"
|
||||
--flake .
|
||||
--debug
|
||||
-vv
|
||||
--
|
||||
--quiet
|
||||
|
||||
|
@ -92,7 +92,7 @@ jobs:
|
|||
ci update
|
||||
--host,="${{ env.hosts }}"
|
||||
--flake .
|
||||
--debug
|
||||
-vv
|
||||
--
|
||||
--quiet
|
||||
|
||||
|
|
|
@ -19,9 +19,10 @@ hwylCli:
|
|||
host:
|
||||
T seq[string]
|
||||
? "host(s) to build"
|
||||
debug:
|
||||
? "enable debug mode"
|
||||
- d
|
||||
verbose:
|
||||
T Count
|
||||
? "increase verbosity (up to 2)"
|
||||
- v
|
||||
resetCache:
|
||||
? "set cache timeout to 0"
|
||||
[misc]
|
||||
|
@ -33,7 +34,7 @@ hwylCli:
|
|||
- m
|
||||
preSub:
|
||||
setupLoggers()
|
||||
updateContext(host, flake, debug, resetCache)
|
||||
updateContext(host, flake, verbose, resetCache)
|
||||
|
||||
subcommands:
|
||||
[build]
|
||||
|
@ -70,7 +71,7 @@ hwylCli:
|
|||
# when really I want it to only happen in the lowest "subcommand"
|
||||
# needs to be fixed in hwylterm
|
||||
preSub:
|
||||
updateContext(host, flake, debug, resetCache)
|
||||
updateContext(host, flake, verbose, resetCache)
|
||||
subcommands:
|
||||
[update]
|
||||
... "build current and updated hosts"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import std/[logging, os, strformat, strutils]
|
||||
from std/nativesockets import getHostname
|
||||
import hwylterm, hwylterm/logging
|
||||
from hwylterm/hwylcli import Count
|
||||
import ./logging
|
||||
|
||||
type
|
||||
|
@ -9,6 +10,7 @@ type
|
|||
hosts: seq[string]
|
||||
debug: bool
|
||||
ci: bool
|
||||
verbose: Count
|
||||
resetCache: bool
|
||||
|
||||
let currentHost* = getHostName()
|
||||
|
@ -29,17 +31,17 @@ var oc = initContext()
|
|||
proc checkPath(s: string): string =
|
||||
## fail if path doesn't exist
|
||||
if not s.dirExists: fatalQuit fmt"flake path: {s} does not exist"
|
||||
s
|
||||
result = s
|
||||
|
||||
proc updateContext*(
|
||||
host: seq[string],
|
||||
flake: string,
|
||||
debug: bool,
|
||||
verbose: Count,
|
||||
resetCache: bool
|
||||
) =
|
||||
if host.len > 0: oc.hosts = host
|
||||
oc.debug = debug
|
||||
if debug:
|
||||
oc.verbose = verbose
|
||||
if verbose.val > 1:
|
||||
consoleLogger.levelThreshold = lvlAll
|
||||
oc.resetCache = resetCache
|
||||
if flake != "":
|
||||
|
@ -49,8 +51,9 @@ proc updateContext*(
|
|||
|
||||
debug bb(fmt"""[b]flake[/]: {oc.flake}, [b]hosts[/]: {oc.hosts.join(" ")}""")
|
||||
|
||||
|
||||
proc getVerbosity*(): int = return oc.verbose.val
|
||||
proc getHosts*(): seq[string] = return oc.hosts
|
||||
proc getFlake*(): string = return oc.flake
|
||||
proc isDebug*(): bool = return oc.debug
|
||||
proc isResetCache*(): bool = return oc.resetCache
|
||||
proc isCi*(): bool = return oc.ci
|
||||
|
|
|
@ -132,7 +132,7 @@ proc display(msg: string, drvs: seq[Derivation]) =
|
|||
echo " ", drv.name.trunc(maxLen).alignLeft(maxLen), " ", drv.hash.bb("faint")
|
||||
|
||||
proc display(output: DryRunOutput) =
|
||||
if isDebug():
|
||||
if getVerbosity() > 0:
|
||||
display("to fetch", output.toFetch)
|
||||
else:
|
||||
echo fmt"to fetch: [bold cyan]{output.toFetch.len()}[/]".bb
|
||||
|
|
Loading…
Reference in a new issue