passphrase/passphrase.nimble
2021-07-26 06:48:01 -07:00

51 lines
1.1 KiB
Nim

# Package
version = "0.1.0"
author = "Joseph Montanaro"
description = "Passphrase generator and dictionary builder"
license = "none"
srcDir = "src"
bin = @["passphrase"]
# Dependencies
requires "nim >= 1.0"
requires "nimcrypto >= 0.4.8"
# Tasks n scripts
import strutils
proc runCmd(command: string, input = "", cache = ""): string =
let (output, exitCode) = gorgeEx(command, input, cache)
if exitCode != 0:
echo "Command failed: " & command
echo "Output:\n ", output.splitLines().join("\n ")
quit(exitCode)
result = output
proc pathExists(filename: string): bool =
let (output, code) = gorgeEx("ls " & filename)
return code == 0
task(dictionary, "Generate dictionary from BNC XML files"):
if not pathExists("BNC"):
quit("Cannot build dictionary: BNC data files not found.", 1)
echo "Building dictionary"
echo runCmd("nim c --run --threads:on -d:release -d:lto src/process.nim")
task(showexec, "this is a test"):
let (output, exitCode) = gorgeEx("ls BNC")
echo output
echo exitCode
before(build):
if not pathExists("src/dictionary.txt"):
dictionaryTask()