passphrase/passphrase.nimble
Joseph Montanaro e8d2f16c9e
All checks were successful
continuous-integration/drone/tag Build is passing
switch to fixed-width storage for word list
2022-01-10 11:20:30 -08:00

46 lines
1.1 KiB
Nim

# Package
version = "0.3.1"
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"
requires "zippy >= 0.7.3"
# Tasks n scripts
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
task(dictionary, "Generate dictionary from BNC XML files"):
echo "Building dictionary"
let output = runCmd("nim c --run --threads:on -d:release -d:lto src/process.nim data/BNC/2554/download/Texts src/")
echo output.strip().splitlines()[^1]
task(pack, "Pack dictionary into fixed-width file and compress"):
echo "Packing dictionary"
echo runCmd("nim c --run src/dictionary.nim data/dictionary.txt data/dictionary.pack")
before(build):
if not fileExists("data/dictionary.txt"):
dictionaryTask()
if not fileExists("data/dictionary.pack"):
packTask()