diff --git a/src/hwylterm/chooser.nim b/src/hwylterm/chooser.nim index ca8d4ca..e7299af 100644 --- a/src/hwylterm/chooser.nim +++ b/src/hwylterm/chooser.nim @@ -9,10 +9,13 @@ ``` ]## - import std/[enumerate, os, strutils, sequtils, sets, terminal] -import ./private/tryImport -tryImport(illwill, "hwylterm/choose requires illwill >= 0.4.1") + +template tryImport*(x, body) = + when not (compiles do: import x): body else: import x +tryImport illwill: + {.fatal: "hwylterm/choose requires illwill >= 0.4.1".} + proc exitProc() {.noconv.} = illwillDeInit() diff --git a/src/hwylterm/cli.nim b/src/hwylterm/cli.nim index 8cfae5d..3ec86cc 100644 --- a/src/hwylterm/cli.nim +++ b/src/hwylterm/cli.nim @@ -6,8 +6,11 @@ import std/[tables] import ./bbansi -import ./private/tryImport -tryImport(cligen, "hwylterm/cli requires cligen>= 1.7.5") + +template tryImport*(x, body) = + when not (compiles do: import x): body else: import x +tryImport cligen: + {.fatal: "hwylterm/cli requires cligen>=1.7.5".} type diff --git a/src/hwylterm/private/tryImport.nim b/src/hwylterm/private/tryImport.nim deleted file mode 100644 index f8e73c7..0000000 --- a/src/hwylterm/private/tryImport.nim +++ /dev/null @@ -1,6 +0,0 @@ -template tryImport*(x, msg) = - const importable = compiles: import x - when not importable: - {.fatal: msg} - else: - import x