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