Start work on dashinit, in nim.

This commit is contained in:
Sangelo 2023-10-05 09:34:44 +02:00
commit b3aed80afd
6 changed files with 164 additions and 0 deletions

37
.gitignore vendored Normal file
View file

@ -0,0 +1,37 @@
# Ignore build directories
build/
dist/
# Nim cache and generated files
nimcache/
*.nimble-link
*.nim.cfg
*.nimble
*.so
*.dll
*.dylib
*.exe
# Ignore specific NimScript files, but not config.nims
*.nims
# Ignore VS Code settings
.vscode/
# Logs and databases
*.log
*.lst
*.db
# Ignore any temporary files
*.tmp
*.swp
*.bak
*~
# If using nimpretty for code formatting
.nimpretty.cfg
# Exclude project files
!config.nims
!dashinit.nimble

42
README.md Normal file
View file

@ -0,0 +1,42 @@
# dashinit
Simple yet powerful Rust powered templating tool. Fully configurable!
## Table of contents
- [dashinit](#dashinit)
- [Table of contents](#table-of-contents)
- [Install using script](#install-using-script)
- [Compile \& install manually](#compile--install-manually)
- [Update](#update)
- [Usage](#usage)
- [Uninstall](#uninstall)
## Install using script
Still not in usable state, instructions will follow.
## Compile & install manually
To compile `dashinit`, run the following command after cloning:
```bash
# build a binary
nim build
```
## Update
Still not in usable state, instructions will follow.
## Usage
To use niminit, run it inside the folder you'd like to initialise.
Optionally, you can pass the ``-g`` flag to also create a git repository.
## Uninstall
Still not in usable state, instructions will follow.
---
[Back to the top](#dashinit)

67
config.nims Normal file
View file

@ -0,0 +1,67 @@
#### config.nims ####
# Set some common options
switch("d", "release")
switch("hints", "off")
# Helper procs to abstract away OS-specific commands
proc createDirectory(dir: string) =
when defined(windows):
exec "cmd /c mkdir " & dir
else:
exec "mkdir -p " & dir
proc removeFileOrDir(path: string) =
when defined(windows):
if path.endsWith("/"):
exec "cmd /c rmdir /s /q " & path
else:
exec "cmd /c del /f /q " & path
else:
exec "rm -rf " & path
# Build task for intermediate builds
task build, "Compile the project for intermediate builds":
createDirectory("build") ## Ensure the build directory exists
exec "nim c -o:build/dashinit src/main.nim" ## Compile the main project file into the build directory
# Distribution task for final builds
task dist, "Compile the project for distribution":
createDirectory("dist") ## Ensure the directory exists
exec "nim c -o:dist/dashinit src/main.nim" ## Compile the main project file into the dist directory
# Dev task (Compiles and runs main.nim)
task dev, "Run tests":
switch("undef", "release") ## Unset the release switch for this task
createDirectory("dev") ## Ensure dev directory exists
exec "nim c -o:dev/dashinit -r src/main.nim"
# Clean task to remove generated files
task clean, "Clean up generated files":
removeFileOrDir("build/*")
removeFileOrDir("dist/*")
removeFileOrDir("dev/*")
task deepclean, "Clean up by removing build/ and dist/ directories":
removeFileOrDir("build/")
removeFileOrDir("dist/")
removeFileOrDir("dev/")
#### Aliases ####
# Build shorthand
task b, "Alias for build task":
exec "nim build"
# Dist shorthand
task d, "Alias for dist task":
exec "nim dist"
# Clean shorthand
task cl, "Alias for clean task":
exec "nim clean"
# Deepclean shorthand
task dcl, "Alias for deep clean task":
exec "nim deepclean"

13
dashinit.nimble Normal file
View file

@ -0,0 +1,13 @@
# Package
version = "0.1.0"
author = "Sangelo"
description = "A fast way to initialise all your projects!"
license = "MIT"
srcDir = "src"
bin = @["dashinit"]
# Dependencies
requires "nim >= 2.0.0"

BIN
src/main Executable file

Binary file not shown.

5
src/main.nim Normal file
View file

@ -0,0 +1,5 @@
# This is just an example to get you started. A typical binary package
# uses this file as the main entry point of the application.
when isMainModule:
echo("Hello, World!")