nakefile.nim 605 B

123456789101112131415161718192021222324
  1. import nake
  2. nakeImports
  3. task "install", "compile and install nake binary":
  4. if shell("nim", "c", "nake") == 0:
  5. let path = getEnv("PATH").split(PathSep)
  6. for index, dir in pairs(path):
  7. echo " ", index, ". ", dir
  8. echo "Where to install nake binary? (quit with ^C or quit or exit)"
  9. let ans = stdin.readLine().toLowerAscii
  10. var index = 0
  11. case ans
  12. of "q", "quit", "x", "exit":
  13. quit 0
  14. else:
  15. index = parseInt(ans)
  16. if index > path.len or index < 0:
  17. echo "Invalid index."
  18. quit 1
  19. moveFile "nake", path[index]/"nake"
  20. echo "Great success!"