From b68a35fd7837a85f0c107eab420a4262b2e64ceb Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 26 Sep 2024 10:41:53 -0500 Subject: [PATCH] just add the tryImport to both modules --- src/hwylterm/chooser.nim | 9 ++++++--- src/hwylterm/cli.nim | 7 +++++-- src/hwylterm/private/tryImport.nim | 6 ------ 3 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 src/hwylterm/private/tryImport.nim 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